Bug 1880047 - Convert private variables to functions so they don't get initialised

fenix/124.1.0
AndiAJ 4 months ago committed by mergify[bot]
parent 7455523c8f
commit d14cbc72f6

@ -39,17 +39,17 @@ class NotificationRobot {
} }
fun clearNotifications() { fun clearNotifications() {
if (clearButton.exists()) { if (clearButton().exists()) {
Log.i(TAG, "clearNotifications:The clear notifications button exists") Log.i(TAG, "clearNotifications:The clear notifications button exists")
Log.i(TAG, "clearNotifications: Trying to click the clear notifications button") Log.i(TAG, "clearNotifications: Trying to click the clear notifications button")
clearButton.click() clearButton().click()
Log.i(TAG, "clearNotifications: Clicked the clear notifications button") Log.i(TAG, "clearNotifications: Clicked the clear notifications button")
} else { } else {
scrollToEnd() scrollToEnd()
if (clearButton.exists()) { if (clearButton().exists()) {
Log.i(TAG, "clearNotifications:The clear notifications button exists") Log.i(TAG, "clearNotifications:The clear notifications button exists")
Log.i(TAG, "clearNotifications: Trying to click the clear notifications button") Log.i(TAG, "clearNotifications: Trying to click the clear notifications button")
clearButton.click() clearButton().click()
Log.i(TAG, "clearNotifications: Clicked the clear notifications button") Log.i(TAG, "clearNotifications: Clicked the clear notifications button")
} else if (notificationTray().exists()) { } else if (notificationTray().exists()) {
Log.i(TAG, "clearNotifications: The notifications tray is still displayed") Log.i(TAG, "clearNotifications: The notifications tray is still displayed")
@ -117,16 +117,16 @@ class NotificationRobot {
assertUIObjectExists(mediaSystemNotificationButton(action)) assertUIObjectExists(mediaSystemNotificationButton(action))
fun expandNotificationMessage() { fun expandNotificationMessage() {
while (!notificationHeader.exists()) { while (!notificationHeader().exists()) {
Log.i(TAG, "expandNotificationMessage: Waiting for $appName notification to exist") Log.i(TAG, "expandNotificationMessage: Waiting for $appName notification to exist")
scrollToEnd() scrollToEnd()
} }
if (notificationHeader.exists()) { if (notificationHeader().exists()) {
Log.i(TAG, "expandNotificationMessage: $appName notification exists") Log.i(TAG, "expandNotificationMessage: $appName notification exists")
// expand the notification // expand the notification
Log.i(TAG, "expandNotificationMessage: Trying to click $appName notification") Log.i(TAG, "expandNotificationMessage: Trying to click $appName notification")
notificationHeader.click() notificationHeader().click()
Log.i(TAG, "expandNotificationMessage: Clicked $appName notification") Log.i(TAG, "expandNotificationMessage: Clicked $appName notification")
// double check if notification actions are viewable by checking for action existence; otherwise scroll again // double check if notification actions are viewable by checking for action existence; otherwise scroll again
@ -274,7 +274,7 @@ private fun notificationTray() = UiScrollable(
UiSelector().resourceId("com.android.systemui:id/notification_stack_scroller"), UiSelector().resourceId("com.android.systemui:id/notification_stack_scroller"),
).setAsVerticalList() ).setAsVerticalList()
private val notificationHeader = private fun notificationHeader() =
mDevice.findObject( mDevice.findObject(
UiSelector() UiSelector()
.resourceId("android:id/app_name_text") .resourceId("android:id/app_name_text")
@ -287,7 +287,7 @@ private fun scrollToEnd() {
Log.i(TAG, "scrollToEnd: Performed scroll to the end of the notification tray action") Log.i(TAG, "scrollToEnd: Performed scroll to the end of the notification tray action")
} }
private val clearButton = mDevice.findObject(UiSelector().resourceId("com.android.systemui:id/dismiss_text")) private fun clearButton() = mDevice.findObject(UiSelector().resourceId("com.android.systemui:id/dismiss_text"))
private fun cancelAll() { private fun cancelAll() {
val notificationManager: NotificationManager = val notificationManager: NotificationManager =

Loading…
Cancel
Save