Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
run #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Oana Horvath committed Oct 25, 2021
1 parent 233bf75 commit 3e28229
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,20 @@ 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
val activityTestRule = HomeActivityTestRule()

@Before
fun setUp() {
activityTestRule.activity.applicationContext.settings().shouldShowJumpBackInCFR = false
settings.shouldShowJumpBackInCFR = false
mockWebServer = MockWebServer().apply {
dispatcher = AndroidAssetDispatcher()
start()
Expand All @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -176,6 +190,9 @@ class TabbedBrowsingTest {

@Test
fun closePrivateTabTest() {
settings.showRecentTabsFeature = false
settings.showPocketRecommendationsFeature = false

val genericURL = TestAssetHelper.getGenericAsset(mockWebServer, 1)

homeScreen { }.togglePrivateBrowsingMode()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion automation/taskcluster/androidTest/flank-x86.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3e28229

Please sign in to comment.