Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
fix reviewer comments
Browse files Browse the repository at this point in the history
  • Loading branch information
isabelrios committed Feb 19, 2020
1 parent ec71291 commit 5f03de0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
package org.mozilla.fenix.ui

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice
import androidx.test.uiautomator.Until
import okhttp3.mockwebserver.MockWebServer
import org.junit.Rule
import org.junit.Before
Expand All @@ -18,7 +16,6 @@ import org.mozilla.fenix.helpers.AndroidAssetDispatcher
import org.mozilla.fenix.helpers.HomeActivityTestRule
import org.mozilla.fenix.helpers.TestAssetHelper
import org.mozilla.fenix.helpers.TestHelper
import org.mozilla.fenix.helpers.ext.waitNotNull
import org.mozilla.fenix.ui.robots.homeScreen
import org.mozilla.fenix.ui.robots.navigationToolbar

Expand Down Expand Up @@ -145,12 +142,9 @@ class SettingsPrivacyTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(saveLoginTest.url) {
mDevice.waitNotNull(Until.findObjects(By.text("test@example.com")), TestAssetHelper.waitingTime)
val submitButton = mDevice.findObject(By.res("submit"))
submitButton.clickAndWait(Until.newWindow(), TestAssetHelper.waitingTime)
verifySaveLoginPromptIsShown()
// Click save to save the login
mDevice.waitNotNull(Until.findObjects(By.text("Save")))
mDevice.findObject(By.text("Save")).click()
saveLoginFromPrompt("Save")
}.openHomeScreen {
}.openThreeDotMenu {
}.openSettings {
Expand All @@ -172,17 +166,12 @@ class SettingsPrivacyTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(saveLoginTest.url) {
mDevice.waitNotNull(Until.findObjects(By.text("test@example.com")), TestAssetHelper.waitingTime)

val submitButton = mDevice.findObject(By.res("submit"))
submitButton.clickAndWait(Until.newWindow(), TestAssetHelper.waitingTime)
// Click save to save the login
mDevice.waitNotNull(Until.findObjects(By.text("Save")))
mDevice.findObject(By.text("Don’t save")).click()
verifySaveLoginPromptIsShown()
// Don't save the login
saveLoginFromPrompt("Don’t save")
}.openHomeScreen {
}.openThreeDotMenu {
}.openSettings {
TestHelper.scrollToElementByText("Logins and passwords")
}.openLoginsAndPasswordSubMenu {
verifyDefaultView()
verifyDefaultValueSyncLogins()
Expand All @@ -199,8 +188,6 @@ class SettingsPrivacyTest {
homeScreen {
}.openThreeDotMenu {
}.openSettings {
// Necessary to scroll a little bit for all screen sizes
TestHelper.scrollToElementByText("Logins and passwords")
}.openLoginsAndPasswordSubMenu {
}.saveLoginsAndPasswordsOptions {
verifySaveLoginsOptionsView()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,18 @@ class BrowserRobot {
).perform(ViewActions.click())
}

fun verifySaveLoginPromptIsShown() {
mDevice.waitNotNull(Until.findObjects(By.text("test@example.com")), TestAssetHelper.waitingTime)
val submitButton = mDevice.findObject(By.res("submit"))
submitButton.clickAndWait(Until.newWindow(), TestAssetHelper.waitingTime)
// Click save to save the login
mDevice.waitNotNull(Until.findObjects(By.text("Save")))
}

fun saveLoginFromPrompt(optionToSaveLogin: String) {
mDevice.findObject(By.text(optionToSaveLogin)).click()
}

class Transition {
private val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
private fun threeDotButton() = onView(
Expand Down

0 comments on commit 5f03de0

Please sign in to comment.