For #25852: Fixes visibility issue of private tabs notification in UI tests

pull/543/head
sv-ohorvath 2 years ago committed by mergify[bot]
parent f3def2e58b
commit 50536dc9d6

@ -65,8 +65,8 @@ class NotificationRobot {
}
fun verifyPrivateTabsNotification() {
mDevice.waitNotNull(Until.hasObject(text("Close private tabs")), waitingTime)
assertPrivateTabsNotification()
verifySystemNotificationExists("$appName (Private)")
verifySystemNotificationExists("Close private tabs")
}
fun clickMediaNotificationControlButton(action: String) {
@ -115,7 +115,14 @@ class NotificationRobot {
class Transition {
fun clickClosePrivateTabsNotification(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition {
NotificationRobot().verifySystemNotificationExists("Close private tabs")
try {
assertTrue(
closePrivateTabsNotification().exists()
)
} catch (e: AssertionError) {
notificationTray().flingToEnd(1)
}
closePrivateTabsNotification().click()
HomeScreenRobot().interact()
@ -129,11 +136,6 @@ fun notificationShade(interact: NotificationRobot.() -> Unit): NotificationRobot
return NotificationRobot.Transition()
}
private fun assertPrivateTabsNotification() {
mDevice.findObject(UiSelector().text("Firefox Preview (Private)")).exists()
mDevice.findObject(UiSelector().text("Close private tabs")).exists()
}
private fun closePrivateTabsNotification() =
mDevice.findObject(UiSelector().text("Close private tabs"))

Loading…
Cancel
Save