mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-03 23:15:31 +00:00
Bug 1822823 - Refactor settingsGeneralItemsTests UI test
This commit is contained in:
parent
42b7fdf925
commit
bacea723cb
@ -62,14 +62,18 @@ class SettingsGeneralTest {
|
||||
verifySettingsToolbar()
|
||||
verifyGeneralHeading()
|
||||
verifySearchButton()
|
||||
verifySettingsOptionSummary("Google")
|
||||
verifyTabsButton()
|
||||
verifySettingsOptionSummary("Close manually")
|
||||
verifyHomepageButton()
|
||||
verifySettingsOptionSummary("Open on homepage after four hours")
|
||||
verifyCustomizeButton()
|
||||
verifyLoginsAndPasswordsButton()
|
||||
verifyAutofillButton()
|
||||
verifyAccessibilityButton()
|
||||
verifyLanguageButton()
|
||||
verifySetAsDefaultBrowserButton()
|
||||
verifyDefaultBrowserToggle(false)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -666,7 +666,7 @@ class SmokeTest {
|
||||
homeScreen {
|
||||
}.openThreeDotMenu {
|
||||
}.openSettings {
|
||||
verifyDefaultBrowserIsDisabled()
|
||||
verifyDefaultBrowserToggle(false)
|
||||
clickDefaultBrowserSwitch()
|
||||
verifyAndroidDefaultAppsMenuAppears()
|
||||
}
|
||||
|
@ -22,8 +22,10 @@ import androidx.test.espresso.matcher.ViewMatchers
|
||||
import androidx.test.espresso.matcher.ViewMatchers.Visibility
|
||||
import androidx.test.espresso.matcher.ViewMatchers.hasDescendant
|
||||
import androidx.test.espresso.matcher.ViewMatchers.hasSibling
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isChecked
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isNotChecked
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withText
|
||||
@ -48,6 +50,7 @@ import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime
|
||||
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTimeShort
|
||||
import org.mozilla.fenix.helpers.TestHelper.appName
|
||||
import org.mozilla.fenix.helpers.TestHelper.getStringResource
|
||||
import org.mozilla.fenix.helpers.TestHelper.hasCousin
|
||||
import org.mozilla.fenix.helpers.TestHelper.isPackageInstalled
|
||||
import org.mozilla.fenix.helpers.TestHelper.mDevice
|
||||
import org.mozilla.fenix.helpers.TestHelper.packageName
|
||||
@ -79,7 +82,25 @@ class SettingsRobot {
|
||||
assertItemContainingTextExists(itemContainingText(summary))
|
||||
fun verifyAutofillButton() = assertAutofillButton()
|
||||
fun verifyLanguageButton() = assertLanguageButton()
|
||||
fun verifyDefaultBrowserIsDisabled() = assertDefaultBrowserIsDisabled()
|
||||
fun verifyDefaultBrowserToggle(isEnabled: Boolean) {
|
||||
scrollToElementByText(getStringResource(R.string.preferences_set_as_default_browser))
|
||||
onView(withText(R.string.preferences_set_as_default_browser))
|
||||
.check(
|
||||
matches(
|
||||
hasCousin(
|
||||
allOf(
|
||||
withId(R.id.switch_widget),
|
||||
if (isEnabled) {
|
||||
isChecked()
|
||||
} else {
|
||||
isNotChecked()
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
fun clickDefaultBrowserSwitch() = toggleDefaultBrowserSwitch()
|
||||
fun verifyAndroidDefaultAppsMenuAppears() = assertAndroidDefaultAppsMenuAppears()
|
||||
|
||||
@ -138,6 +159,8 @@ class SettingsRobot {
|
||||
fun verifyAboutFirefoxPreview() = assertTrue(aboutFirefoxHeading().waitForExists(waitingTime))
|
||||
fun verifyGooglePlayRedirect() = assertGooglePlayRedirect()
|
||||
|
||||
fun verifySettingsOptionSummary(summary: String) = itemContainingText(summary)
|
||||
|
||||
class Transition {
|
||||
fun goBack(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition {
|
||||
goBackButton().click()
|
||||
@ -429,12 +452,6 @@ private fun assertSetAsDefaultBrowserButton() {
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
||||
private fun assertDefaultBrowserIsDisabled() {
|
||||
scrollToElementByText("Set as default browser")
|
||||
onView(withId(R.id.switch_widget))
|
||||
.check(matches(ViewMatchers.isNotChecked()))
|
||||
}
|
||||
|
||||
private fun toggleDefaultBrowserSwitch() {
|
||||
scrollToElementByText("Privacy and security")
|
||||
onView(withText("Set as default browser")).perform(ViewActions.click())
|
||||
|
Loading…
Reference in New Issue
Block a user