mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-09 19:10:42 +00:00
parent
91a9200fe3
commit
9e47d9e70d
@ -3,13 +3,13 @@ package org.mozilla.fenix.helpers
|
|||||||
import androidx.test.espresso.IdlingResource
|
import androidx.test.espresso.IdlingResource
|
||||||
import androidx.test.espresso.IdlingResource.ResourceCallback
|
import androidx.test.espresso.IdlingResource.ResourceCallback
|
||||||
|
|
||||||
class RecyclerViewIdlingResource constructor(private val recycler: androidx.recyclerview.widget.RecyclerView) :
|
class RecyclerViewIdlingResource constructor(private val recycler: androidx.recyclerview.widget.RecyclerView, val minItemCount: Int = 0) :
|
||||||
IdlingResource {
|
IdlingResource {
|
||||||
|
|
||||||
private var callback: ResourceCallback? = null
|
private var callback: ResourceCallback? = null
|
||||||
|
|
||||||
override fun isIdleNow(): Boolean {
|
override fun isIdleNow(): Boolean {
|
||||||
if (recycler.adapter != null && recycler.adapter!!.itemCount > 0) {
|
if (recycler.adapter != null && recycler.adapter!!.itemCount > minItemCount) {
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback!!.onTransitionToIdle()
|
callback!!.onTransitionToIdle()
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ class BookmarksTest {
|
|||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
}.openBookmarks {
|
}.openBookmarks {
|
||||||
bookmarksListIdlingResource =
|
bookmarksListIdlingResource =
|
||||||
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list))
|
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list), 1)
|
||||||
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
||||||
|
|
||||||
verifyBookmarkedURL(defaultWebPage.url.toString())
|
verifyBookmarkedURL(defaultWebPage.url.toString())
|
||||||
@ -121,21 +121,19 @@ class BookmarksTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore("Intermittent failures: https://github.com/mozilla-mobile/fenix/issues/10911")
|
|
||||||
@Test
|
@Test
|
||||||
fun createBookmarkFolderTest() {
|
fun createBookmarkFolderTest() {
|
||||||
homeScreen {
|
homeScreen {
|
||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
}.openBookmarks {
|
}.openBookmarks {
|
||||||
clickAddFolderButton()
|
|
||||||
verifyKeyboardVisible()
|
|
||||||
addNewFolderName(bookmarksFolderName)
|
|
||||||
saveNewFolder()
|
|
||||||
|
|
||||||
bookmarksListIdlingResource =
|
bookmarksListIdlingResource =
|
||||||
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list))
|
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list))
|
||||||
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
||||||
|
|
||||||
|
clickAddFolderButton()
|
||||||
|
verifyKeyboardVisible()
|
||||||
|
addNewFolderName(bookmarksFolderName)
|
||||||
|
saveNewFolder()
|
||||||
verifyFolderTitle(bookmarksFolderName)
|
verifyFolderTitle(bookmarksFolderName)
|
||||||
verifyKeyboardHidden()
|
verifyKeyboardHidden()
|
||||||
}
|
}
|
||||||
@ -163,7 +161,7 @@ class BookmarksTest {
|
|||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
}.openBookmarks {
|
}.openBookmarks {
|
||||||
bookmarksListIdlingResource =
|
bookmarksListIdlingResource =
|
||||||
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list))
|
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list), 1)
|
||||||
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
||||||
}.openThreeDotMenu(defaultWebPage.url) {
|
}.openThreeDotMenu(defaultWebPage.url) {
|
||||||
IdlingRegistry.getInstance().unregister(bookmarksListIdlingResource!!)
|
IdlingRegistry.getInstance().unregister(bookmarksListIdlingResource!!)
|
||||||
@ -193,7 +191,7 @@ class BookmarksTest {
|
|||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
}.openBookmarks {
|
}.openBookmarks {
|
||||||
bookmarksListIdlingResource =
|
bookmarksListIdlingResource =
|
||||||
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list))
|
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list), 1)
|
||||||
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
||||||
}.openThreeDotMenu(defaultWebPage.url) {
|
}.openThreeDotMenu(defaultWebPage.url) {
|
||||||
}.clickCopy {
|
}.clickCopy {
|
||||||
@ -210,7 +208,7 @@ class BookmarksTest {
|
|||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
}.openBookmarks {
|
}.openBookmarks {
|
||||||
bookmarksListIdlingResource =
|
bookmarksListIdlingResource =
|
||||||
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list))
|
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list), 1)
|
||||||
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
||||||
}.openThreeDotMenu(defaultWebPage.url) {
|
}.openThreeDotMenu(defaultWebPage.url) {
|
||||||
}.clickShare {
|
}.clickShare {
|
||||||
@ -230,7 +228,7 @@ class BookmarksTest {
|
|||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
}.openBookmarks {
|
}.openBookmarks {
|
||||||
bookmarksListIdlingResource =
|
bookmarksListIdlingResource =
|
||||||
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list))
|
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list), 1)
|
||||||
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
||||||
}.openThreeDotMenu(defaultWebPage.url) {
|
}.openThreeDotMenu(defaultWebPage.url) {
|
||||||
}.clickOpenInNewTab {
|
}.clickOpenInNewTab {
|
||||||
@ -249,7 +247,7 @@ class BookmarksTest {
|
|||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
}.openBookmarks {
|
}.openBookmarks {
|
||||||
bookmarksListIdlingResource =
|
bookmarksListIdlingResource =
|
||||||
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list))
|
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list), 1)
|
||||||
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
||||||
}.openThreeDotMenu(defaultWebPage.url) {
|
}.openThreeDotMenu(defaultWebPage.url) {
|
||||||
}.clickOpenInPrivateTab {
|
}.clickOpenInPrivateTab {
|
||||||
@ -268,9 +266,10 @@ class BookmarksTest {
|
|||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
}.openBookmarks {
|
}.openBookmarks {
|
||||||
bookmarksListIdlingResource =
|
bookmarksListIdlingResource =
|
||||||
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list))
|
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list), 1)
|
||||||
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
||||||
}.openThreeDotMenu(defaultWebPage.url) {
|
}.openThreeDotMenu(defaultWebPage.url) {
|
||||||
|
IdlingRegistry.getInstance().unregister(bookmarksListIdlingResource!!)
|
||||||
}.clickDelete {
|
}.clickDelete {
|
||||||
verifyDeleteSnackBarText()
|
verifyDeleteSnackBarText()
|
||||||
verifyUndoDeleteSnackBarButton()
|
verifyUndoDeleteSnackBarButton()
|
||||||
@ -306,7 +305,7 @@ class BookmarksTest {
|
|||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
}.openBookmarks {
|
}.openBookmarks {
|
||||||
bookmarksListIdlingResource =
|
bookmarksListIdlingResource =
|
||||||
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list))
|
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list), 1)
|
||||||
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
||||||
|
|
||||||
longTapSelectItem(defaultWebPage.url)
|
longTapSelectItem(defaultWebPage.url)
|
||||||
@ -336,7 +335,7 @@ class BookmarksTest {
|
|||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
}.openBookmarks {
|
}.openBookmarks {
|
||||||
bookmarksListIdlingResource =
|
bookmarksListIdlingResource =
|
||||||
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list))
|
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list), 1)
|
||||||
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
||||||
|
|
||||||
longTapSelectItem(defaultWebPage.url)
|
longTapSelectItem(defaultWebPage.url)
|
||||||
@ -359,7 +358,7 @@ class BookmarksTest {
|
|||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
}.openBookmarks {
|
}.openBookmarks {
|
||||||
bookmarksListIdlingResource =
|
bookmarksListIdlingResource =
|
||||||
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list))
|
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list), 1)
|
||||||
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
||||||
|
|
||||||
longTapSelectItem(defaultWebPage.url)
|
longTapSelectItem(defaultWebPage.url)
|
||||||
@ -384,11 +383,12 @@ class BookmarksTest {
|
|||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
}.openBookmarks {
|
}.openBookmarks {
|
||||||
bookmarksListIdlingResource =
|
bookmarksListIdlingResource =
|
||||||
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list))
|
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list), 1)
|
||||||
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
||||||
|
|
||||||
longTapSelectItem(firstWebPage.url)
|
longTapSelectItem(firstWebPage.url)
|
||||||
longTapSelectItem(secondWebPage.url)
|
longTapSelectItem(secondWebPage.url)
|
||||||
|
IdlingRegistry.getInstance().unregister(bookmarksListIdlingResource!!)
|
||||||
openActionBarOverflowOrOptionsMenu(activityTestRule.activity)
|
openActionBarOverflowOrOptionsMenu(activityTestRule.activity)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -410,7 +410,7 @@ class BookmarksTest {
|
|||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
}.openBookmarks {
|
}.openBookmarks {
|
||||||
bookmarksListIdlingResource =
|
bookmarksListIdlingResource =
|
||||||
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list))
|
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list), 1)
|
||||||
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
||||||
|
|
||||||
longTapSelectItem(defaultWebPage.url)
|
longTapSelectItem(defaultWebPage.url)
|
||||||
@ -466,7 +466,7 @@ class BookmarksTest {
|
|||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
}.openBookmarks {
|
}.openBookmarks {
|
||||||
bookmarksListIdlingResource =
|
bookmarksListIdlingResource =
|
||||||
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list))
|
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list), 1)
|
||||||
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!)
|
||||||
}.openThreeDotMenu(defaultWebPage.url) {
|
}.openThreeDotMenu(defaultWebPage.url) {
|
||||||
IdlingRegistry.getInstance().unregister(bookmarksListIdlingResource!!)
|
IdlingRegistry.getInstance().unregister(bookmarksListIdlingResource!!)
|
||||||
|
@ -35,6 +35,7 @@ import org.hamcrest.Matchers.containsString
|
|||||||
import org.junit.Assert.assertEquals
|
import org.junit.Assert.assertEquals
|
||||||
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.click
|
import org.mozilla.fenix.helpers.click
|
||||||
import org.mozilla.fenix.helpers.ext.waitNotNull
|
import org.mozilla.fenix.helpers.ext.waitNotNull
|
||||||
|
|
||||||
@ -52,10 +53,7 @@ class BookmarksRobot {
|
|||||||
fun verifyBookmarkedURL(url: String) = assertBookmarkURL(url)
|
fun verifyBookmarkedURL(url: String) = assertBookmarkURL(url)
|
||||||
|
|
||||||
fun verifyFolderTitle(title: String) {
|
fun verifyFolderTitle(title: String) {
|
||||||
mDevice.waitNotNull(
|
mDevice.findObject(UiSelector().text(title)).waitForExists(waitingTime)
|
||||||
Until.findObject(text(title)),
|
|
||||||
TestAssetHelper.waitingTime
|
|
||||||
)
|
|
||||||
assertFolderTitle(title)
|
assertFolderTitle(title)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ class ThreeDotMenuMainRobot {
|
|||||||
|
|
||||||
fun openBookmarks(interact: BookmarksRobot.() -> Unit): BookmarksRobot.Transition {
|
fun openBookmarks(interact: BookmarksRobot.() -> Unit): BookmarksRobot.Transition {
|
||||||
onView(withId(R.id.mozac_browser_menu_recyclerView)).perform(ViewActions.swipeDown())
|
onView(withId(R.id.mozac_browser_menu_recyclerView)).perform(ViewActions.swipeDown())
|
||||||
mDevice.waitNotNull(Until.findObject(By.text("Bookmarks")), waitingTime)
|
mDevice.findObject(UiSelector().resourceId("R.id.bookmark_list")).waitForExists(waitingTime)
|
||||||
bookmarksButton().click()
|
bookmarksButton().click()
|
||||||
|
|
||||||
BookmarksRobot().interact()
|
BookmarksRobot().interact()
|
||||||
|
Loading…
Reference in New Issue
Block a user