Fix externalLinkPWATest UI test

pull/543/head
AndiAJ 2 years ago committed by mergify[bot]
parent 0001f00f40
commit d26514feda

@ -27,7 +27,10 @@ import org.mozilla.fenix.ui.robots.searchScreen
class CustomTabsTest {
private lateinit var mockWebServer: MockWebServer
private val customMenuItem = "TestMenuItem"
private val externalLinksPWAPage = "https://mozilla-mobile.github.io/testapp/externalLinks.html"
/* Updated externalLinks.html to v2.0,
changed the hypertext reference to mozilla-mobile.github.io/testapp/downloads for "External link"
*/
private val externalLinksPWAPage = "https://mozilla-mobile.github.io/testapp/v2.0/externalLinks.html"
private val loginPage = "https://mozilla-mobile.github.io/testapp/loginForm"
@get:Rule
@ -54,6 +57,7 @@ class CustomTabsTest {
@SmokeTest
@Test
fun customTabsOpenExternalLinkTest() {
val externalLinkURL = "https://mozilla-mobile.github.io/testapp/downloads"
intentReceiverActivityTestRule.launchActivity(
createCustomTabIntent(
@ -66,7 +70,7 @@ class CustomTabsTest {
waitForPageToLoad()
clickLinkMatchingText("External link")
waitForPageToLoad()
verifyCustomTabToolbarTitle("Google")
verifyCustomTabToolbarTitle(externalLinkURL)
}
}

@ -16,7 +16,10 @@ import org.mozilla.fenix.ui.robots.navigationToolbar
class PwaTest {
private val featureSettingsHelper = FeatureSettingsHelper()
private val externalLinksPWAPage = "https://mozilla-mobile.github.io/testapp/externalLinks.html"
/* Updated externalLinks.html to v2.0,
changed the hypertext reference to mozilla-mobile.github.io/testapp/downloads for "External link"
*/
private val externalLinksPWAPage = "https://mozilla-mobile.github.io/testapp/v2.0/externalLinks.html"
private val emailLink = "mailto://example@example.com"
private val phoneLink = "tel://1234567890"
private val shortcutTitle = "TEST_APP"
@ -37,7 +40,7 @@ class PwaTest {
@SmokeTest
@Test
fun externalLinkPWATest() {
val customTabTitle = "Google"
val externalLinkURL = "https://mozilla-mobile.github.io/testapp/downloads"
navigationToolbar {
}.enterURLAndEnterToBrowser(externalLinksPWAPage.toUri()) {
@ -46,11 +49,10 @@ class PwaTest {
clickAddAutomaticallyButton()
}.openHomeScreenShortcut(shortcutTitle) {
clickLinkMatchingText("External link")
fillAndSubmitGoogleSearchQuery("Mozilla")
}
customTabScreen {
verifyCustomTabToolbarTitle(customTabTitle)
verifyCustomTabToolbarTitle(externalLinkURL)
}
}

@ -570,15 +570,6 @@ class BrowserRobot {
tabCrashRestoreButton.click()
}
fun fillAndSubmitGoogleSearchQuery(searchString: String) {
mDevice.findObject(
UiSelector().resourceId("$packageName:id/engineView")
).waitForExists(waitingTime)
googleSearchBox.setText(searchString)
mDevice.pressEnter()
mDevice.waitForIdle(waitingTime)
}
fun fillAndSubmitLoginCredentials(userName: String, password: String) {
userNameTextBox.setText(userName)
passwordTextBox.setText(password)
@ -929,12 +920,3 @@ val passwordTextBox =
.className("android.widget.EditText")
.packageName("$packageName")
)
val googleSearchBox =
mDevice.findObject(
UiSelector()
.index(0)
.resourceId("mib")
.className("android.widget.EditText")
.packageName("$packageName")
)

@ -60,12 +60,17 @@ class CustomTabRobot {
}
fun verifyCustomTabToolbarTitle(title: String) {
waitForPageToLoad()
mDevice.waitForObjects(
mDevice.findObject(
UiSelector()
.resourceId("$packageName:id/mozac_browser_toolbar_title_view")
.textContains(title)
)
.getFromParent(
UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_origin_view")
)
)
assertTrue(

Loading…
Cancel
Save