|
|
|
@ -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() {
|
|
|
|
|