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

fenix/125.0
AndiAJ 4 months ago committed by mergify[bot]
parent 17b9528e8b
commit 33fede0a4b

@ -98,7 +98,7 @@ class SettingsSubMenuSitePermissionsCommonRobot {
verifyAskToAllowButton() verifyAskToAllowButton()
verifyBlockedButton() verifyBlockedButton()
// Third option is "Allowed" // Third option is "Allowed"
thirdRadioButton.check(matches(withText("Allowed"))) thirdRadioButton().check(matches(withText("Allowed")))
} }
fun clickGoToSettingsButton() { fun clickGoToSettingsButton() {
@ -158,25 +158,25 @@ class SettingsSubMenuSitePermissionsCommonRobot {
fun selectAutoplayOption(text: String) { fun selectAutoplayOption(text: String) {
when (text) { when (text) {
"Allow audio and video" -> askToAllowRadioButton.click() "Allow audio and video" -> askToAllowRadioButton().click()
"Block audio and video on cellular data only" -> blockRadioButton.click() "Block audio and video on cellular data only" -> blockRadioButton().click()
"Block audio only" -> thirdRadioButton.click() "Block audio only" -> thirdRadioButton().click()
"Block audio and video" -> fourthRadioButton.click() "Block audio and video" -> fourthRadioButton().click()
} }
} }
fun selectPermissionSettingOption(text: String) { fun selectPermissionSettingOption(text: String) {
when (text) { when (text) {
"Ask to allow" -> askToAllowRadioButton.click() "Ask to allow" -> askToAllowRadioButton().click()
"Blocked" -> blockRadioButton.click() "Blocked" -> blockRadioButton().click()
} }
} }
fun selectDRMControlledContentPermissionSettingOption(text: String) { fun selectDRMControlledContentPermissionSettingOption(text: String) {
when (text) { when (text) {
"Ask to allow" -> askToAllowRadioButton.click() "Ask to allow" -> askToAllowRadioButton().click()
"Blocked" -> blockRadioButton.click() "Blocked" -> blockRadioButton().click()
"Allowed" -> thirdRadioButton.click() "Allowed" -> thirdRadioButton().click()
} }
} }
@ -191,43 +191,43 @@ class SettingsSubMenuSitePermissionsCommonRobot {
} }
// common Blocked radio button for all settings // 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 // 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 // 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 // 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 assertNavigationToolBarHeader(header: String) = onView(allOf(withContentDescription(header)))
private fun assertBlockAudioAndVideoOnMobileDataOnlyAudioAndVideoWillPlayOnWiFi() = private fun assertBlockAudioAndVideoOnMobileDataOnlyAudioAndVideoWillPlayOnWiFi() =
blockRadioButton.check((matches(withEffectiveVisibility(Visibility.VISIBLE)))) blockRadioButton().check((matches(withEffectiveVisibility(Visibility.VISIBLE))))
private fun assertBlockAudioOnly() = private fun assertBlockAudioOnly() =
thirdRadioButton.check((matches(withEffectiveVisibility(Visibility.VISIBLE)))) thirdRadioButton().check((matches(withEffectiveVisibility(Visibility.VISIBLE))))
private fun assertVideoAndAudioBlockedRecommended() = onView(withId(R.id.fourth_radio)) private fun assertVideoAndAudioBlockedRecommended() = onView(withId(R.id.fourth_radio))
.check((matches(withEffectiveVisibility(Visibility.VISIBLE)))) .check((matches(withEffectiveVisibility(Visibility.VISIBLE))))
private fun assertCheckAutoPayRadioButtonDefault() { private fun assertCheckAutoPayRadioButtonDefault() {
// Allow audio and video // Allow audio and video
askToAllowRadioButton askToAllowRadioButton()
.assertIsChecked(isChecked = false) .assertIsChecked(isChecked = false)
// Block audio and video on cellular data only // Block audio and video on cellular data only
blockRadioButton blockRadioButton()
.assertIsChecked(isChecked = false) .assertIsChecked(isChecked = false)
// Block audio only (default) // Block audio only (default)
thirdRadioButton thirdRadioButton()
.assertIsChecked(isChecked = true) .assertIsChecked(isChecked = true)
// Block audio and video // Block audio and video
fourthRadioButton fourthRadioButton()
.assertIsChecked(isChecked = false) .assertIsChecked(isChecked = false)
} }

Loading…
Cancel
Save