mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-15 18:12:54 +00:00
Bug 1822050 - Verify cookie banner reduction summary updates in UI tests
This commit is contained in:
parent
479fbd0206
commit
e94bc0b1e6
@ -5,7 +5,6 @@ import org.junit.Rule
|
|||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.mozilla.fenix.customannotations.SmokeTest
|
import org.mozilla.fenix.customannotations.SmokeTest
|
||||||
import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
|
import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
|
||||||
import org.mozilla.fenix.helpers.TestHelper
|
|
||||||
import org.mozilla.fenix.helpers.TestHelper.exitMenu
|
import org.mozilla.fenix.helpers.TestHelper.exitMenu
|
||||||
import org.mozilla.fenix.helpers.TestHelper.restartApp
|
import org.mozilla.fenix.helpers.TestHelper.restartApp
|
||||||
import org.mozilla.fenix.ui.robots.browserScreen
|
import org.mozilla.fenix.ui.robots.browserScreen
|
||||||
@ -28,10 +27,13 @@ class CookieBannerReductionTest {
|
|||||||
verifyCookieBannerExists(exists = true)
|
verifyCookieBannerExists(exists = true)
|
||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
}.openSettings {
|
}.openSettings {
|
||||||
|
verifyCookieBannerReductionSummary("Off")
|
||||||
}.openCookieBannerReductionSubMenu {
|
}.openCookieBannerReductionSubMenu {
|
||||||
verifyCookieBannerView(isCookieBannerReductionChecked = false)
|
verifyCookieBannerView(isCookieBannerReductionChecked = false)
|
||||||
clickCookieBannerReductionToggle()
|
clickCookieBannerReductionToggle()
|
||||||
verifyCheckedCookieBannerReductionToggle(isCookieBannerReductionChecked = true)
|
verifyCheckedCookieBannerReductionToggle(isCookieBannerReductionChecked = true)
|
||||||
|
}.goBack {
|
||||||
|
verifyCookieBannerReductionSummary("On")
|
||||||
}
|
}
|
||||||
|
|
||||||
exitMenu()
|
exitMenu()
|
||||||
@ -40,7 +42,7 @@ class CookieBannerReductionTest {
|
|||||||
verifyCookieBannerExists(exists = false)
|
verifyCookieBannerExists(exists = false)
|
||||||
}
|
}
|
||||||
|
|
||||||
TestHelper.restartApp(activityTestRule)
|
restartApp(activityTestRule)
|
||||||
|
|
||||||
browserScreen {
|
browserScreen {
|
||||||
verifyCookieBannerExists(exists = false)
|
verifyCookieBannerExists(exists = false)
|
||||||
@ -74,12 +76,17 @@ class CookieBannerReductionTest {
|
|||||||
verifyCookieBannerExists(exists = true)
|
verifyCookieBannerExists(exists = true)
|
||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
}.openSettings {
|
}.openSettings {
|
||||||
|
verifyCookieBannerReductionSummary("Off")
|
||||||
}.openCookieBannerReductionSubMenu {
|
}.openCookieBannerReductionSubMenu {
|
||||||
verifyCookieBannerView(isCookieBannerReductionChecked = false)
|
verifyCookieBannerView(isCookieBannerReductionChecked = false)
|
||||||
clickCookieBannerReductionToggle()
|
clickCookieBannerReductionToggle()
|
||||||
verifyCheckedCookieBannerReductionToggle(isCookieBannerReductionChecked = true)
|
verifyCheckedCookieBannerReductionToggle(isCookieBannerReductionChecked = true)
|
||||||
exitMenu()
|
}.goBack {
|
||||||
|
verifyCookieBannerReductionSummary("On")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exitMenu()
|
||||||
|
|
||||||
browserScreen {
|
browserScreen {
|
||||||
verifyCookieBannerExists(exists = false)
|
verifyCookieBannerExists(exists = false)
|
||||||
}
|
}
|
||||||
|
@ -94,6 +94,18 @@ class SettingsRobot {
|
|||||||
hasSibling(withText(HTTPSOnlyModeSummary)),
|
hasSibling(withText(HTTPSOnlyModeSummary)),
|
||||||
),
|
),
|
||||||
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||||
|
|
||||||
|
fun verifyCookieBannerReductionSummary(cookieBannerReductionSummary: String) {
|
||||||
|
scrollToElementByText(getStringResource(R.string.preferences_cookie_banner_reduction))
|
||||||
|
|
||||||
|
onView(
|
||||||
|
allOf(
|
||||||
|
withText(R.string.preferences_cookie_banner_reduction),
|
||||||
|
hasSibling(withText(cookieBannerReductionSummary)),
|
||||||
|
),
|
||||||
|
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||||
|
}
|
||||||
|
|
||||||
fun verifyEnhancedTrackingProtectionButton() = assertEnhancedTrackingProtectionButton()
|
fun verifyEnhancedTrackingProtectionButton() = assertEnhancedTrackingProtectionButton()
|
||||||
fun verifyLoginsAndPasswordsButton() = assertLoginsAndPasswordsButton()
|
fun verifyLoginsAndPasswordsButton() = assertLoginsAndPasswordsButton()
|
||||||
fun verifyEnhancedTrackingProtectionState(option: String) =
|
fun verifyEnhancedTrackingProtectionState(option: String) =
|
||||||
|
@ -11,7 +11,9 @@ import org.mozilla.fenix.helpers.MatcherHelper.checkedItemWithResId
|
|||||||
import org.mozilla.fenix.helpers.MatcherHelper.itemContainingText
|
import org.mozilla.fenix.helpers.MatcherHelper.itemContainingText
|
||||||
import org.mozilla.fenix.helpers.MatcherHelper.itemWithResId
|
import org.mozilla.fenix.helpers.MatcherHelper.itemWithResId
|
||||||
import org.mozilla.fenix.helpers.TestHelper.getStringResource
|
import org.mozilla.fenix.helpers.TestHelper.getStringResource
|
||||||
|
import org.mozilla.fenix.helpers.TestHelper.mDevice
|
||||||
import org.mozilla.fenix.helpers.TestHelper.packageName
|
import org.mozilla.fenix.helpers.TestHelper.packageName
|
||||||
|
import org.mozilla.fenix.helpers.click
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of Robot Pattern for the settings Cookie Banner Reduction sub menu.
|
* Implementation of Robot Pattern for the settings Cookie Banner Reduction sub menu.
|
||||||
@ -25,7 +27,14 @@ class SettingsSubMenuCookieBannerReductionRobot {
|
|||||||
fun verifyCheckedCookieBannerReductionToggle(isCookieBannerReductionChecked: Boolean) =
|
fun verifyCheckedCookieBannerReductionToggle(isCookieBannerReductionChecked: Boolean) =
|
||||||
assertCheckedItemWithResIdExists(checkedCookieBannerOptionToggle(isCookieBannerReductionChecked))
|
assertCheckedItemWithResIdExists(checkedCookieBannerOptionToggle(isCookieBannerReductionChecked))
|
||||||
|
|
||||||
class Transition
|
class Transition {
|
||||||
|
fun goBack(interact: SettingsRobot.() -> Unit): SettingsRobot.Transition {
|
||||||
|
mDevice.pressBack()
|
||||||
|
|
||||||
|
SettingsRobot().interact()
|
||||||
|
return SettingsRobot.Transition()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val cookieBannerOptionTitle =
|
private val cookieBannerOptionTitle =
|
||||||
|
Loading…
Reference in New Issue
Block a user