mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-03 23:15:31 +00:00
For #16615: UI Smoke Tests for Bookmarks
For #16615: UI Smoke Tests for Bookmarks
This commit is contained in:
parent
58cefbbb94
commit
eb910ff5e8
@ -395,7 +395,7 @@ class BookmarksTest {
|
||||
}
|
||||
|
||||
bookmarksMenu {
|
||||
verifyEmptyBookmarksList()
|
||||
verifyDeleteMultipleBookmarksSnackBar()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,7 @@ class SmokeTest {
|
||||
var url = "https://www.ecosia.org/search?q=%s"
|
||||
}
|
||||
val collectionName = "First Collection"
|
||||
private var bookmarksListIdlingResource: RecyclerViewIdlingResource? = null
|
||||
|
||||
// This finds the dialog fragment child of the homeFragment, otherwise the awesomeBar would return null
|
||||
private fun getAwesomebarView(): View? {
|
||||
@ -97,6 +98,10 @@ class SmokeTest {
|
||||
}
|
||||
|
||||
deleteDownloadFromStorage(downloadFileName)
|
||||
|
||||
if (bookmarksListIdlingResource != null) {
|
||||
IdlingRegistry.getInstance().unregister(bookmarksListIdlingResource!!)
|
||||
}
|
||||
}
|
||||
|
||||
// copied over from HomeScreenTest
|
||||
@ -951,4 +956,43 @@ class SmokeTest {
|
||||
verifyNoCollectionsText()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// Verifies that deleting a Bookmarks folder also removes the item from inside it.
|
||||
fun deleteNonEmptyBookmarkFolderTest() {
|
||||
val website = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
||||
|
||||
browserScreen {
|
||||
createBookmark(website.url)
|
||||
}.openThreeDotMenu {
|
||||
}.openBookmarks {
|
||||
bookmarksListIdlingResource =
|
||||
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list), 1)
|
||||
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
||||
verifyBookmarkTitle("Test_Page_1")
|
||||
createFolder("My Folder")
|
||||
verifyFolderTitle("My Folder")
|
||||
IdlingRegistry.getInstance().unregister(bookmarksListIdlingResource!!)
|
||||
}.openThreeDotMenu("Test_Page_1") {
|
||||
}.clickEdit {
|
||||
clickParentFolderSelector()
|
||||
selectFolder("My Folder")
|
||||
navigateUp()
|
||||
saveEditBookmark()
|
||||
}.openThreeDotMenu("My Folder") {
|
||||
}.clickDelete {
|
||||
cancelFolderDeletion()
|
||||
verifyFolderTitle("My Folder")
|
||||
}.openThreeDotMenu("My Folder") {
|
||||
}.clickDelete {
|
||||
confirmFolderDeletion()
|
||||
verifyDeleteSnackBarText()
|
||||
navigateUp()
|
||||
}
|
||||
|
||||
browserScreen {
|
||||
}.openThreeDotMenu {
|
||||
verifyBookmarksButton()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,12 +23,12 @@ import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withParent
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withText
|
||||
import androidx.test.uiautomator.By
|
||||
import androidx.test.uiautomator.Until
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.uiautomator.By
|
||||
import androidx.test.uiautomator.By.res
|
||||
import androidx.test.uiautomator.UiDevice
|
||||
import androidx.test.uiautomator.UiSelector
|
||||
import androidx.test.uiautomator.Until
|
||||
import org.hamcrest.Matchers.allOf
|
||||
import org.hamcrest.Matchers.containsString
|
||||
import org.junit.Assert.assertEquals
|
||||
@ -52,7 +52,7 @@ class BookmarksRobot {
|
||||
assertBookmarksView()
|
||||
}
|
||||
|
||||
fun verifyEmptyBookmarksList() = assertEmptyBookmarksList()
|
||||
fun verifyDeleteMultipleBookmarksSnackBar() = assertSnackBarText("Bookmarks deleted")
|
||||
|
||||
fun verifyBookmarkFavicon(forUrl: Uri) = assertBookmarkFavicon(forUrl)
|
||||
|
||||
@ -119,6 +119,13 @@ class BookmarksRobot {
|
||||
|
||||
fun verifyDeleteFolderConfirmationMessage() = assertDeleteFolderConfirmationMessage()
|
||||
|
||||
fun cancelFolderDeletion() {
|
||||
onView(withText("CANCEL"))
|
||||
.inRoot(RootMatchers.isDialog())
|
||||
.check(matches(isDisplayed()))
|
||||
.click()
|
||||
}
|
||||
|
||||
fun createFolder(name: String) {
|
||||
clickAddFolderButton()
|
||||
addNewFolderName(name)
|
||||
|
Loading…
Reference in New Issue
Block a user