From 7dab810ee638f9a5fd900fd0a4d68f5491c6b4a8 Mon Sep 17 00:00:00 2001 From: ekager Date: Mon, 30 Sep 2019 11:29:29 -0700 Subject: [PATCH] For #5534 - Make FIP Robot Wait for Text Changes --- .../org/mozilla/fenix/ui/robots/FindInPageRobot.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/FindInPageRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/FindInPageRobot.kt index b0bb38fc6..8d12bce37 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/FindInPageRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/FindInPageRobot.kt @@ -34,19 +34,26 @@ class FindInPageRobot { fun enterFindInPageQuery(expectedText: String) { mDevice.wait(Until.findObject(By.res("find_in_page_query_text")), waitingTime) - findInPageQuery().perform(clearText(), typeText(expectedText)) + findInPageQuery().perform(clearText()) + mDevice.wait(Until.gone(By.res("find_in_page_result_text")), waitingTime) + findInPageQuery().perform(typeText(expectedText)) + mDevice.wait(Until.findObject(By.res("find_in_page_result_text")), waitingTime) } fun verifyFindNextInPageResult(ratioCounter: String) { mDevice.wait(Until.findObject(By.text(ratioCounter)), waitingTime) + val element = mDevice.findObject(By.text(ratioCounter)) findInPageResult().check(matches(withText((ratioCounter)))) findInPageNextButton().click() + element.wait(Until.textNotEquals(ratioCounter), waitingTime) } fun verifyFindPrevInPageResult(ratioCounter: String) { mDevice.wait(Until.findObject(By.text(ratioCounter)), waitingTime) + val element = mDevice.findObject(By.text(ratioCounter)) findInPageResult().check(matches(withText((ratioCounter)))) findInPagePrevButton().click() + element.wait(Until.textNotEquals(ratioCounter), waitingTime) } class Transition { @@ -67,7 +74,9 @@ private fun findInPageCloseButton() = onView(withId(R.id.find_in_page_close_btn) private fun assertFindInPageNextButton() = findInPageNextButton() .check(matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) + private fun assertFindInPagePrevButton() = findInPagePrevButton() .check(matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) + private fun assertFindInPageCloseButton() = findInPageCloseButton() .check(matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))