From e863a4546f3d1f5fb5c779b6e3058a31acc1db29 Mon Sep 17 00:00:00 2001 From: Alison Cichowlas Date: Fri, 18 May 2018 19:29:48 -0400 Subject: ClearAll and Reply jank test fix. Clear All was case-sensitive, changing the button from "CLEAR ALL" to "Clear All" broke it. Let's use a more flexible matcher in hopes of not collapsing during the next paint job. Reply looked for the visible text of the button, which was removed in favor of just an icon. Let's peek at the accessibility text instead to identify this button. Bug: 79201770 Test: runtest --path platform_testing/tests/jank/UbSystemUiJankTests/src/android/platform/systemui/tests/jank/SystemUiJankTests.java Change-Id: I97c7177a173852b260cfa0d1433106eccb3da32d --- .../platform/systemui/tests/jank/SystemUiJankTests.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/jank/UbSystemUiJankTests/src/android/platform/systemui/tests/jank/SystemUiJankTests.java b/tests/jank/UbSystemUiJankTests/src/android/platform/systemui/tests/jank/SystemUiJankTests.java index 833f90874..7b144aa4d 100644 --- a/tests/jank/UbSystemUiJankTests/src/android/platform/systemui/tests/jank/SystemUiJankTests.java +++ b/tests/jank/UbSystemUiJankTests/src/android/platform/systemui/tests/jank/SystemUiJankTests.java @@ -112,6 +112,9 @@ public class SystemUiJankTests extends JankTestBase { */ private static final int GROUP_MODE_UNGROUPED = 2; + private final UiSelector clearAllSelector = + new UiSelector().className(Button.class).descriptionContains("CLEAR ALL"); + private UiDevice mDevice; private ArrayList mLaunchedPackages; private NotificationManager mNotificationManager; @@ -205,8 +208,7 @@ public class SystemUiJankTests extends JankTestBase { mDevice.waitForIdle(); // CLEAR ALL might not be visible in case we don't have any clearable notifications. - UiObject clearAll = - mDevice.findObject(new UiSelector().className(Button.class).text("CLEAR ALL")); + UiObject clearAll = mDevice.findObject(clearAllSelector); if (clearAll.exists()) { clearAll.click(); } @@ -589,8 +591,7 @@ public class SystemUiJankTests extends JankTestBase { afterTest = "afterClearAll") @GfxMonitor(processName = SYSTEMUI_PACKAGE) public void testClearAll() throws Exception { - UiObject clearAll = - mDevice.findObject(new UiSelector().className(Button.class).text("CLEAR ALL")); + UiObject clearAll = mDevice.findObject(clearAllSelector); while (!clearAll.exists()) { scrollDown(); } @@ -828,7 +829,8 @@ public class SystemUiJankTests extends JankTestBase { afterTest = "afterInlineReply") @GfxMonitor(processName = SYSTEMUI_PACKAGE) public void testInlineReply() throws Exception { - UiObject2 replyButton = mDevice.findObject(By.clazz(Button.class).text(REPLY_TEXT)); + UiObject2 replyButton = mDevice.findObject( + By.clazz(Button.class).descStartsWith(REPLY_TEXT)); assertNotNull("Could not find button with text '" + REPLY_TEXT + "'.", replyButton); for (int i = 0; i < INNER_LOOP; i++) { replyButton.click(); -- cgit v1.2.3