2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-07 15:20:38 +00:00

For #26286 new verifyRemoveTopSiteFromMainMenu UI test

This commit is contained in:
AndiAJ 2022-08-04 09:36:51 +03:00 committed by mergify[bot]
parent 7e06d48bcb
commit 9a6d7f5bbd
2 changed files with 45 additions and 0 deletions

View File

@ -171,6 +171,30 @@ class TopSitesTest {
} }
} }
@Test
fun verifyRemoveTopSiteFromMainMenu() {
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
val defaultWebPageTitle = "Test_Page_1"
navigationToolbar {
}.enterURLAndEnterToBrowser(defaultWebPage.url) {
}.openThreeDotMenu {
expandMenu()
verifyAddToTopSitesButton()
}.addToFirefoxHome {
verifySnackBarText(getStringResource(R.string.snackbar_added_to_shortcuts))
}.goToHomescreen {
verifyExistingTopSitesList()
verifyExistingTopSitesTabs(defaultWebPageTitle)
}.openTopSiteTabWithTitle(defaultWebPageTitle) {
}.openThreeDotMenu {
verifyRemoveFromShortcutsButton()
}.clickRemoveFromShortcuts {
}.goToHomescreen {
verifyNotExistingTopSitesList(defaultWebPageTitle)
}
}
@Test @Test
fun verifyDefaultTopSitesLocale_EN() { fun verifyDefaultTopSitesLocale_EN() {
// en-US defaults // en-US defaults

View File

@ -71,6 +71,7 @@ class ThreeDotMenuMainRobot {
fun verifyFindInPageButton() = assertFindInPageButton() fun verifyFindInPageButton() = assertFindInPageButton()
fun verifyWhatsNewButton() = assertWhatsNewButton() fun verifyWhatsNewButton() = assertWhatsNewButton()
fun verifyAddToTopSitesButton() = assertAddToTopSitesButton() fun verifyAddToTopSitesButton() = assertAddToTopSitesButton()
fun verifyRemoveFromShortcutsButton() = assertRemoveFromShortcutsButton()
fun verifyAddToMobileHome() = assertAddToMobileHome() fun verifyAddToMobileHome() = assertAddToMobileHome()
fun verifyDesktopSite() = assertDesktopSite() fun verifyDesktopSite() = assertDesktopSite()
fun verifyDownloadsButton() = assertDownloadsButton() fun verifyDownloadsButton() = assertDownloadsButton()
@ -325,6 +326,13 @@ class ThreeDotMenuMainRobot {
return BrowserRobot.Transition() return BrowserRobot.Transition()
} }
fun clickRemoveFromShortcuts(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
removeFromShortcutsButton().click()
BrowserRobot().interact()
return BrowserRobot.Transition()
}
fun openAddToHomeScreen(interact: AddToHomeScreenRobot.() -> Unit): AddToHomeScreenRobot.Transition { fun openAddToHomeScreen(interact: AddToHomeScreenRobot.() -> Unit): AddToHomeScreenRobot.Transition {
mDevice.waitNotNull(Until.findObject(By.text("Add to Home screen")), waitingTime) mDevice.waitNotNull(Until.findObject(By.text("Add to Home screen")), waitingTime)
addToHomeScreenButton().click() addToHomeScreenButton().click()
@ -513,6 +521,9 @@ private fun assertReaderViewAppearanceButton(visible: Boolean) {
private fun addToTopSitesButton() = private fun addToTopSitesButton() =
onView(allOf(withText(R.string.browser_menu_add_to_shortcuts))) onView(allOf(withText(R.string.browser_menu_add_to_shortcuts)))
private fun removeFromShortcutsButton() =
onView(allOf(withText(R.string.browser_menu_remove_from_shortcuts)))
private fun assertAddToTopSitesButton() { private fun assertAddToTopSitesButton() {
onView(withId(R.id.mozac_browser_menu_recyclerView)) onView(withId(R.id.mozac_browser_menu_recyclerView))
.perform( .perform(
@ -522,6 +533,16 @@ private fun assertAddToTopSitesButton() {
).check(matches(withEffectiveVisibility(Visibility.VISIBLE))) ).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
} }
private fun assertRemoveFromShortcutsButton() {
onView(withId(R.id.mozac_browser_menu_recyclerView))
.perform(
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
hasDescendant(withText(R.string.browser_menu_settings))
)
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
}
private fun addToMobileHomeButton() = private fun addToMobileHomeButton() =
onView(allOf(withText(R.string.browser_menu_add_to_homescreen))) onView(allOf(withText(R.string.browser_menu_add_to_homescreen)))