From 511886fd1e81d6e549782dc4e298734f6b54cde0 Mon Sep 17 00:00:00 2001 From: Aaron Train Date: Mon, 5 Dec 2022 12:04:19 -0500 Subject: [PATCH] For #2130 - Fix fileDownloadTest --- .../reference/browser/ui/robots/NotificationRobot.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/androidTest/java/org/mozilla/reference/browser/ui/robots/NotificationRobot.kt b/app/src/androidTest/java/org/mozilla/reference/browser/ui/robots/NotificationRobot.kt index 8e0c48f6c..bd46ecee5 100644 --- a/app/src/androidTest/java/org/mozilla/reference/browser/ui/robots/NotificationRobot.kt +++ b/app/src/androidTest/java/org/mozilla/reference/browser/ui/robots/NotificationRobot.kt @@ -29,7 +29,7 @@ class NotificationRobot { val downloadFilename = mDevice.findObject(UiSelector().text(fileName)) while (!notificationFound) { - notificationTray.swipeUp(2) + scrollToEnd() notificationFound = mDevice.findObject(notification).waitForExists(waitingTime) } assertTrue(notificationFound) @@ -95,3 +95,11 @@ private val systemMediaNotification = .className("android.view.ViewGroup") .packageName("com.android.systemui") ) + +private fun notificationTray() = UiScrollable( + UiSelector().resourceId("com.android.systemui:id/notification_stack_scroller") +).setAsVerticalList() + +private fun scrollToEnd() { + notificationTray().scrollToEnd(1) +}