Commit 4ff26354 authored by Oana Horvath's avatar Oana Horvath
Browse files

For #13446 UI tests: wait for historyList to exist

parent e61e5b80
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ class HistoryTest {
            mDevice.waitForIdle()
        }.openThreeDotMenu {
        }.openHistory {
            verifyHistoryListExists()
            historyListIdlingResource =
                RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.history_list))
            IdlingRegistry.getInstance().register(historyListIdlingResource!!)
@@ -101,6 +102,7 @@ class HistoryTest {
            mDevice.waitForIdle()
        }.openThreeDotMenu {
        }.openHistory {
            verifyHistoryListExists()
            historyListIdlingResource =
                RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.history_list))
            IdlingRegistry.getInstance().register(historyListIdlingResource!!)
@@ -119,6 +121,7 @@ class HistoryTest {
            mDevice.waitForIdle()
        }.openThreeDotMenu {
        }.openHistory {
            verifyHistoryListExists()
            historyListIdlingResource =
                RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.history_list))
            IdlingRegistry.getInstance().register(historyListIdlingResource!!)
@@ -140,6 +143,7 @@ class HistoryTest {
            mDevice.waitForIdle()
        }.openThreeDotMenu {
        }.openHistory {
            verifyHistoryListExists()
            historyListIdlingResource =
                RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.history_list))
            IdlingRegistry.getInstance().register(historyListIdlingResource!!)
@@ -160,6 +164,7 @@ class HistoryTest {
            mDevice.waitForIdle()
        }.openThreeDotMenu {
        }.openHistory {
            verifyHistoryListExists()
            historyListIdlingResource =
                RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.history_list))
            IdlingRegistry.getInstance().register(historyListIdlingResource!!)
@@ -180,6 +185,7 @@ class HistoryTest {
            mDevice.waitForIdle()
        }.openThreeDotMenu {
        }.openHistory {
            verifyHistoryListExists()
            historyListIdlingResource =
                RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.history_list))
            IdlingRegistry.getInstance().register(historyListIdlingResource!!)
@@ -200,6 +206,7 @@ class HistoryTest {
            mDevice.waitForIdle()
        }.openThreeDotMenu {
        }.openHistory {
            verifyHistoryListExists()
            historyListIdlingResource =
                RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.history_list))
            IdlingRegistry.getInstance().register(historyListIdlingResource!!)
@@ -221,6 +228,7 @@ class HistoryTest {
            mDevice.waitForIdle()
        }.openThreeDotMenu {
        }.openHistory {
            verifyHistoryListExists()
            historyListIdlingResource =
                RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.history_list))
            IdlingRegistry.getInstance().register(historyListIdlingResource!!)
@@ -250,6 +258,7 @@ class HistoryTest {

        homeScreen { }.openThreeDotMenu {
        }.openHistory {
            verifyHistoryListExists()
            historyListIdlingResource =
                RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.history_list))
            IdlingRegistry.getInstance().register(historyListIdlingResource!!)
@@ -273,6 +282,7 @@ class HistoryTest {
            mDevice.waitForIdle()
        }.openThreeDotMenu {
        }.openHistory {
            verifyHistoryListExists()
            historyListIdlingResource =
                RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.history_list))
            IdlingRegistry.getInstance().register(historyListIdlingResource!!)
@@ -299,6 +309,7 @@ class HistoryTest {
        }.submitQuery(secondWebPage.url.toString()) {
        }.openThreeDotMenu {
        }.openHistory {
            verifyHistoryListExists()
            historyListIdlingResource =
                RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.history_list), 1)
            IdlingRegistry.getInstance().register(historyListIdlingResource!!)
@@ -326,6 +337,7 @@ class HistoryTest {
            mDevice.waitForIdle()
        }.openThreeDotMenu {
        }.openHistory {
            verifyHistoryListExists()
            historyListIdlingResource =
                RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.history_list))
            IdlingRegistry.getInstance().register(historyListIdlingResource!!)
+5 −0
Original line number Diff line number Diff line
@@ -39,6 +39,8 @@ class HistoryRobot {
        assertEmptyHistoryView()
    }

    fun verifyHistoryListExists() = assertHistoryListExists()

    fun verifyVisitedTimeTitle() {
        mDevice.waitNotNull(
            Until.findObject(
@@ -131,6 +133,9 @@ private fun assertEmptyHistoryView() =
    )
        .check(matches(withText("No history here")))

private fun assertHistoryListExists() =
    mDevice.findObject(UiSelector().resourceId("R.id.history_list")).waitForExists(waitingTime)

private fun assertVisitedTimeTitle() =
    onView(withId(R.id.header_title)).check(matches(withText("Today")))