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 9792d02dde69..f177a9a353fb 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt @@ -41,6 +41,12 @@ import org.mozilla.fenix.ui.robots.notificationShade class TabbedBrowsingTest { private val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) private lateinit var mockWebServer: MockWebServer + private val settings = InstrumentationRegistry.getInstrumentation().targetContext.settings() + + // saving default values of feature flags + private var jumpBackInCFRDefault: Boolean = settings.shouldShowJumpBackInCFR + private var recentTabsFeatureDefault: Boolean = settings.showRecentTabsFeature + private var showPocketDefault: Boolean = settings.showPocketRecommendationsFeature /* ktlint-disable no-blank-line-before-rbrace */ // This imposes unreadable grouping. @get:Rule @@ -48,7 +54,7 @@ class TabbedBrowsingTest { @Before fun setUp() { - activityTestRule.activity.applicationContext.settings().shouldShowJumpBackInCFR = false + settings.shouldShowJumpBackInCFR = false mockWebServer = MockWebServer().apply { dispatcher = AndroidAssetDispatcher() start() @@ -58,6 +64,10 @@ class TabbedBrowsingTest { @After fun tearDown() { mockWebServer.shutdown() + // resetting the default values of these features flags + settings.shouldShowJumpBackInCFR = jumpBackInCFRDefault + settings.showRecentTabsFeature = recentTabsFeatureDefault + settings.showPocketRecommendationsFeature = showPocketDefault } @Test @@ -138,6 +148,10 @@ class TabbedBrowsingTest { @Test fun closeTabTest() { + // disabling these features because they interfere with the snackbar visibility + settings.showRecentTabsFeature = false + settings.showPocketRecommendationsFeature = false + val genericURL = TestAssetHelper.getGenericAsset(mockWebServer, 1) navigationToolbar { @@ -176,6 +190,9 @@ class TabbedBrowsingTest { @Test fun closePrivateTabTest() { + settings.showRecentTabsFeature = false + settings.showPocketRecommendationsFeature = false + val genericURL = TestAssetHelper.getGenericAsset(mockWebServer, 1) homeScreen { }.togglePrivateBrowsingMode() 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 cea2ac9e7311..41818e13728e 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 @@ -102,9 +102,13 @@ class BrowserRobot { } fun verifyTabCounter(expectedText: String) { - val counter = mDevice.findObject(UiSelector().resourceId("$packageName:id/counter_text")) - counter.waitForExists(waitingTime) - assertTrue(counter.text.equals(expectedText)) + val counter = + mDevice.findObject( + UiSelector() + .resourceId("$packageName:id/counter_text") + .text(expectedText) + ) + assertTrue(counter.waitForExists(waitingTime)) } fun verifySnackBarText(expectedText: String) { diff --git a/automation/taskcluster/androidTest/flank-x86.yml b/automation/taskcluster/androidTest/flank-x86.yml index fed6be86c231..22082e2e3b1e 100644 --- a/automation/taskcluster/androidTest/flank-x86.yml +++ b/automation/taskcluster/androidTest/flank-x86.yml @@ -54,7 +54,7 @@ flank: max-test-shards: -1 # num-test-runs: the amount of times to run the tests. # 1 runs the tests once. 10 runs all the tests 10x - num-test-runs: 20 + num-test-runs: 100 ### Output Style flag ## Output style of execution status. May be one of [verbose, multi, single, compact]. ## For runs with only one test execution the default value is 'verbose', in other cases