Skip to content

Commit

Permalink
For mozilla-mobile#25184 and mozilla-mobile#23417 fix flaky testDownl…
Browse files Browse the repository at this point in the history
…oadPrompt and testCloseDownloadPrompt
  • Loading branch information
AndiAJ committed May 18, 2022
1 parent 7def333 commit e4d13d3
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,36 @@ fun downloadRobot(interact: DownloadRobot.() -> Unit): DownloadRobot.Transition
}

private fun assertDownloadPrompt(fileName: String) {
assertTrue(
"Download prompt button not visible",
mDevice.findObject(UiSelector().resourceId("$packageName:id/download_button"))
.waitForExists(waitingTime)
)
assertTrue(
"$fileName title doesn't match",
mDevice.findObject(UiSelector().text(fileName))
.waitForExists(waitingTime)
)
var currentTries = 0
while (currentTries++ < 3) {
try {
assertTrue(
"Download prompt button not visible",
mDevice.findObject(UiSelector().resourceId("$packageName:id/download_button"))
.waitForExists(waitingTime)
)
assertTrue(
"$fileName title doesn't match",
mDevice.findObject(UiSelector().text(fileName))
.waitForExists(waitingTime)
)
} catch (e: AssertionError) {
browserScreen {
}.clickDownloadLink(fileName) {
}

assertTrue(
"Download prompt button not visible",
mDevice.findObject(UiSelector().resourceId("$packageName:id/download_button"))
.waitForExists(waitingTime)
)
assertTrue(
"$fileName title doesn't match",
mDevice.findObject(UiSelector().text(fileName))
.waitForExists(waitingTime)
)
}
}
}

private fun assertDownloadNotificationPopup() {
Expand Down
4 changes: 3 additions & 1 deletion automation/taskcluster/androidTest/flank-x86.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ gcloud:
test-targets:
- notPackage org.mozilla.fenix.screenshots
- notPackage org.mozilla.fenix.syncintegration
- class org.mozilla.fenix.ui.DownloadTest#testDownloadPrompt
- class org.mozilla.fenix.ui.DownloadTest#testCloseDownloadPrompt

device:
- model: Pixel2
Expand All @@ -53,7 +55,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: 1
num-test-runs: 50
### 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 e4d13d3

Please sign in to comment.