|
|
|
@ -5,27 +5,16 @@
|
|
|
|
|
package org.mozilla.fenix.ui
|
|
|
|
|
|
|
|
|
|
import androidx.core.net.toUri
|
|
|
|
|
import org.junit.Ignore
|
|
|
|
|
import org.junit.Rule
|
|
|
|
|
import org.junit.Test
|
|
|
|
|
import org.mozilla.fenix.helpers.Constants.PackageName.GMAIL_APP
|
|
|
|
|
import org.mozilla.fenix.helpers.Constants.PackageName.PHONE_APP
|
|
|
|
|
import org.mozilla.fenix.customannotations.SmokeTest
|
|
|
|
|
import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
|
|
|
|
|
import org.mozilla.fenix.helpers.MatcherHelper.itemContainingText
|
|
|
|
|
import org.mozilla.fenix.helpers.MatcherHelper.itemWithResId
|
|
|
|
|
import org.mozilla.fenix.helpers.MatcherHelper.itemWithResIdAndText
|
|
|
|
|
import org.mozilla.fenix.helpers.MatcherHelper.itemWithText
|
|
|
|
|
import org.mozilla.fenix.helpers.TestHelper
|
|
|
|
|
import org.mozilla.fenix.helpers.TestHelper.assertExternalAppOpens
|
|
|
|
|
import org.mozilla.fenix.helpers.TestHelper.assertNativeAppOpens
|
|
|
|
|
import org.mozilla.fenix.helpers.TestHelper.mDevice
|
|
|
|
|
import org.mozilla.fenix.ui.robots.addToHomeScreen
|
|
|
|
|
import org.mozilla.fenix.ui.robots.browserScreen
|
|
|
|
|
import org.mozilla.fenix.ui.robots.clickPageObject
|
|
|
|
|
import org.mozilla.fenix.ui.robots.customTabScreen
|
|
|
|
|
import org.mozilla.fenix.ui.robots.navigationToolbar
|
|
|
|
|
import org.mozilla.fenix.ui.robots.pwaScreen
|
|
|
|
|
import org.mozilla.fenix.ui.robots.setPageObjectText
|
|
|
|
|
|
|
|
|
|
class PwaTest {
|
|
|
|
|
/* Updated externalLinks.html to v2.0,
|
|
|
|
@ -39,6 +28,7 @@ class PwaTest {
|
|
|
|
|
@get:Rule
|
|
|
|
|
val activityTestRule = HomeActivityIntentTestRule.withDefaultSettingsOverrides()
|
|
|
|
|
|
|
|
|
|
// TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/845695
|
|
|
|
|
@Test
|
|
|
|
|
fun externalLinkPWATest() {
|
|
|
|
|
val externalLinkURL = "https://mozilla-mobile.github.io/testapp/downloads"
|
|
|
|
@ -59,38 +49,7 @@ class PwaTest {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
fun emailLinkPWATest() {
|
|
|
|
|
navigationToolbar {
|
|
|
|
|
}.enterURLAndEnterToBrowser(externalLinksPWAPage.toUri()) {
|
|
|
|
|
waitForPageToLoad()
|
|
|
|
|
verifyNotificationDotOnMainMenu()
|
|
|
|
|
}.openThreeDotMenu {
|
|
|
|
|
}.clickInstall {
|
|
|
|
|
clickAddAutomaticallyButton()
|
|
|
|
|
}.openHomeScreenShortcut(shortcutTitle) {
|
|
|
|
|
clickPageObject(itemContainingText("Email link"))
|
|
|
|
|
clickPageObject(itemWithResIdAndText("android:id/button1", "OPEN"))
|
|
|
|
|
assertExternalAppOpens(GMAIL_APP)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
fun telephoneLinkPWATest() {
|
|
|
|
|
navigationToolbar {
|
|
|
|
|
}.enterURLAndEnterToBrowser(externalLinksPWAPage.toUri()) {
|
|
|
|
|
waitForPageToLoad()
|
|
|
|
|
verifyNotificationDotOnMainMenu()
|
|
|
|
|
}.openThreeDotMenu {
|
|
|
|
|
}.clickInstall {
|
|
|
|
|
clickAddAutomaticallyButton()
|
|
|
|
|
}.openHomeScreenShortcut(shortcutTitle) {
|
|
|
|
|
clickPageObject(itemContainingText("Telephone link"))
|
|
|
|
|
clickPageObject(itemWithResIdAndText("android:id/button1", "OPEN"))
|
|
|
|
|
assertNativeAppOpens(PHONE_APP, phoneLink)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/845694
|
|
|
|
|
@Test
|
|
|
|
|
fun appLikeExperiencePWATest() {
|
|
|
|
|
navigationToolbar {
|
|
|
|
@ -109,11 +68,11 @@ class PwaTest {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Ignore("Failing, see: https://bugzilla.mozilla.org/show_bug.cgi?id=1807273")
|
|
|
|
|
// TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/834200
|
|
|
|
|
@SmokeTest
|
|
|
|
|
@Test
|
|
|
|
|
fun saveLoginsInPWATest() {
|
|
|
|
|
val pwaPage = "https://mozilla-mobile.github.io/testapp/loginForm"
|
|
|
|
|
val shortcutTitle = "TEST_APP"
|
|
|
|
|
fun installPWAFromTheMainMenuTest() {
|
|
|
|
|
val pwaPage = "https://mozilla-mobile.github.io/testapp/"
|
|
|
|
|
|
|
|
|
|
navigationToolbar {
|
|
|
|
|
}.enterURLAndEnterToBrowser(pwaPage.toUri()) {
|
|
|
|
@ -121,29 +80,9 @@ class PwaTest {
|
|
|
|
|
}.openThreeDotMenu {
|
|
|
|
|
}.clickInstall {
|
|
|
|
|
clickAddAutomaticallyButton()
|
|
|
|
|
}.openHomeScreenShortcut(shortcutTitle) {
|
|
|
|
|
}.openHomeScreenShortcut("TEST_APP") {
|
|
|
|
|
mDevice.waitForIdle()
|
|
|
|
|
setPageObjectText(itemWithResId("username"), "mozilla")
|
|
|
|
|
setPageObjectText(itemWithResId("password"), "firefox")
|
|
|
|
|
clickPageObject(itemWithResId("submit"))
|
|
|
|
|
verifySaveLoginPromptIsDisplayed()
|
|
|
|
|
clickPageObject(itemWithText("Save"))
|
|
|
|
|
TestHelper.openAppFromExternalLink(pwaPage)
|
|
|
|
|
|
|
|
|
|
browserScreen {
|
|
|
|
|
}.openThreeDotMenu {
|
|
|
|
|
}.openSettings {
|
|
|
|
|
}.openLoginsAndPasswordSubMenu {
|
|
|
|
|
}.openSavedLogins {
|
|
|
|
|
verifySecurityPromptForLogins()
|
|
|
|
|
tapSetupLater()
|
|
|
|
|
verifySavedLoginsSectionUsername("mozilla")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addToHomeScreen {
|
|
|
|
|
}.searchAndOpenHomeScreenShortcut(shortcutTitle) {
|
|
|
|
|
verifyPrefilledPWALoginCredentials("mozilla", shortcutTitle)
|
|
|
|
|
}
|
|
|
|
|
verifyNavURLBarHidden()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|