mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-15 18:12:54 +00:00
[fenix] Save logins in PWA UI test
This commit is contained in:
parent
eac37508de
commit
f67bed33a9
@ -217,7 +217,7 @@ class SettingsPrivacyTest {
|
||||
verifySecurityPromptForLogins()
|
||||
tapSetupLater()
|
||||
// Verify that the login appears correctly
|
||||
verifySavedLoginFromPrompt()
|
||||
verifySavedLoginFromPrompt("test@example.com")
|
||||
}
|
||||
}
|
||||
|
||||
@ -542,6 +542,42 @@ class SettingsPrivacyTest {
|
||||
verifyEmptyHistoryView()
|
||||
}
|
||||
}
|
||||
|
||||
@SmokeTest
|
||||
@Test
|
||||
fun saveLoginsInPWATest() {
|
||||
val pwaPage = "https://mozilla-mobile.github.io/testapp/loginForm"
|
||||
val shortcutTitle = "TEST_APP"
|
||||
|
||||
navigationToolbar {
|
||||
}.enterURLAndEnterToBrowser(pwaPage.toUri()) {
|
||||
verifyNotificationDotOnMainMenu()
|
||||
}.openThreeDotMenu {
|
||||
}.clickInstall {
|
||||
clickAddAutomaticallyButton()
|
||||
}.openHomeScreenShortcut(shortcutTitle) {
|
||||
mDevice.waitForIdle()
|
||||
fillAndSubmitLoginCredentials("mozilla", "firefox")
|
||||
verifySaveLoginPromptIsDisplayed()
|
||||
saveLoginFromPrompt("Save")
|
||||
openAppFromExternalLink(pwaPage)
|
||||
|
||||
browserScreen {
|
||||
}.openThreeDotMenu {
|
||||
}.openSettings {
|
||||
}.openLoginsAndPasswordSubMenu {
|
||||
}.openSavedLogins {
|
||||
verifySecurityPromptForLogins()
|
||||
tapSetupLater()
|
||||
verifySavedLoginFromPrompt("mozilla")
|
||||
}
|
||||
|
||||
addToHomeScreen {
|
||||
}.searchAndOpenHomeScreenShortcut(shortcutTitle) {
|
||||
verifyPrefilledLoginCredentials("mozilla", shortcutTitle)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setOpenLinksInPrivateOn() {
|
||||
|
@ -606,7 +606,7 @@ class SmokeTest {
|
||||
verifySecurityPromptForLogins()
|
||||
tapSetupLater()
|
||||
// Verify that the login appears correctly
|
||||
verifySavedLoginFromPrompt()
|
||||
verifySavedLoginFromPrompt("test@example.com")
|
||||
viewSavedLoginDetails("test@example.com")
|
||||
revealPassword()
|
||||
verifyPasswordSaved("test") // failing here locally
|
||||
|
@ -573,6 +573,32 @@ class BrowserRobot {
|
||||
mDevice.waitForIdle()
|
||||
}
|
||||
|
||||
fun verifyPrefilledLoginCredentials(userName: String, shortcutTitle: String) {
|
||||
mDevice.waitForIdle(waitingTime)
|
||||
|
||||
var currentTries = 0
|
||||
while (currentTries++ < 3) {
|
||||
try {
|
||||
assertTrue(submitLoginButton.waitForExists(waitingTime))
|
||||
submitLoginButton.click()
|
||||
assertTrue(userNameTextBox.text.equals(userName))
|
||||
break
|
||||
} catch (e: AssertionError) {
|
||||
addToHomeScreen {
|
||||
}.searchAndOpenHomeScreenShortcut(shortcutTitle) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun verifySaveLoginPromptIsDisplayed() {
|
||||
assertTrue(
|
||||
mDevice.findObject(
|
||||
UiSelector()
|
||||
.resourceId("$packageName:id/feature_prompt_login_fragment")
|
||||
).waitForExists(waitingTime)
|
||||
)
|
||||
}
|
||||
|
||||
class Transition {
|
||||
private val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
|
||||
private fun threeDotButton() = onView(
|
||||
|
@ -39,8 +39,8 @@ class SettingsSubMenuLoginsAndPasswordsSavedLoginsRobot {
|
||||
|
||||
fun tapSetupLater() = onView(withText("Later")).perform(ViewActions.click())
|
||||
|
||||
fun verifySavedLoginFromPrompt() =
|
||||
mDevice.waitNotNull(Until.findObjects(By.text("test@example.com")))
|
||||
fun verifySavedLoginFromPrompt(userName: String) =
|
||||
mDevice.waitNotNull(Until.findObjects(By.text(userName)))
|
||||
|
||||
fun verifyNotSavedLoginFromPrompt() = onView(withText("test@example.com"))
|
||||
.check(ViewAssertions.doesNotExist())
|
||||
|
Loading…
Reference in New Issue
Block a user