Skip to content

Commit

Permalink
Closes mozilla-mobile#13877: shortens closeTabTest to avoid flakiness
Browse files Browse the repository at this point in the history
  • Loading branch information
Oana Horvath committed Aug 26, 2020
1 parent 4782705 commit 9288612
Showing 1 changed file with 62 additions and 67 deletions.
129 changes: 62 additions & 67 deletions app/src/androidTest/java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -149,92 +149,87 @@ class TabbedBrowsingTest {

@Test
fun closeTabTest() {
var genericURLS = TestAssetHelper.getGenericAssets(mockWebServer)

genericURLS.forEachIndexed { index, element ->
navigationToolbar {
}.openNewTabAndEnterToBrowser(element.url) {
}.openTabDrawer {
verifyExistingOpenTabs("Test_Page_${index + 1}")
verifyCloseTabsButton("Test_Page_${index + 1}")
closeTabViaXButton("Test_Page_${index + 1}")
verifySnackBarText("Tab closed")
snackBarButtonClick("UNDO")
}
val genericURL = TestAssetHelper.getGenericAsset(mockWebServer, 1)

mDevice.waitForIdle()
navigationToolbar {
}.openNewTabAndEnterToBrowser(genericURL.url) {
}.openTabDrawer {
verifyExistingOpenTabs("Test_Page_1")
verifyCloseTabsButton("Test_Page_1")
closeTabViaXButton("Test_Page_1")
verifySnackBarText("Tab closed")
snackBarButtonClick("UNDO")
}

browserScreen {
}.openTabDrawer {
verifyExistingOpenTabs("Test_Page_${index + 1}")
swipeTabRight("Test_Page_${index + 1}")
verifySnackBarText("Tab closed")
snackBarButtonClick("UNDO")
}
mDevice.waitForIdle()

mDevice.waitForIdle()
browserScreen {
}.openTabDrawer {
verifyExistingOpenTabs("Test_Page_1")
swipeTabRight("Test_Page_1")
verifySnackBarText("Tab closed")
snackBarButtonClick("UNDO")
}

browserScreen {
}.openTabDrawer {
verifyExistingOpenTabs("Test_Page_${index + 1}")
swipeTabLeft("Test_Page_${index + 1}")
verifySnackBarText("Tab closed")
snackBarButtonClick("UNDO")
}
mDevice.waitForIdle()

mDevice.waitForIdle()
browserScreen {
}.openTabDrawer {
verifyExistingOpenTabs("Test_Page_1")
swipeTabLeft("Test_Page_1")
verifySnackBarText("Tab closed")
snackBarButtonClick("UNDO")
}

mDevice.waitForIdle()

browserScreen {
}.openTabDrawer {
verifyExistingOpenTabs("Test_Page_${index + 1}")
}.openHomeScreen {
}
browserScreen {
}.openTabDrawer {
verifyExistingOpenTabs("Test_Page_1")
}.openHomeScreen {
}
}

@Test
fun closePrivateTabTest() {
var genericURLS = TestAssetHelper.getGenericAssets(mockWebServer)
val genericURL = TestAssetHelper.getGenericAsset(mockWebServer, 1)

homeScreen { }.togglePrivateBrowsingMode()
genericURLS.forEachIndexed { index, element ->
navigationToolbar {
}.openNewTabAndEnterToBrowser(element.url) {
}.openTabDrawer {
verifyExistingOpenTabs("Test_Page_${index + 1}")
verifyCloseTabsButton("Test_Page_${index + 1}")
closeTabViaXButton("Test_Page_${index + 1}")
verifySnackBarText("Private tab closed")
snackBarButtonClick("UNDO")
}
navigationToolbar {
}.openNewTabAndEnterToBrowser(genericURL.url) {
}.openTabDrawer {
verifyExistingOpenTabs("Test_Page_1")
verifyCloseTabsButton("Test_Page_1")
closeTabViaXButton("Test_Page_1")
verifySnackBarText("Private tab closed")
snackBarButtonClick("UNDO")
}

mDevice.waitForIdle()
mDevice.waitForIdle()

browserScreen {
}.openTabDrawer {
verifyExistingOpenTabs("Test_Page_${index + 1}")
swipeTabRight("Test_Page_${index + 1}")
verifySnackBarText("Private tab closed")
snackBarButtonClick("UNDO")
}
browserScreen {
}.openTabDrawer {
verifyExistingOpenTabs("Test_Page_1")
swipeTabRight("Test_Page_1")
verifySnackBarText("Private tab closed")
snackBarButtonClick("UNDO")
}

mDevice.waitForIdle()
mDevice.waitForIdle()

browserScreen {
}.openTabDrawer {
verifyExistingOpenTabs("Test_Page_${index + 1}")
swipeTabLeft("Test_Page_${index + 1}")
verifySnackBarText("Private tab closed")
snackBarButtonClick("UNDO")
}
browserScreen {
}.openTabDrawer {
verifyExistingOpenTabs("Test_Page_1")
swipeTabLeft("Test_Page_1")
verifySnackBarText("Private tab closed")
snackBarButtonClick("UNDO")
}

mDevice.waitForIdle()
mDevice.waitForIdle()

browserScreen {
}.openTabDrawer {
verifyExistingOpenTabs("Test_Page_${index + 1}")
closeTabViaXButton("Test_Page_${index + 1}")
}
browserScreen {
}.openTabDrawer {
verifyExistingOpenTabs("Test_Page_1")
}
}

Expand Down

0 comments on commit 9288612

Please sign in to comment.