* sync-integration-logins-test * improve checks for logins test * fixing ktlint issues * uncomment lines * address reviewer comments * fix ui tests after robot change * fix lintmaster
parent
fe92332ff1
commit
d25cbebe08
|
@ -19,6 +19,7 @@ import org.junit.Test
|
||||||
import org.mozilla.fenix.helpers.HomeActivityTestRule
|
import org.mozilla.fenix.helpers.HomeActivityTestRule
|
||||||
import org.mozilla.fenix.ui.robots.homeScreen
|
import org.mozilla.fenix.ui.robots.homeScreen
|
||||||
import org.mozilla.fenix.ui.robots.accountSettings
|
import org.mozilla.fenix.ui.robots.accountSettings
|
||||||
|
import org.mozilla.fenix.ui.robots.settingsSubMenuLoginsAndPassword
|
||||||
|
|
||||||
import androidx.test.platform.app.InstrumentationRegistry
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
import androidx.test.uiautomator.UiDevice
|
import androidx.test.uiautomator.UiDevice
|
||||||
|
@ -28,7 +29,6 @@ import androidx.test.uiautomator.Until
|
||||||
import org.hamcrest.Matchers.allOf
|
import org.hamcrest.Matchers.allOf
|
||||||
import org.mozilla.fenix.R
|
import org.mozilla.fenix.R
|
||||||
import org.mozilla.fenix.helpers.TestAssetHelper
|
import org.mozilla.fenix.helpers.TestAssetHelper
|
||||||
|
|
||||||
import org.mozilla.fenix.helpers.ext.waitNotNull
|
import org.mozilla.fenix.helpers.ext.waitNotNull
|
||||||
|
|
||||||
@Suppress("RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS")
|
@Suppress("RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS")
|
||||||
|
@ -82,6 +82,37 @@ class SyncIntegrationTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun checkLoginsFromDesktopTest() {
|
||||||
|
homeScreen {
|
||||||
|
}.openThreeDotMenu {
|
||||||
|
}.openSettings {
|
||||||
|
}.openLoginsAndPasswordSubMenu {
|
||||||
|
}.openSyncLogins {
|
||||||
|
// Tap to sign in from Logins menu
|
||||||
|
tapOnUseEmailToSignIn()
|
||||||
|
typeEmail()
|
||||||
|
tapOnContinueButton()
|
||||||
|
typePassword()
|
||||||
|
tapOnSignIn()
|
||||||
|
}
|
||||||
|
// Automatically goes back to Logins and passwords view
|
||||||
|
settingsSubMenuLoginsAndPassword {
|
||||||
|
verifyDefaultView()
|
||||||
|
// Sync logings option is set to Off, no synced logins yet
|
||||||
|
verifyDefaultViewBeforeSyncComplete()
|
||||||
|
}.openSavedLogins {
|
||||||
|
// Discard the secure your device message
|
||||||
|
tapSetupLater()
|
||||||
|
// Check the logins synced
|
||||||
|
verifySavedLoginsAfterSync()
|
||||||
|
}.goBack {
|
||||||
|
// After checking the synced logins
|
||||||
|
// on Logins and Passwords menu the Sync logins option is set to On
|
||||||
|
verifyDefaultViewAfterSync()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* These tests will be running in the future
|
/* These tests will be running in the future
|
||||||
// once the test above runs successfully and
|
// once the test above runs successfully and
|
||||||
// the environment is stable
|
// the environment is stable
|
||||||
|
@ -187,7 +218,7 @@ class SyncIntegrationTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun settingsAccount() = onView(allOf(withText("Turn on Sync"))).perform(click())
|
fun settingsAccount() = onView(allOf(withText("Turn on Sync"))).perform(click())
|
||||||
fun tapInToolBar() = onView(withId(org.mozilla.fenix.R.id.toolbar_wrapper))
|
fun tapInToolBar() = onView(withId(R.id.toolbar_wrapper))
|
||||||
fun awesomeBar() = onView(withId(org.mozilla.fenix.R.id.mozac_browser_toolbar_edit_url_view))
|
fun awesomeBar() = onView(withId(R.id.mozac_browser_toolbar_edit_url_view))
|
||||||
fun useEmailInsteadButton() = onView(withId(R.id.signInEmailButton)).perform(click())
|
fun useEmailInsteadButton() = onView(withId(R.id.signInEmailButton)).perform(click())
|
||||||
fun enterAccountSettings() = onView(withId(R.id.email)).perform(click())
|
fun enterAccountSettings() = onView(withId(R.id.email)).perform(click())
|
||||||
|
|
|
@ -14,3 +14,8 @@ def test_sync_bookmark_from_device(tps, gradlewbuild):
|
||||||
os.chdir('app/src/androidTest/java/org/mozilla/fenix/syncintegration/')
|
os.chdir('app/src/androidTest/java/org/mozilla/fenix/syncintegration/')
|
||||||
tps.run('test_bookmark.js')
|
tps.run('test_bookmark.js')
|
||||||
gradlewbuild.test('checkBookmarkFromDesktopTest')
|
gradlewbuild.test('checkBookmarkFromDesktopTest')
|
||||||
|
|
||||||
|
def test_sync_logins_from_device(tps, gradlewbuild):
|
||||||
|
os.chdir('app/src/androidTest/java/org/mozilla/fenix/syncintegration/')
|
||||||
|
tps.run('test_logins.js')
|
||||||
|
gradlewbuild.test('checkLoginsFromDesktopTest')
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The list of phases mapped to their corresponding profiles. The object
|
||||||
|
* here must be in strict JSON format, as it will get parsed by the Python
|
||||||
|
* testrunner (no single quotes, extra comma's, etc).
|
||||||
|
*/
|
||||||
|
EnableEngines(["passwords"]);
|
||||||
|
|
||||||
|
var phases = { "phase1": "profile1" };
|
||||||
|
|
||||||
|
|
||||||
|
// expected tabs state
|
||||||
|
var password_list = [{
|
||||||
|
hostname: "https://accounts.google.com",
|
||||||
|
submitURL: "https://accounts.google.com/signin/challenge/sl/password",
|
||||||
|
realm: null,
|
||||||
|
username: "iosmztest",
|
||||||
|
password: "test15mz",
|
||||||
|
usernameField: "Email",
|
||||||
|
passwordField: "Passwd",
|
||||||
|
}];
|
||||||
|
|
||||||
|
// sync and verify tabs
|
||||||
|
Phase("phase1", [
|
||||||
|
[Sync],
|
||||||
|
[Passwords.add, password_list],
|
||||||
|
[Sync]
|
||||||
|
]);
|
|
@ -138,6 +138,7 @@ class SettingsRobot {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun openLoginsAndPasswordSubMenu(interact: SettingsSubMenuLoginsAndPasswordRobot.() -> Unit): SettingsSubMenuLoginsAndPasswordRobot.Transition {
|
fun openLoginsAndPasswordSubMenu(interact: SettingsSubMenuLoginsAndPasswordRobot.() -> Unit): SettingsSubMenuLoginsAndPasswordRobot.Transition {
|
||||||
|
TestHelper.scrollToElementByText("Logins and passwords")
|
||||||
fun loginsAndPasswordsButton() = onView(ViewMatchers.withText("Logins and passwords"))
|
fun loginsAndPasswordsButton() = onView(ViewMatchers.withText("Logins and passwords"))
|
||||||
loginsAndPasswordsButton().click()
|
loginsAndPasswordsButton().click()
|
||||||
|
|
||||||
|
|
|
@ -12,16 +12,32 @@ import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||||
import androidx.test.espresso.matcher.ViewMatchers
|
import androidx.test.espresso.matcher.ViewMatchers
|
||||||
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
|
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
|
||||||
import androidx.test.platform.app.InstrumentationRegistry
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
|
import androidx.test.uiautomator.By
|
||||||
import androidx.test.uiautomator.UiDevice
|
import androidx.test.uiautomator.UiDevice
|
||||||
|
import androidx.test.uiautomator.Until
|
||||||
import org.hamcrest.CoreMatchers
|
import org.hamcrest.CoreMatchers
|
||||||
|
import org.mozilla.fenix.helpers.TestAssetHelper
|
||||||
import org.mozilla.fenix.helpers.click
|
import org.mozilla.fenix.helpers.click
|
||||||
|
import org.mozilla.fenix.helpers.ext.waitNotNull
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of Robot Pattern for the Privacy Settings > logins and passwords sub menu
|
* Implementation of Robot Pattern for the Privacy Settings > logins and passwords sub menu
|
||||||
*/
|
*/
|
||||||
class SettingsSubMenuLoginsAndPasswordRobot {
|
class SettingsSubMenuLoginsAndPasswordRobot {
|
||||||
|
|
||||||
fun verifyDefaultView() = assertDefaultView()
|
fun verifyDefaultView() {
|
||||||
|
mDevice.waitNotNull(Until.findObjects(By.text("Sync logins")), TestAssetHelper.waitingTime)
|
||||||
|
assertDefaultView()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun verifyDefaultViewBeforeSyncComplete() {
|
||||||
|
mDevice.waitNotNull(Until.findObjects(By.text("Off")), TestAssetHelper.waitingTime)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun verifyDefaultViewAfterSync() {
|
||||||
|
mDevice.waitNotNull(Until.findObjects(By.text("On")), TestAssetHelper.waitingTime)
|
||||||
|
}
|
||||||
|
|
||||||
fun verifyDefaultValueSyncLogins() = asserDefaultValueSyncLogins()
|
fun verifyDefaultValueSyncLogins() = asserDefaultValueSyncLogins()
|
||||||
|
|
||||||
class Transition {
|
class Transition {
|
||||||
|
@ -52,6 +68,11 @@ class SettingsSubMenuLoginsAndPasswordRobot {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun settingsSubMenuLoginsAndPassword(interact: SettingsSubMenuLoginsAndPasswordRobot.() -> Unit): SettingsSubMenuLoginsAndPasswordRobot.Transition {
|
||||||
|
SettingsSubMenuLoginsAndPasswordRobot().interact()
|
||||||
|
return SettingsSubMenuLoginsAndPasswordRobot.Transition()
|
||||||
|
}
|
||||||
|
|
||||||
private fun goBackButton() =
|
private fun goBackButton() =
|
||||||
onView(CoreMatchers.allOf(ViewMatchers.withContentDescription("Navigate up")))
|
onView(CoreMatchers.allOf(ViewMatchers.withContentDescription("Navigate up")))
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,11 @@ import androidx.test.espresso.action.ViewActions
|
||||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||||
import androidx.test.espresso.matcher.ViewMatchers
|
import androidx.test.espresso.matcher.ViewMatchers
|
||||||
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
|
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
|
||||||
|
import androidx.test.uiautomator.By
|
||||||
|
import androidx.test.uiautomator.Until
|
||||||
import org.hamcrest.CoreMatchers
|
import org.hamcrest.CoreMatchers
|
||||||
|
import org.mozilla.fenix.helpers.TestAssetHelper
|
||||||
|
import org.mozilla.fenix.helpers.ext.waitNotNull
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of Robot Pattern for the Privacy Settings > saved logins sub menu
|
* Implementation of Robot Pattern for the Privacy Settings > saved logins sub menu
|
||||||
|
@ -18,6 +22,11 @@ import org.hamcrest.CoreMatchers
|
||||||
class SettingsSubMenuLoginsAndPasswordsSavedLoginsRobot {
|
class SettingsSubMenuLoginsAndPasswordsSavedLoginsRobot {
|
||||||
fun verifySavedLoginsView() = assertSavedLoginsView()
|
fun verifySavedLoginsView() = assertSavedLoginsView()
|
||||||
|
|
||||||
|
fun verifySavedLoginsAfterSync() {
|
||||||
|
mDevice.waitNotNull(Until.findObjects(By.text("https://accounts.google.com")), TestAssetHelper.waitingTime)
|
||||||
|
assertSavedLoginAppears()
|
||||||
|
}
|
||||||
|
|
||||||
fun tapSetupLater() = onView(ViewMatchers.withText("Later")).perform(ViewActions.click())
|
fun tapSetupLater() = onView(ViewMatchers.withText("Later")).perform(ViewActions.click())
|
||||||
|
|
||||||
class Transition {
|
class Transition {
|
||||||
|
@ -35,3 +44,5 @@ private fun goBackButton() =
|
||||||
|
|
||||||
private fun assertSavedLoginsView() = onView(ViewMatchers.withText("Secure your logins and passwords"))
|
private fun assertSavedLoginsView() = onView(ViewMatchers.withText("Secure your logins and passwords"))
|
||||||
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||||
|
|
||||||
|
private fun assertSavedLoginAppears() = onView(ViewMatchers.withText("https://accounts.google.com"))
|
||||||
|
|
|
@ -11,6 +11,7 @@ import androidx.test.espresso.matcher.ViewMatchers
|
||||||
import androidx.test.platform.app.InstrumentationRegistry
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
import androidx.test.uiautomator.UiDevice
|
import androidx.test.uiautomator.UiDevice
|
||||||
import org.hamcrest.CoreMatchers
|
import org.hamcrest.CoreMatchers
|
||||||
|
import org.mozilla.fenix.helpers.click
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of Robot Pattern for the settings turn on sync option.
|
* Implementation of Robot Pattern for the settings turn on sync option.
|
||||||
|
@ -20,6 +21,8 @@ class SettingsTurnOnSyncRobot {
|
||||||
|
|
||||||
fun verifyReadyToScanOption() = assertReadyToScan()
|
fun verifyReadyToScanOption() = assertReadyToScan()
|
||||||
|
|
||||||
|
fun tapOnUseEmailToSignIn() = useEmailButton().click()
|
||||||
|
|
||||||
class Transition {
|
class Transition {
|
||||||
val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
|
val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
|
||||||
|
|
||||||
|
@ -40,3 +43,5 @@ private fun assertUseEmailField() = Espresso.onView(ViewMatchers.withText("Use e
|
||||||
|
|
||||||
private fun assertReadyToScan() = Espresso.onView(ViewMatchers.withText("Ready to scan"))
|
private fun assertReadyToScan() = Espresso.onView(ViewMatchers.withText("Ready to scan"))
|
||||||
.check(ViewAssertions.matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
.check(ViewAssertions.matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||||
|
|
||||||
|
private fun useEmailButton() = Espresso.onView(ViewMatchers.withText("Use email instead"))
|
||||||
|
|
Loading…
Reference in New Issue