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

fenix/125.0
AndiAJ 4 months ago committed by mergify[bot]
parent 9bf557cf36
commit e648854b3e

@ -28,23 +28,23 @@ class SystemSettingsRobot {
fun verifyAllSystemNotificationsToggleState(enabled: Boolean) { fun verifyAllSystemNotificationsToggleState(enabled: Boolean) {
if (enabled) { if (enabled) {
assertTrue(allSystemSettingsNotificationsToggle.isChecked) assertTrue(allSystemSettingsNotificationsToggle().isChecked)
} else { } else {
assertFalse(allSystemSettingsNotificationsToggle.isChecked) assertFalse(allSystemSettingsNotificationsToggle().isChecked)
} }
} }
fun verifyPrivateBrowsingSystemNotificationsToggleState(enabled: Boolean) { fun verifyPrivateBrowsingSystemNotificationsToggleState(enabled: Boolean) {
if (enabled) { if (enabled) {
assertTrue(privateBrowsingSystemSettingsNotificationsToggle.isChecked) assertTrue(privateBrowsingSystemSettingsNotificationsToggle().isChecked)
} else { } 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 { class Transition {
// Difficult to know where this will go // Difficult to know where this will go
@ -68,7 +68,7 @@ private fun assertSystemNotificationsView() {
assertUIObjectExists(itemContainingText("All ${TestHelper.appName} notifications")) assertUIObjectExists(itemContainingText("All ${TestHelper.appName} notifications"))
} }
private val allSystemSettingsNotificationsToggle = private fun allSystemSettingsNotificationsToggle() =
mDevice.findObject( mDevice.findObject(
UiSelector().resourceId("com.android.settings:id/switch_bar") UiSelector().resourceId("com.android.settings:id/switch_bar")
.childSelector( .childSelector(
@ -77,5 +77,5 @@ private val allSystemSettingsNotificationsToggle =
.index(1), .index(1),
), ),
) )
private val privateBrowsingSystemSettingsNotificationsToggle = private fun privateBrowsingSystemSettingsNotificationsToggle() =
itemWithResIdAndDescription("com.android.settings:id/switchWidget", "Private browsing session") itemWithResIdAndDescription("com.android.settings:id/switchWidget", "Private browsing session")

Loading…
Cancel
Save