[fenix] Improve coverage for cancelCreateBookmarkFolderTest UI test

pull/600/head
AndiAJ 3 years ago committed by mergify[bot]
parent 66862fa992
commit 867f11e5d9

@ -166,6 +166,7 @@ class BookmarksTest {
addNewFolderName(bookmarksFolderName) addNewFolderName(bookmarksFolderName)
navigateUp() navigateUp()
verifyKeyboardHidden() verifyKeyboardHidden()
verifyBookmarkFolderIsNotCreated(bookmarksFolderName)
} }
} }

@ -32,6 +32,7 @@ import androidx.test.uiautomator.Until
import org.hamcrest.Matchers.allOf import org.hamcrest.Matchers.allOf
import org.hamcrest.Matchers.containsString import org.hamcrest.Matchers.containsString
import org.junit.Assert.assertEquals import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.helpers.TestAssetHelper import org.mozilla.fenix.helpers.TestAssetHelper
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime
@ -67,6 +68,8 @@ class BookmarksRobot {
assertFolderTitle(title) assertFolderTitle(title)
} }
fun verifyBookmarkFolderIsNotCreated(title: String) = assertBookmarkFolderIsNotCreated(title)
fun verifyBookmarkTitle(title: String) { fun verifyBookmarkTitle(title: String) {
mDevice.findObject(UiSelector().text(title)).waitForExists(waitingTime) mDevice.findObject(UiSelector().text(title)).waitForExists(waitingTime)
assertBookmarkTitle(title) assertBookmarkTitle(title)
@ -318,6 +321,20 @@ private fun assertCloseButton() = closeButton().check(matches(withEffectiveVisib
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")))
private fun assertBookmarkFolderIsNotCreated(title: String) {
mDevice.findObject(
UiSelector()
.resourceId("$packageName:id/bookmarks_wrapper")
).waitForExists(waitingTime)
assertFalse(
mDevice.findObject(
UiSelector()
.textContains(title)
).waitForExists(waitingTime)
)
}
private fun assertBookmarkFavicon(forUrl: Uri) = bookmarkFavicon(forUrl.toString()).check( private fun assertBookmarkFavicon(forUrl: Uri) = bookmarkFavicon(forUrl.toString()).check(
matches( matches(
withEffectiveVisibility( withEffectiveVisibility(

Loading…
Cancel
Save