[fenix] For https://github.com/mozilla-mobile/fenix/issues/25852: Fixes visibility issue of private tabs notification in UI tests

pull/600/head
sv-ohorvath 2 years ago committed by mergify[bot]
parent 3bea2862be
commit bbb46c8142

@ -65,8 +65,8 @@ class NotificationRobot {
} }
fun verifyPrivateTabsNotification() { fun verifyPrivateTabsNotification() {
mDevice.waitNotNull(Until.hasObject(text("Close private tabs")), waitingTime) verifySystemNotificationExists("$appName (Private)")
assertPrivateTabsNotification() verifySystemNotificationExists("Close private tabs")
} }
fun clickMediaNotificationControlButton(action: String) { fun clickMediaNotificationControlButton(action: String) {
@ -115,7 +115,14 @@ class NotificationRobot {
class Transition { class Transition {
fun clickClosePrivateTabsNotification(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.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() closePrivateTabsNotification().click()
HomeScreenRobot().interact() HomeScreenRobot().interact()
@ -129,11 +136,6 @@ fun notificationShade(interact: NotificationRobot.() -> Unit): NotificationRobot
return NotificationRobot.Transition() 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() = private fun closePrivateTabsNotification() =
mDevice.findObject(UiSelector().text("Close private tabs")) mDevice.findObject(UiSelector().text("Close private tabs"))

Loading…
Cancel
Save