From 431ce4e2657de13442815b0a842e0a7b0080529a Mon Sep 17 00:00:00 2001 From: AndiAJ Date: Tue, 27 Feb 2024 15:09:47 +0200 Subject: [PATCH] Bug 1882473 - Convert private variables to functions so they don't get initialised --- .../SettingsSubMenuSitePermissionsCommonRobot.kt | 40 +++++++++++----------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuSitePermissionsCommonRobot.kt b/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuSitePermissionsCommonRobot.kt index 922cc0beec91..4348eab06783 100644 --- a/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuSitePermissionsCommonRobot.kt +++ b/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuSitePermissionsCommonRobot.kt @@ -98,7 +98,7 @@ class SettingsSubMenuSitePermissionsCommonRobot { verifyAskToAllowButton() verifyBlockedButton() // Third option is "Allowed" - thirdRadioButton.check(matches(withText("Allowed"))) + thirdRadioButton().check(matches(withText("Allowed"))) } fun clickGoToSettingsButton() { @@ -158,25 +158,25 @@ class SettingsSubMenuSitePermissionsCommonRobot { fun selectAutoplayOption(text: String) { when (text) { - "Allow audio and video" -> askToAllowRadioButton.click() - "Block audio and video on cellular data only" -> blockRadioButton.click() - "Block audio only" -> thirdRadioButton.click() - "Block audio and video" -> fourthRadioButton.click() + "Allow audio and video" -> askToAllowRadioButton().click() + "Block audio and video on cellular data only" -> blockRadioButton().click() + "Block audio only" -> thirdRadioButton().click() + "Block audio and video" -> fourthRadioButton().click() } } fun selectPermissionSettingOption(text: String) { when (text) { - "Ask to allow" -> askToAllowRadioButton.click() - "Blocked" -> blockRadioButton.click() + "Ask to allow" -> askToAllowRadioButton().click() + "Blocked" -> blockRadioButton().click() } } fun selectDRMControlledContentPermissionSettingOption(text: String) { when (text) { - "Ask to allow" -> askToAllowRadioButton.click() - "Blocked" -> blockRadioButton.click() - "Allowed" -> thirdRadioButton.click() + "Ask to allow" -> askToAllowRadioButton().click() + "Blocked" -> blockRadioButton().click() + "Allowed" -> thirdRadioButton().click() } } @@ -191,43 +191,43 @@ class SettingsSubMenuSitePermissionsCommonRobot { } // common Blocked radio button for all settings -private val blockRadioButton = onView(withId(R.id.block_radio)) +private fun blockRadioButton() = onView(withId(R.id.block_radio)) // common Ask to Allow radio button for all settings -private val askToAllowRadioButton = onView(withId(R.id.ask_to_allow_radio)) +private fun askToAllowRadioButton() = onView(withId(R.id.ask_to_allow_radio)) // common extra 3rd radio button for all settings -private val thirdRadioButton = onView(withId(R.id.third_radio)) +private fun thirdRadioButton() = onView(withId(R.id.third_radio)) // common extra 4th radio button for all settings -private val fourthRadioButton = onView(withId(R.id.fourth_radio)) +private fun fourthRadioButton() = onView(withId(R.id.fourth_radio)) private fun assertNavigationToolBarHeader(header: String) = onView(allOf(withContentDescription(header))) private fun assertBlockAudioAndVideoOnMobileDataOnlyAudioAndVideoWillPlayOnWiFi() = - blockRadioButton.check((matches(withEffectiveVisibility(Visibility.VISIBLE)))) + blockRadioButton().check((matches(withEffectiveVisibility(Visibility.VISIBLE)))) private fun assertBlockAudioOnly() = - thirdRadioButton.check((matches(withEffectiveVisibility(Visibility.VISIBLE)))) + thirdRadioButton().check((matches(withEffectiveVisibility(Visibility.VISIBLE)))) private fun assertVideoAndAudioBlockedRecommended() = onView(withId(R.id.fourth_radio)) .check((matches(withEffectiveVisibility(Visibility.VISIBLE)))) private fun assertCheckAutoPayRadioButtonDefault() { // Allow audio and video - askToAllowRadioButton + askToAllowRadioButton() .assertIsChecked(isChecked = false) // Block audio and video on cellular data only - blockRadioButton + blockRadioButton() .assertIsChecked(isChecked = false) // Block audio only (default) - thirdRadioButton + thirdRadioButton() .assertIsChecked(isChecked = true) // Block audio and video - fourthRadioButton + fourthRadioButton() .assertIsChecked(isChecked = false) } -- 2.11.4.GIT