Skip to content

Commit

Permalink
For mozilla-mobile#1487 Add "my library" menu category and items to h…
Browse files Browse the repository at this point in the history
…ome 3-dot menu.

Changed tests according to new menu items.
  • Loading branch information
mcarare committed Oct 29, 2019
1 parent cba42a9 commit 67dc2d8
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,34 @@ class ThreeDotMenuMainTest {
homeScreen {
}.openThreeDotMenu {
verifySettingsButton()
verifyLibraryButton()
verifyBookmarksButton()
verifyHistoryButton()
verifyHelpButton()
verifyWhatsNewButton()
}.openSettings {
verifySettingsView()
}.goBack {
}.openThreeDotMenu {
}.openLibrary {
verifyLibraryView()
}.goBack {
}.openThreeDotMenu {
}.openHelp {
verifyHelpUrl()
}.openHomeScreen {
}.openThreeDotMenu {
}.openWhatsNew {
verifyWhatsNewURL()
}.openHomeScreen {
}

homeScreen {
}.openThreeDotMenu {
}.openBookmarks {
verifyBookmarksMenuView()
}.goBack {
}

homeScreen {
}.openThreeDotMenu {
}.openHistory {
verifyHistoryMenuView()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import org.mozilla.fenix.share.ShareFragment
class ThreeDotMenuMainRobot {
fun verifySettingsButton() = assertSettingsButton()
fun verifyLibraryButton() = assertLibraryButton()
fun verifyHistoryButton() = assertHistoryButton()
fun verifyBookmarksButton() = assertBookmarksButton()
fun verifyHelpButton() = assertHelpButton()
fun verifyThreeDotMenuExists() = threeDotMenuRecyclerViewExists()
fun verifyForwardButton() = assertForwardButton()
Expand Down Expand Up @@ -80,6 +82,22 @@ class ThreeDotMenuMainRobot {
return LibraryRobot.Transition()
}

fun openBookmarks(interact: BookmarksRobot.() -> Unit): BookmarksRobot.Transition {
mDevice.waitNotNull(Until.findObject(By.text("Bookmarks")), waitingTime)
bookmarksButton().click()

BookmarksRobot().interact()
return BookmarksRobot.Transition()
}

fun openHistory(interact: HistoryRobot.() -> Unit): BookmarksRobot.Transition {
mDevice.waitNotNull(Until.findObject(By.text("History")), waitingTime)
historyButton().click()

HistoryRobot().interact()
return BookmarksRobot.Transition()
}

fun openHelp(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
mDevice.waitNotNull(Until.findObject(By.text("Help")), waitingTime)
helpButton().click()
Expand Down Expand Up @@ -160,6 +178,14 @@ private fun libraryButton() = onView(allOf(withText(R.string.browser_menu_your_l
private fun assertLibraryButton() = libraryButton()
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))

private fun historyButton() = onView(allOf(withText(R.string.library_history)))
private fun assertHistoryButton() = historyButton()
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))

private fun bookmarksButton() = onView(allOf(withText(R.string.library_bookmarks)))
private fun assertBookmarksButton() = bookmarksButton()
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))

private fun helpButton() = onView(allOf(withText(R.string.browser_menu_help)))
private fun assertHelpButton() = helpButton()
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
Expand Down

0 comments on commit 67dc2d8

Please sign in to comment.