2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-03 23:15:31 +00:00

New verifyMultipleLoginsSelectionsTest UI Smoke test

This commit is contained in:
AndiAJ 2022-02-03 07:50:41 +02:00 committed by mergify[bot]
parent f45c5876dc
commit 84a8030daa
2 changed files with 78 additions and 6 deletions

View File

@ -283,6 +283,26 @@ class SettingsPrivacyTest {
}
}
@SmokeTest
@Test
fun verifyMultipleLoginsSelectionsTest() {
val loginPage = "https://mozilla-mobile.github.io/testapp/loginForm"
navigationToolbar {
}.enterURLAndEnterToBrowser(loginPage.toUri()) {
fillAndSubmitLoginCredentials("mozilla", "firefox")
saveLoginFromPrompt("Save")
fillAndSubmitLoginCredentials("firefox", "mozilla")
saveLoginFromPrompt("Save")
clearUserNameLoginCredential()
clickSuggestedLoginsButton()
verifySuggestedUserName("firefox")
verifySuggestedUserName("mozilla")
clickLoginSuggestion("mozilla")
verifyPrefilledLoginCredentials("mozilla")
}
}
@Test
fun verifyPrivateBrowsingMenuItemsTest() {
homeScreen {
@ -574,7 +594,7 @@ class SettingsPrivacyTest {
addToHomeScreen {
}.searchAndOpenHomeScreenShortcut(shortcutTitle) {
verifyPrefilledLoginCredentials("mozilla", shortcutTitle)
verifyPrefilledPWALoginCredentials("mozilla", shortcutTitle)
}
}
}

View File

@ -456,6 +456,11 @@ class BrowserRobot {
}
fun saveLoginFromPrompt(optionToSaveLogin: String) {
mDevice.waitForObjects(
mDevice.findObject(
UiSelector().resourceId("$packageName:id/feature_prompt_login_fragment")
)
)
mDevice.findObject(text(optionToSaveLogin)).click()
}
@ -575,17 +580,62 @@ class BrowserRobot {
}
fun fillAndSubmitLoginCredentials(userName: String, password: String) {
userNameTextBox.click()
userNameTextBox.setText(userName)
passwordTextBox.click()
passwordTextBox.setText(password)
submitLoginButton.click()
mDevice.waitForIdle()
mDevice.waitForObjects(mDevice.findObject(UiSelector().resourceId("$packageName:id/save_confirm")))
}
fun verifyPrefilledLoginCredentials(userName: String, shortcutTitle: String) {
fun clearUserNameLoginCredential() {
mDevice.waitForObjects(userNameTextBox)
userNameTextBox.clearTextField()
mDevice.waitForIdle(waitingTime)
}
fun clickSuggestedLoginsButton() {
var currentTries = 0
while (currentTries++ < 3) {
try {
mDevice.waitForObjects(suggestedLogins)
suggestedLogins.click()
mDevice.waitForObjects(suggestedLogins)
break
} catch (e: UiObjectNotFoundException) {
userNameTextBox.click()
}
}
}
fun clickLoginSuggestion(userName: String) {
val loginSuggestion =
mDevice.findObject(
UiSelector()
.textContains(userName)
.resourceId("$packageName:id/username")
)
loginSuggestion.click()
}
fun verifySuggestedUserName(userName: String) {
mDevice.findObject(
UiSelector()
.resourceId("$packageName:id/mozac_feature_login_multiselect_expand")
).waitForExists(waitingTime)
assertTrue(
mDevice.findObject(UiSelector().textContains(userName)).waitForExists(waitingTime)
)
}
fun verifyPrefilledLoginCredentials(userName: String) {
mDevice.waitForObjects(userNameTextBox)
assertTrue(userNameTextBox.text.equals(userName))
}
fun verifyPrefilledPWALoginCredentials(userName: String, shortcutTitle: String) {
mDevice.waitForIdle(waitingTime)
var currentTries = 0
@ -818,6 +868,8 @@ private var progressBar =
UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_progress")
)
private val suggestedLogins = mDevice.findObject(UiSelector().resourceId("$packageName:id/loginSelectBar"))
// Permissions test page elements & prompts
// Test page used located at https://mozilla-mobile.github.io/testapp/permissions
private val cameraButton = mDevice.findObject(UiSelector().text("Open camera"))