From e648854b3eff11a3bfb60827ba1948b0c3ac7c2d Mon Sep 17 00:00:00 2001 From: AndiAJ Date: Fri, 1 Mar 2024 13:51:04 +0200 Subject: [PATCH] Bug 1883014 - Convert private variables to functions so they don't get initialised --- .../fenix/ui/robots/SystemSettingsRobot.kt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SystemSettingsRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SystemSettingsRobot.kt index 17fdc483d1..38ff0358b5 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SystemSettingsRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SystemSettingsRobot.kt @@ -28,23 +28,23 @@ class SystemSettingsRobot { fun verifyAllSystemNotificationsToggleState(enabled: Boolean) { if (enabled) { - assertTrue(allSystemSettingsNotificationsToggle.isChecked) + assertTrue(allSystemSettingsNotificationsToggle().isChecked) } else { - assertFalse(allSystemSettingsNotificationsToggle.isChecked) + assertFalse(allSystemSettingsNotificationsToggle().isChecked) } } fun verifyPrivateBrowsingSystemNotificationsToggleState(enabled: Boolean) { if (enabled) { - assertTrue(privateBrowsingSystemSettingsNotificationsToggle.isChecked) + assertTrue(privateBrowsingSystemSettingsNotificationsToggle().isChecked) } else { - assertFalse(privateBrowsingSystemSettingsNotificationsToggle.isChecked) + assertFalse(privateBrowsingSystemSettingsNotificationsToggle().isChecked) } } - fun clickPrivateBrowsingSystemNotificationsToggle() = privateBrowsingSystemSettingsNotificationsToggle.click() + fun clickPrivateBrowsingSystemNotificationsToggle() = privateBrowsingSystemSettingsNotificationsToggle().click() - fun clickAllSystemNotificationsToggle() = allSystemSettingsNotificationsToggle.click() + fun clickAllSystemNotificationsToggle() = allSystemSettingsNotificationsToggle().click() class Transition { // Difficult to know where this will go @@ -68,7 +68,7 @@ private fun assertSystemNotificationsView() { assertUIObjectExists(itemContainingText("All ${TestHelper.appName} notifications")) } -private val allSystemSettingsNotificationsToggle = +private fun allSystemSettingsNotificationsToggle() = mDevice.findObject( UiSelector().resourceId("com.android.settings:id/switch_bar") .childSelector( @@ -77,5 +77,5 @@ private val allSystemSettingsNotificationsToggle = .index(1), ), ) -private val privateBrowsingSystemSettingsNotificationsToggle = +private fun privateBrowsingSystemSettingsNotificationsToggle() = itemWithResIdAndDescription("com.android.settings:id/switchWidget", "Private browsing session")