1
0
Fork 0

For #5534 - Make FIP Robot Wait for Text Changes

master
ekager 2019-09-30 11:29:29 -07:00 committed by Emily Kager
parent e9a0f1f65d
commit 7dab810ee6
1 changed files with 10 additions and 1 deletions

View File

@ -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)))