1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 package org.mozilla.fenix.ui
7 import androidx.core.net.toUri
10 import org.mozilla.fenix.customannotations.SmokeTest
11 import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
12 import org.mozilla.fenix.helpers.MatcherHelper.itemContainingText
13 import org.mozilla.fenix.helpers.TestHelper.mDevice
14 import org.mozilla.fenix.helpers.TestSetup
15 import org.mozilla.fenix.ui.robots.clickPageObject
16 import org.mozilla.fenix.ui.robots.customTabScreen
17 import org.mozilla.fenix.ui.robots.navigationToolbar
18 import org.mozilla.fenix.ui.robots.pwaScreen
20 class PwaTest : TestSetup() {
21 /* Updated externalLinks.html to v2.0,
22 changed the hypertext reference to mozilla-mobile.github.io/testapp/downloads for "External link"
24 private val externalLinksPWAPage = "https://mozilla-mobile.github.io/testapp/v2.0/externalLinks.html"
25 private val emailLink = "mailto://example@example.com"
26 private val phoneLink = "tel://1234567890"
27 private val shortcutTitle = "TEST_APP"
30 val activityTestRule = HomeActivityIntentTestRule.withDefaultSettingsOverrides()
32 // TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/845695
34 fun externalLinkPWATest() {
35 val externalLinkURL = "https://mozilla-mobile.github.io/testapp/downloads"
38 }.enterURLAndEnterToBrowser(externalLinksPWAPage.toUri()) {
42 clickAddAutomaticallyButton()
43 }.openHomeScreenShortcut(shortcutTitle) {
44 clickPageObject(itemContainingText("External link"))
48 verifyCustomTabToolbarTitle(externalLinkURL)
52 // TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/845694
54 fun appLikeExperiencePWATest() {
56 }.enterURLAndEnterToBrowser(externalLinksPWAPage.toUri()) {
60 clickAddAutomaticallyButton()
61 }.openHomeScreenShortcut(shortcutTitle) {
65 verifyCustomTabToolbarIsNotDisplayed()
66 verifyPwaActivityInCurrentTask()
70 // TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/834200
73 fun installPWAFromTheMainMenuTest() {
74 val pwaPage = "https://mozilla-mobile.github.io/testapp/"
77 }.enterURLAndEnterToBrowser(pwaPage.toUri()) {
80 clickAddAutomaticallyButton()
81 }.openHomeScreenShortcut("TEST_APP") {
83 verifyNavURLBarHidden()