From b268bdd67ec4da8847f8e17bf07ea7cb4db007cf Mon Sep 17 00:00:00 2001 From: Ben Reich Date: Sun, 2 Mar 2025 07:23:10 +1100 Subject: Fix RenameDocumentUitest#testRenameFile_Cancel For some reason the onView().perform() logic that is present in the clickDialogCancelButton is not clicking the actual button. This is leading to the test just leaving the dialog staying on the screen and the test being unable to find the directoy list. Instead let's update it to use UiObject2 and perform the click, this seems more stable across Android versions. Fix: 385439355 Bug: 394151244 Flag: EXEMPT test fix Test: atest RenameDocumentUiTest#testRenameFile_Cancel Change-Id: Ib86d26a2f9c1f1ed24ae9270d4c7b448be9267bc --- 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 b63057185..161510e2a 100644 --- a/tests/common/com/android/documentsui/bots/UiBot.java +++ b/tests/common/com/android/documentsui/bots/UiBot.java @@ -292,7 +292,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.button2)).perform(click()); + UiObject2 okButton = mDevice.findObject(By.res("android:id/button2")); + okButton.click(); } public UiObject findMenuLabelWithName(String label) { -- cgit v1.2.3-59-g8ed1b