Bug 1807274 - Fix verifyDownloadCompleteNotificationTest UI test

fenix/120.0
AndiAJ 8 months ago committed by mergify[bot]
parent a3d055e94f
commit 3c0c3e3538

@ -138,6 +138,7 @@ class DownloadTest {
assertExternalAppOpens(GOOGLE_APPS_PHOTOS)
mDevice.pressBack()
mDevice.openNotification()
verifySystemNotificationExists("Download completed")
swipeDownloadNotification(
direction = "Left",
shouldDismissNotification = true,

@ -117,23 +117,26 @@ class NotificationRobot {
shouldDismissNotification: Boolean,
canExpandNotification: Boolean = true,
) {
// In case it fails, retry max 6x the swipe action on download system notifications
for (i in 1..6) {
// In case it fails, retry max 3x the swipe action on download system notifications
for (i in 1..RETRY_COUNT) {
try {
// Swipe left the download system notification
if (direction == "Left") {
itemContainingText(appName)
.also {
it.waitForExists(waitingTime)
it.swipeLeft(3)
}
} else {
// Swipe right the download system notification
itemContainingText(appName)
.also {
it.waitForExists(waitingTime)
it.swipeRight(3)
}
var retries = 0
while (itemContainingText(appName).exists() && retries++ < 3) {
// Swipe left the download system notification
if (direction == "Left") {
itemContainingText(appName)
.also {
it.waitForExists(waitingTime)
it.swipeLeft(3)
}
} else {
// Swipe right the download system notification
itemContainingText(appName)
.also {
it.waitForExists(waitingTime)
it.swipeRight(3)
}
}
}
// Not all download related system notifications can be dismissed
if (shouldDismissNotification) {
@ -144,7 +147,7 @@ class NotificationRobot {
break
} catch (e: AssertionError) {
if (i == 6) {
if (i == RETRY_COUNT) {
throw e
} else {
notificationShade {
@ -167,7 +170,7 @@ class NotificationRobot {
fun clickNotification(notificationMessage: String) {
mDevice.findObject(UiSelector().text(notificationMessage)).waitForExists(waitingTime)
mDevice.findObject(UiSelector().text(notificationMessage)).click()
mDevice.findObject(UiSelector().text(notificationMessage)).clickAndWaitForNewWindow(waitingTimeShort)
}
class Transition {

Loading…
Cancel
Save