Loading app/src/androidTest/java/org/mozilla/fenix/syncintegration/SyncIntegrationTest.kt +34 −3 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import org.junit.Test import org.mozilla.fenix.helpers.HomeActivityTestRule import org.mozilla.fenix.ui.robots.homeScreen import org.mozilla.fenix.ui.robots.accountSettings import org.mozilla.fenix.ui.robots.settingsSubMenuLoginsAndPassword import androidx.test.platform.app.InstrumentationRegistry import androidx.test.uiautomator.UiDevice Loading @@ -28,7 +29,6 @@ import androidx.test.uiautomator.Until import org.hamcrest.Matchers.allOf import org.mozilla.fenix.R import org.mozilla.fenix.helpers.TestAssetHelper import org.mozilla.fenix.helpers.ext.waitNotNull @Suppress("RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS") Loading Loading @@ -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 // once the test above runs successfully and // the environment is stable Loading Loading @@ -187,7 +218,7 @@ class SyncIntegrationTest { } fun settingsAccount() = onView(allOf(withText("Turn on Sync"))).perform(click()) fun tapInToolBar() = onView(withId(org.mozilla.fenix.R.id.toolbar_wrapper)) fun awesomeBar() = onView(withId(org.mozilla.fenix.R.id.mozac_browser_toolbar_edit_url_view)) fun tapInToolBar() = onView(withId(R.id.toolbar_wrapper)) fun awesomeBar() = onView(withId(R.id.mozac_browser_toolbar_edit_url_view)) fun useEmailInsteadButton() = onView(withId(R.id.signInEmailButton)).perform(click()) fun enterAccountSettings() = onView(withId(R.id.email)).perform(click()) app/src/androidTest/java/org/mozilla/fenix/syncintegration/test_integration.py +5 −0 Original line number Diff line number Diff line Loading @@ -14,3 +14,8 @@ def test_sync_bookmark_from_device(tps, gradlewbuild): os.chdir('app/src/androidTest/java/org/mozilla/fenix/syncintegration/') tps.run('test_bookmark.js') 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') app/src/androidTest/java/org/mozilla/fenix/syncintegration/test_logins.js 0 → 100644 +30 −0 Original line number Diff line number Diff line /* 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] ]); No newline at end of file app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsRobot.kt +1 −0 Original line number Diff line number Diff line Loading @@ -138,6 +138,7 @@ class SettingsRobot { } fun openLoginsAndPasswordSubMenu(interact: SettingsSubMenuLoginsAndPasswordRobot.() -> Unit): SettingsSubMenuLoginsAndPasswordRobot.Transition { TestHelper.scrollToElementByText("Logins and passwords") fun loginsAndPasswordsButton() = onView(ViewMatchers.withText("Logins and passwords")) loginsAndPasswordsButton().click() Loading app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuLoginsAndPasswordRobot.kt +22 −1 Original line number Diff line number Diff line Loading @@ -12,16 +12,32 @@ import androidx.test.espresso.assertion.ViewAssertions.matches import androidx.test.espresso.matcher.ViewMatchers import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility import androidx.test.platform.app.InstrumentationRegistry import androidx.test.uiautomator.By import androidx.test.uiautomator.UiDevice import androidx.test.uiautomator.Until import org.hamcrest.CoreMatchers import org.mozilla.fenix.helpers.TestAssetHelper 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 */ 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() class Transition { Loading Loading @@ -52,6 +68,11 @@ class SettingsSubMenuLoginsAndPasswordRobot { } } fun settingsSubMenuLoginsAndPassword(interact: SettingsSubMenuLoginsAndPasswordRobot.() -> Unit): SettingsSubMenuLoginsAndPasswordRobot.Transition { SettingsSubMenuLoginsAndPasswordRobot().interact() return SettingsSubMenuLoginsAndPasswordRobot.Transition() } private fun goBackButton() = onView(CoreMatchers.allOf(ViewMatchers.withContentDescription("Navigate up"))) Loading Loading
app/src/androidTest/java/org/mozilla/fenix/syncintegration/SyncIntegrationTest.kt +34 −3 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import org.junit.Test import org.mozilla.fenix.helpers.HomeActivityTestRule import org.mozilla.fenix.ui.robots.homeScreen import org.mozilla.fenix.ui.robots.accountSettings import org.mozilla.fenix.ui.robots.settingsSubMenuLoginsAndPassword import androidx.test.platform.app.InstrumentationRegistry import androidx.test.uiautomator.UiDevice Loading @@ -28,7 +29,6 @@ import androidx.test.uiautomator.Until import org.hamcrest.Matchers.allOf import org.mozilla.fenix.R import org.mozilla.fenix.helpers.TestAssetHelper import org.mozilla.fenix.helpers.ext.waitNotNull @Suppress("RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS") Loading Loading @@ -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 // once the test above runs successfully and // the environment is stable Loading Loading @@ -187,7 +218,7 @@ class SyncIntegrationTest { } fun settingsAccount() = onView(allOf(withText("Turn on Sync"))).perform(click()) fun tapInToolBar() = onView(withId(org.mozilla.fenix.R.id.toolbar_wrapper)) fun awesomeBar() = onView(withId(org.mozilla.fenix.R.id.mozac_browser_toolbar_edit_url_view)) fun tapInToolBar() = onView(withId(R.id.toolbar_wrapper)) fun awesomeBar() = onView(withId(R.id.mozac_browser_toolbar_edit_url_view)) fun useEmailInsteadButton() = onView(withId(R.id.signInEmailButton)).perform(click()) fun enterAccountSettings() = onView(withId(R.id.email)).perform(click())
app/src/androidTest/java/org/mozilla/fenix/syncintegration/test_integration.py +5 −0 Original line number Diff line number Diff line Loading @@ -14,3 +14,8 @@ def test_sync_bookmark_from_device(tps, gradlewbuild): os.chdir('app/src/androidTest/java/org/mozilla/fenix/syncintegration/') tps.run('test_bookmark.js') 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')
app/src/androidTest/java/org/mozilla/fenix/syncintegration/test_logins.js 0 → 100644 +30 −0 Original line number Diff line number Diff line /* 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] ]); No newline at end of file
app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsRobot.kt +1 −0 Original line number Diff line number Diff line Loading @@ -138,6 +138,7 @@ class SettingsRobot { } fun openLoginsAndPasswordSubMenu(interact: SettingsSubMenuLoginsAndPasswordRobot.() -> Unit): SettingsSubMenuLoginsAndPasswordRobot.Transition { TestHelper.scrollToElementByText("Logins and passwords") fun loginsAndPasswordsButton() = onView(ViewMatchers.withText("Logins and passwords")) loginsAndPasswordsButton().click() Loading
app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuLoginsAndPasswordRobot.kt +22 −1 Original line number Diff line number Diff line Loading @@ -12,16 +12,32 @@ import androidx.test.espresso.assertion.ViewAssertions.matches import androidx.test.espresso.matcher.ViewMatchers import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility import androidx.test.platform.app.InstrumentationRegistry import androidx.test.uiautomator.By import androidx.test.uiautomator.UiDevice import androidx.test.uiautomator.Until import org.hamcrest.CoreMatchers import org.mozilla.fenix.helpers.TestAssetHelper 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 */ 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() class Transition { Loading Loading @@ -52,6 +68,11 @@ class SettingsSubMenuLoginsAndPasswordRobot { } } fun settingsSubMenuLoginsAndPassword(interact: SettingsSubMenuLoginsAndPasswordRobot.() -> Unit): SettingsSubMenuLoginsAndPasswordRobot.Transition { SettingsSubMenuLoginsAndPasswordRobot().interact() return SettingsSubMenuLoginsAndPasswordRobot.Transition() } private fun goBackButton() = onView(CoreMatchers.allOf(ViewMatchers.withContentDescription("Navigate up"))) Loading