diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/DownloadTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/DownloadTest.kt index 28ed2630d2..04dab742f4 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/DownloadTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/DownloadTest.kt @@ -94,7 +94,6 @@ class DownloadTest { } } - @Ignore("Failing, see: https://github.com/mozilla-mobile/fenix/issues/25002") @Test fun testDownloadCompleteNotification() { downloadFile = "smallZip.zip" diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/DownloadRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/DownloadRobot.kt index 5687dcb7cc..e7962b8f24 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/DownloadRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/DownloadRobot.kt @@ -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() {