diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt index 278e121dca..8cf192699d 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt @@ -335,7 +335,11 @@ class HomeScreenRobot { } fun togglePrivateBrowsingMode() { - onView(ViewMatchers.withResourceName("privateBrowsingButton")) + mDevice.findObject(UiSelector().resourceId("$packageName:id/privateBrowsingButton")) + .waitForExists( + waitingTime + ) + privateBrowsingButton() .perform(click()) } @@ -344,10 +348,10 @@ class HomeScreenRobot { for (i in 1..5) { mDevice.findObject(UiSelector().resourceId("$packageName:id/privateBrowsingButton")) .waitForExists( - waitingTime + waitingTime ) - onView(ViewMatchers.withResourceName("privateBrowsingButton")) + privateBrowsingButton() .perform(click()) } @@ -502,8 +506,8 @@ private fun assertHomeMenu() = onView(ViewMatchers.withResourceName("menuButton" .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) private fun assertHomePrivateBrowsingButton() = - onView(ViewMatchers.withResourceName("privateBrowsingButton")) - .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) + privateBrowsingButton() + .check(matches(isDisplayed())) private fun assertHomeWordmark() = onView(ViewMatchers.withResourceName("wordmark")) .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) @@ -718,6 +722,8 @@ private fun assertShareTabsOverlay() { onView(withId(R.id.share_tab_url)).check(matches(isDisplayed())) } +private fun privateBrowsingButton() = onView(withId(R.id.privateBrowsingButton)) + private fun tabMediaControlButton() = onView(withId(R.id.play_pause_button)) private fun collectionItem(title: String) =