For #25002 #25184 and #23417 fix testDownloadCompleteNotification testDownloadPrompt and testCloseDownloadPrompt

pull/543/head
AndiAJ 2 years ago committed by mergify[bot]
parent 0569816cbb
commit bbdc7fd3ff

@ -94,7 +94,6 @@ class DownloadTest {
}
}
@Ignore("Failing, see: https://github.com/mozilla-mobile/fenix/issues/25002")
@Test
fun testDownloadCompleteNotification() {
downloadFile = "smallZip.zip"

@ -7,6 +7,7 @@
package org.mozilla.fenix.ui.robots
import android.content.Intent
import android.util.Log
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.intent.Intents
@ -133,16 +134,29 @@ 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)
)
break
} catch (e: AssertionError) {
Log.e("DOWNLOAD_ROBOT", "Failed to find locator: ${e.localizedMessage}")
browserScreen {
}.clickDownloadLink(fileName) {
}
}
}
}
private fun assertDownloadNotificationPopup() {

Loading…
Cancel
Save