|
|
|
@ -12,13 +12,14 @@ import androidx.test.espresso.action.ViewActions
|
|
|
|
|
import androidx.test.espresso.assertion.ViewAssertions.matches
|
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers
|
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.isChecked
|
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.isNotChecked
|
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withClassName
|
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
|
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withId
|
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withText
|
|
|
|
|
import androidx.test.uiautomator.By
|
|
|
|
|
import androidx.test.uiautomator.Until
|
|
|
|
|
import org.hamcrest.CoreMatchers
|
|
|
|
|
import org.hamcrest.CoreMatchers.allOf
|
|
|
|
|
import org.hamcrest.CoreMatchers.endsWith
|
|
|
|
|
import org.mozilla.fenix.R
|
|
|
|
@ -35,8 +36,13 @@ import org.mozilla.fenix.helpers.ext.waitNotNull
|
|
|
|
|
class SettingsSubMenuLoginsAndPasswordRobot {
|
|
|
|
|
|
|
|
|
|
fun verifyDefaultView() {
|
|
|
|
|
mDevice.waitNotNull(Until.findObjects(By.text("Sync logins across devices")), TestAssetHelper.waitingTime)
|
|
|
|
|
assertDefaultView()
|
|
|
|
|
mDevice.waitNotNull(Until.findObjects(By.text("Save logins and passwords")), TestAssetHelper.waitingTime)
|
|
|
|
|
saveLoginsAndPasswordButton.check(matches(isDisplayed()))
|
|
|
|
|
autofillInFirefoxOption.check(matches(isDisplayed()))
|
|
|
|
|
autofillInOtherAppsOption.check(matches(isDisplayed()))
|
|
|
|
|
syncLoginsButton.check(matches(isDisplayed()))
|
|
|
|
|
savedLoginsButton.check(matches(isDisplayed()))
|
|
|
|
|
loginExceptionsButton.check(matches(isDisplayed()))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun verifyDefaultViewBeforeSyncComplete() {
|
|
|
|
@ -47,14 +53,12 @@ class SettingsSubMenuLoginsAndPasswordRobot {
|
|
|
|
|
mDevice.waitNotNull(Until.findObjects(By.text("On")), TestAssetHelper.waitingTime)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun verifyDefaultValueExceptions() = assertDefaultValueExceptions()
|
|
|
|
|
|
|
|
|
|
fun verifyDefaultValueAutofillLogins(context: Context) = assertDefaultValueAutofillLogins(context)
|
|
|
|
|
|
|
|
|
|
fun clickAutofillOption() = autofillOption.click()
|
|
|
|
|
fun clickAutofillInFirefoxOption() = autofillInFirefoxOption.click()
|
|
|
|
|
|
|
|
|
|
fun verifyAutofillToggle(enabled: Boolean) =
|
|
|
|
|
autofillOption
|
|
|
|
|
fun verifyAutofillInFirefoxToggle(enabled: Boolean) {
|
|
|
|
|
autofillInFirefoxOption
|
|
|
|
|
.check(
|
|
|
|
|
matches(
|
|
|
|
|
hasCousin(
|
|
|
|
@ -69,6 +73,24 @@ class SettingsSubMenuLoginsAndPasswordRobot {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
fun verifyAutofillLoginsInOtherAppsToggle(enabled: Boolean) {
|
|
|
|
|
autofillInOtherAppsOption
|
|
|
|
|
.check(
|
|
|
|
|
matches(
|
|
|
|
|
hasCousin(
|
|
|
|
|
allOf(
|
|
|
|
|
withId(R.id.switch_widget),
|
|
|
|
|
if (enabled) {
|
|
|
|
|
isChecked()
|
|
|
|
|
} else {
|
|
|
|
|
isNotChecked()
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class Transition {
|
|
|
|
|
|
|
|
|
@ -80,32 +102,28 @@ class SettingsSubMenuLoginsAndPasswordRobot {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun openSavedLogins(interact: SettingsSubMenuLoginsAndPasswordsSavedLoginsRobot.() -> Unit): SettingsSubMenuLoginsAndPasswordsSavedLoginsRobot.Transition {
|
|
|
|
|
fun savedLoginsButton() = onView(withText("Saved logins"))
|
|
|
|
|
savedLoginsButton().click()
|
|
|
|
|
savedLoginsButton.click()
|
|
|
|
|
|
|
|
|
|
SettingsSubMenuLoginsAndPasswordsSavedLoginsRobot().interact()
|
|
|
|
|
return SettingsSubMenuLoginsAndPasswordsSavedLoginsRobot.Transition()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun openLoginExceptions(interact: SettingsSubMenuLoginsAndPasswordsSavedLoginsRobot.() -> Unit): SettingsSubMenuLoginsAndPasswordsSavedLoginsRobot.Transition {
|
|
|
|
|
fun loginExceptionsButton() = onView(ViewMatchers.withText("Exceptions"))
|
|
|
|
|
loginExceptionsButton().click()
|
|
|
|
|
loginExceptionsButton.click()
|
|
|
|
|
|
|
|
|
|
SettingsSubMenuLoginsAndPasswordsSavedLoginsRobot().interact()
|
|
|
|
|
return SettingsSubMenuLoginsAndPasswordsSavedLoginsRobot.Transition()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun openSyncLogins(interact: SettingsTurnOnSyncRobot.() -> Unit): SettingsTurnOnSyncRobot.Transition {
|
|
|
|
|
fun syncLoginsButton() = onView(ViewMatchers.withText("Sync logins across devices"))
|
|
|
|
|
syncLoginsButton().click()
|
|
|
|
|
syncLoginsButton.click()
|
|
|
|
|
|
|
|
|
|
SettingsTurnOnSyncRobot().interact()
|
|
|
|
|
return SettingsTurnOnSyncRobot.Transition()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun openSaveLoginsAndPasswordsOptions(interact: SettingsSubMenuLoginsAndPasswordOptionsToSaveRobot.() -> Unit): SettingsSubMenuLoginsAndPasswordOptionsToSaveRobot.Transition {
|
|
|
|
|
fun saveLoginsAndPasswordButton() = onView(withText("Save logins and passwords"))
|
|
|
|
|
saveLoginsAndPasswordButton().click()
|
|
|
|
|
saveLoginsAndPasswordButton.click()
|
|
|
|
|
|
|
|
|
|
SettingsSubMenuLoginsAndPasswordOptionsToSaveRobot().interact()
|
|
|
|
|
return SettingsSubMenuLoginsAndPasswordOptionsToSaveRobot.Transition()
|
|
|
|
@ -118,11 +136,16 @@ fun settingsSubMenuLoginsAndPassword(interact: SettingsSubMenuLoginsAndPasswordR
|
|
|
|
|
return SettingsSubMenuLoginsAndPasswordRobot.Transition()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun goBackButton() =
|
|
|
|
|
onView(CoreMatchers.allOf(ViewMatchers.withContentDescription("Navigate up")))
|
|
|
|
|
private val saveLoginsAndPasswordButton = onView(withText("Save logins and passwords"))
|
|
|
|
|
|
|
|
|
|
private fun assertDefaultView() = onView(ViewMatchers.withText("Sync logins across devices"))
|
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
|
private val savedLoginsButton = onView(withText("Saved logins"))
|
|
|
|
|
|
|
|
|
|
private val syncLoginsButton = onView(withText("Sync logins across devices"))
|
|
|
|
|
|
|
|
|
|
private val loginExceptionsButton = onView(withText("Exceptions"))
|
|
|
|
|
|
|
|
|
|
private fun goBackButton() =
|
|
|
|
|
onView(allOf(ViewMatchers.withContentDescription("Navigate up")))
|
|
|
|
|
|
|
|
|
|
private fun assertDefaultValueAutofillLogins(context: Context) = onView(
|
|
|
|
|
ViewMatchers.withText(
|
|
|
|
@ -134,10 +157,6 @@ private fun assertDefaultValueAutofillLogins(context: Context) = onView(
|
|
|
|
|
)
|
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
|
|
private fun assertDefaultValueExceptions() = onView(ViewMatchers.withText("Exceptions"))
|
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
|
|
private fun assertDefaultValueSyncLogins() = onView(ViewMatchers.withText("Sync and save data"))
|
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
|
private val autofillInFirefoxOption = onView(withText("Autofill in $appName"))
|
|
|
|
|
|
|
|
|
|
private val autofillOption = onView(withText("Autofill in $appName"))
|
|
|
|
|
private val autofillInOtherAppsOption = onView(withText("Autofill in other apps"))
|
|
|
|
|