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:
parent
7e06d48bcb
commit
9a6d7f5bbd
@ -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
|
||||
fun verifyDefaultTopSitesLocale_EN() {
|
||||
// en-US defaults
|
||||
|
@ -71,6 +71,7 @@ class ThreeDotMenuMainRobot {
|
||||
fun verifyFindInPageButton() = assertFindInPageButton()
|
||||
fun verifyWhatsNewButton() = assertWhatsNewButton()
|
||||
fun verifyAddToTopSitesButton() = assertAddToTopSitesButton()
|
||||
fun verifyRemoveFromShortcutsButton() = assertRemoveFromShortcutsButton()
|
||||
fun verifyAddToMobileHome() = assertAddToMobileHome()
|
||||
fun verifyDesktopSite() = assertDesktopSite()
|
||||
fun verifyDownloadsButton() = assertDownloadsButton()
|
||||
@ -325,6 +326,13 @@ class ThreeDotMenuMainRobot {
|
||||
return BrowserRobot.Transition()
|
||||
}
|
||||
|
||||
fun clickRemoveFromShortcuts(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
||||
removeFromShortcutsButton().click()
|
||||
|
||||
BrowserRobot().interact()
|
||||
return BrowserRobot.Transition()
|
||||
}
|
||||
|
||||
fun openAddToHomeScreen(interact: AddToHomeScreenRobot.() -> Unit): AddToHomeScreenRobot.Transition {
|
||||
mDevice.waitNotNull(Until.findObject(By.text("Add to Home screen")), waitingTime)
|
||||
addToHomeScreenButton().click()
|
||||
@ -513,6 +521,9 @@ private fun assertReaderViewAppearanceButton(visible: Boolean) {
|
||||
private fun addToTopSitesButton() =
|
||||
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() {
|
||||
onView(withId(R.id.mozac_browser_menu_recyclerView))
|
||||
.perform(
|
||||
@ -522,6 +533,16 @@ private fun assertAddToTopSitesButton() {
|
||||
).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() =
|
||||
onView(allOf(withText(R.string.browser_menu_add_to_homescreen)))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user