2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-17 15:26:23 +00:00

[fenix] Improve coverage verifyEmptyBookmarksMenuTest and undoDeleteMultipleSelectionTest UI tests

This commit is contained in:
AndiAJ 2021-09-22 11:26:42 +03:00 committed by mergify[bot]
parent 8976e193d9
commit cc65e13b50
2 changed files with 60 additions and 0 deletions

View File

@ -68,6 +68,25 @@ class BookmarksTest {
} }
} }
@Test
fun verifyEmptyBookmarksMenuTest() {
homeScreen {
}.openThreeDotMenu {
}.openBookmarks {
bookmarksListIdlingResource =
RecyclerViewIdlingResource(
activityTestRule.activity.findViewById(R.id.bookmark_list),
1
)
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
verifyBookmarksMenuView()
verifyAddFolderButton()
verifyCloseButton()
verifyBookmarkTitle("Desktop Bookmarks")
}
}
@Test @Test
fun defaultDesktopBookmarksFoldersTest() { fun defaultDesktopBookmarksFoldersTest() {
homeScreen { homeScreen {
@ -403,6 +422,38 @@ class BookmarksTest {
} }
} }
@Test
fun undoDeleteMultipleSelectionTest() {
val firstWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
val secondWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 2)
browserScreen {
createBookmark(firstWebPage.url)
createBookmark(secondWebPage.url)
}.openThreeDotMenu {
}.openBookmarks {
bookmarksListIdlingResource =
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list), 3)
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
longTapSelectItem(firstWebPage.url)
longTapSelectItem(secondWebPage.url)
IdlingRegistry.getInstance().unregister(bookmarksListIdlingResource!!)
openActionBarOverflowOrOptionsMenu(activityTestRule.activity)
}
multipleSelectionToolbar {
clickMultiSelectionDelete()
}
bookmarksMenu {
verifyDeleteMultipleBookmarksSnackBar()
clickUndoDeleteButton()
verifyBookmarkedURL(firstWebPage.url.toString())
verifyBookmarkedURL(secondWebPage.url.toString())
}
}
@Test @Test
fun multipleSelectionShareButtonTest() { fun multipleSelectionShareButtonTest() {
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)

View File

@ -52,6 +52,10 @@ class BookmarksRobot {
assertBookmarksView() assertBookmarksView()
} }
fun verifyAddFolderButton() = assertAddFolderButton()
fun verifyCloseButton() = assertCloseButton()
fun verifyDeleteMultipleBookmarksSnackBar() = assertSnackBarText("Bookmarks deleted") fun verifyDeleteMultipleBookmarksSnackBar() = assertSnackBarText("Bookmarks deleted")
fun verifyBookmarkFavicon(forUrl: Uri) = assertBookmarkFavicon(forUrl) fun verifyBookmarkFavicon(forUrl: Uri) = assertBookmarkFavicon(forUrl)
@ -306,6 +310,11 @@ private fun assertBookmarksView() {
.check(matches(isDisplayed())) .check(matches(isDisplayed()))
} }
private fun assertAddFolderButton() =
addFolderButton().check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
private fun assertCloseButton() = closeButton().check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
private fun assertEmptyBookmarksList() = private fun assertEmptyBookmarksList() =
onView(withId(R.id.bookmarks_empty_view)).check(matches(withText("No bookmarks here"))) onView(withId(R.id.bookmarks_empty_view)).check(matches(withText("No bookmarks here")))