From 71b31bd1fcb42c06b7469833a2a417fec1d75eda Mon Sep 17 00:00:00 2001 From: AndiAJ Date: Tue, 5 Apr 2022 14:03:02 +0300 Subject: [PATCH] [fenix] For https://github.com/mozilla-mobile/fenix/issues/24508 re-enable private browsing UI tests --- .../org/mozilla/fenix/ui/CrashReportingTest.kt | 1 - .../org/mozilla/fenix/ui/HomeScreenTest.kt | 2 -- .../java/org/mozilla/fenix/ui/SmokeTest.kt | 1 - .../org/mozilla/fenix/ui/TabbedBrowsingTest.kt | 1 - .../mozilla/fenix/ui/robots/HomeScreenRobot.kt | 18 ++++++++++++++---- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/CrashReportingTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/CrashReportingTest.kt index 82730cd92d..2e4dda2031 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/CrashReportingTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/CrashReportingTest.kt @@ -104,7 +104,6 @@ class CrashReportingTest { } } - @Ignore("Failing, see: https://github.com/mozilla-mobile/fenix/issues/24508") @SmokeTest @Test fun privateBrowsingUseAppWhileTabIsCrashedTest() { diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/HomeScreenTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/HomeScreenTest.kt index 7c6884fb93..1169a0305d 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/HomeScreenTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/HomeScreenTest.kt @@ -8,7 +8,6 @@ import androidx.test.platform.app.InstrumentationRegistry import androidx.test.uiautomator.By import androidx.test.uiautomator.UiDevice import androidx.test.uiautomator.Until -import org.junit.Ignore import org.junit.Rule import org.junit.Test import org.mozilla.fenix.customannotations.SmokeTest @@ -61,7 +60,6 @@ class HomeScreenTest { } } - @Ignore("Failing, see: https://github.com/mozilla-mobile/fenix/issues/24508") @Test fun privateModeScreenItemsTest() { homeScreen { }.dismissOnboarding() diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt index f318a41321..3521fea83e 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt @@ -932,7 +932,6 @@ class SmokeTest { } } - @Ignore("Failing, see: https://github.com/mozilla-mobile/fenix/issues/24508") @Test fun addPrivateBrowsingShortcutTest() { homeScreen { diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt index f7c909ce52..f9ee365232 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt @@ -333,7 +333,6 @@ class TabbedBrowsingTest { } } - @Ignore("Failing, see: https://github.com/mozilla-mobile/fenix/issues/24508") @Test fun verifyContextMenuShortcuts() { val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) 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 630ab1bcdf..ea2af99c50 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 @@ -374,8 +374,12 @@ class HomeScreenRobot { } fun openCommonMythsLink(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition { - onView(withText(R.string.private_browsing_common_myths)) - .perform(click()) + mDevice.findObject( + UiSelector() + .textContains( + getStringResource(R.string.private_browsing_common_myths) + ) + ).also { it.click() } BrowserRobot().interact() return BrowserRobot.Transition() @@ -633,8 +637,14 @@ private fun assertTakePlacementBottomRadioButton() { } private fun assertPrivateSessionMessage() = - onView(withText(R.string.private_browsing_common_myths)) - .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) + assertTrue( + mDevice.findObject( + UiSelector() + .textContains( + getStringResource(R.string.private_browsing_common_myths) + ) + ).waitForExists(waitingTime) + ) private fun collectionTitle(title: String) = onView(allOf(withId(R.id.collection_title), withText(title)))