From aa495b452633105f222f497ac08c4d16190bd4c1 Mon Sep 17 00:00:00 2001 From: Aaron Train Date: Thu, 23 Jul 2020 17:17:54 -0400 Subject: [PATCH] No issue: Fix recent UI test breakage (#12869) --- .../org/mozilla/fenix/ui/robots/BrowserRobot.kt | 2 +- .../mozilla/fenix/ui/robots/TabDrawerRobot.kt | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt index 576c6d01a..964f65d45 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt @@ -366,7 +366,7 @@ class BrowserRobot { } fun openNavigationToolbar(interact: NavigationToolbarRobot.() -> Unit): NavigationToolbarRobot.Transition { - + mDevice.waitForIdle(waitingTime) navURLBar().click() NavigationToolbarRobot().interact() diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/TabDrawerRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/TabDrawerRobot.kt index 638674192..8acea8478 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/TabDrawerRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/TabDrawerRobot.kt @@ -29,6 +29,8 @@ import androidx.test.uiautomator.UiDevice import androidx.test.uiautomator.Until import androidx.test.uiautomator.Until.findObject import org.hamcrest.CoreMatchers.allOf +import org.hamcrest.CoreMatchers.anyOf +import org.hamcrest.CoreMatchers.containsString import org.mozilla.fenix.R import org.mozilla.fenix.helpers.TestAssetHelper import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime @@ -179,10 +181,21 @@ private fun tabMediaControlButton() = onView(withId(R.id.play_pause_button)) private fun closeTabButton() = onView(withId(R.id.mozac_browser_tabstray_close)) private fun assertCloseTabsButton(title: String) = - onView(allOf(withId(R.id.mozac_browser_tabstray_close), withContentDescription("Close tab $title"))) + onView( + allOf( + withId(R.id.mozac_browser_tabstray_close), + withContentDescription("Close tab $title") + ) + ) .check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) -private fun normalBrowsingButton() = onView(withContentDescription("Open tabs")) +private fun normalBrowsingButton() = onView( + anyOf( + withContentDescription(containsString("open tabs. Tap to switch tabs.")), + withContentDescription(containsString("open tab. Tap to switch tabs.")) + ) +) + private fun privateBrowsingButton() = onView(withContentDescription("Private tabs")) private fun newTabButton() = onView(withId(R.id.new_tab_button)) private fun threeDotMenu() = onView(withId(R.id.tab_tray_overflow))