From dfc30280ba72851e63588dcb7adb8f69721d77a8 Mon Sep 17 00:00:00 2001 From: Ben Reich Date: Fri, 28 Feb 2025 11:19:39 +1100 Subject: Fix RenameDocumentUiTest#testRenameFile_OkButton For some reason the onView().perform() logic that is present in the clickDialogOkButton is not clicking the actual button. This is leading to the test just dismissing the dialog instead of actioning it. Instead let's update it to use UiObject2 and perform the click, this seems more stable across Android versions. Bug: 394151244 Bug: 384582399 Test: atest RenameDocumentUiTest#testRenameFile_OkButton Flag: EXEMPT Test fix Change-Id: I6535a023b66506e363d03b121abb60e6b08c5070 --- tests/common/com/android/documentsui/bots/UiBot.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/common/com/android/documentsui/bots/UiBot.java b/tests/common/com/android/documentsui/bots/UiBot.java index 4ec75bdc6..b63057185 100644 --- a/tests/common/com/android/documentsui/bots/UiBot.java +++ b/tests/common/com/android/documentsui/bots/UiBot.java @@ -284,7 +284,8 @@ public class UiBot extends Bots.BaseBot { // Espresso has flaky results when keyboard shows up, so hiding it for now // before trying to click on any dialog button Espresso.closeSoftKeyboard(); - onView(withId(android.R.id.button1)).perform(click()); + UiObject2 okButton = mDevice.findObject(By.res("android:id/button1")); + okButton.click(); } public void clickDialogCancelButton() throws UiObjectNotFoundException { -- cgit v1.2.3-59-g8ed1b