mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-17 15:26:23 +00:00
[fenix] For https://github.com/mozilla-mobile/fenix/issues/16615: UI smoke test mainMenuInstallPWATest
This commit is contained in:
parent
675ac17056
commit
d193e6a919
@ -5,6 +5,7 @@
|
|||||||
package org.mozilla.fenix.ui
|
package org.mozilla.fenix.ui
|
||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import androidx.core.net.toUri
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import androidx.test.espresso.IdlingRegistry
|
import androidx.test.espresso.IdlingRegistry
|
||||||
import androidx.test.platform.app.InstrumentationRegistry
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
@ -63,6 +64,7 @@ class SmokeTest {
|
|||||||
|
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val activityTestRule = HomeActivityTestRule()
|
val activityTestRule = HomeActivityTestRule()
|
||||||
|
|
||||||
@get:Rule
|
@get:Rule
|
||||||
var mGrantPermissions = GrantPermissionRule.grant(
|
var mGrantPermissions = GrantPermissionRule.grant(
|
||||||
android.Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
android.Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||||
@ -1099,4 +1101,20 @@ class SmokeTest {
|
|||||||
}.openHomeScreenShortcut("Private Firefox Preview") {
|
}.openHomeScreenShortcut("Private Firefox Preview") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun mainMenuInstallPWATest() {
|
||||||
|
val pwaPage = "https://rpappalax.github.io/testapp/"
|
||||||
|
|
||||||
|
navigationToolbar {
|
||||||
|
}.enterURLAndEnterToBrowser(pwaPage.toUri()) {
|
||||||
|
verifyNotificationDotOnMainMenu()
|
||||||
|
}.openThreeDotMenu {
|
||||||
|
}.clickInstall {
|
||||||
|
clickAddAutomaticallyButton()
|
||||||
|
}.openHomeScreenShortcut("yay app") {
|
||||||
|
mDevice.waitForIdle()
|
||||||
|
verifyNavURLBarHidden()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,6 +152,8 @@ class BrowserRobot {
|
|||||||
|
|
||||||
fun verifyNavURLBar() = assertNavURLBar()
|
fun verifyNavURLBar() = assertNavURLBar()
|
||||||
|
|
||||||
|
fun verifyNavURLBarHidden() = assertNavURLBarHidden()
|
||||||
|
|
||||||
fun verifySecureConnectionLockIcon() = assertSecureConnectionLockIcon()
|
fun verifySecureConnectionLockIcon() = assertSecureConnectionLockIcon()
|
||||||
|
|
||||||
fun verifyEnhancedTrackingProtectionSwitch() = assertEnhancedTrackingProtectionSwitch()
|
fun verifyEnhancedTrackingProtectionSwitch() = assertEnhancedTrackingProtectionSwitch()
|
||||||
@ -192,6 +194,13 @@ class BrowserRobot {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun verifyNotificationDotOnMainMenu() {
|
||||||
|
assertTrue(
|
||||||
|
mDevice.findObject(UiSelector().resourceId("$packageName:id/notification_dot"))
|
||||||
|
.waitForExists(waitingTime)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
fun dismissContentContextMenu(containsURL: Uri) {
|
fun dismissContentContextMenu(containsURL: Uri) {
|
||||||
onView(withText(containsURL.toString()))
|
onView(withText(containsURL.toString()))
|
||||||
.inRoot(isDialog())
|
.inRoot(isDialog())
|
||||||
@ -471,11 +480,14 @@ fun dismissTrackingOnboarding() {
|
|||||||
dismissOnboardingButton().click()
|
dismissOnboardingButton().click()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun navURLBar() = onView(withId(R.id.mozac_browser_toolbar_url_view))
|
fun navURLBar() = onView(withId(R.id.toolbar))
|
||||||
|
|
||||||
private fun assertNavURLBar() = navURLBar()
|
private fun assertNavURLBar() = navURLBar()
|
||||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||||
|
|
||||||
|
private fun assertNavURLBarHidden() = navURLBar()
|
||||||
|
.check(matches(not(isDisplayed())))
|
||||||
|
|
||||||
fun enhancedTrackingProtectionIndicator() =
|
fun enhancedTrackingProtectionIndicator() =
|
||||||
onView(withId(R.id.mozac_browser_toolbar_tracking_protection_indicator))
|
onView(withId(R.id.mozac_browser_toolbar_tracking_protection_indicator))
|
||||||
|
|
||||||
|
@ -347,6 +347,13 @@ class ThreeDotMenuMainRobot {
|
|||||||
return AddToHomeScreenRobot.Transition()
|
return AddToHomeScreenRobot.Transition()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun clickInstall(interact: AddToHomeScreenRobot.() -> Unit): AddToHomeScreenRobot.Transition {
|
||||||
|
installPWAButton().click()
|
||||||
|
|
||||||
|
AddToHomeScreenRobot().interact()
|
||||||
|
return AddToHomeScreenRobot.Transition()
|
||||||
|
}
|
||||||
|
|
||||||
fun selectExistingCollection(title: String, interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
fun selectExistingCollection(title: String, interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
||||||
mDevice.waitNotNull(Until.findObject(By.text(title)), waitingTime)
|
mDevice.waitNotNull(Until.findObject(By.text(title)), waitingTime)
|
||||||
onView(withText(title)).click()
|
onView(withText(title)).click()
|
||||||
@ -536,6 +543,8 @@ private fun assertAddToMobileHome() {
|
|||||||
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun installPWAButton() = onView(allOf(withId(R.id.highlight_text), withText("Install")))
|
||||||
|
|
||||||
private fun desktopSiteButton() =
|
private fun desktopSiteButton() =
|
||||||
onView(allOf(withText(R.string.browser_menu_desktop_site)))
|
onView(allOf(withText(R.string.browser_menu_desktop_site)))
|
||||||
private fun assertDesktopSite() {
|
private fun assertDesktopSite() {
|
||||||
|
Loading…
Reference in New Issue
Block a user