mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-15 18:12:54 +00:00
Bug 1877945 - Add pairs of test logs to FindInPageRobot
This commit is contained in:
parent
c8934beca1
commit
28746c1ba7
@ -28,48 +28,59 @@ import org.mozilla.fenix.helpers.ext.waitNotNull
|
||||
*/
|
||||
class FindInPageRobot {
|
||||
fun verifyFindInPageNextButton() {
|
||||
Log.i(TAG, "verifyFindInPageNextButton: Trying to verify find in page next result button is visible")
|
||||
findInPageNextButton()
|
||||
.check(matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||
Log.i(TAG, "verifyFindInPageNextButton: Verified find in page next result button is visible")
|
||||
}
|
||||
fun verifyFindInPagePrevButton() {
|
||||
Log.i(TAG, "verifyFindInPagePrevButton: Trying to verify find in page previous result button is visible")
|
||||
findInPagePrevButton()
|
||||
.check(matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||
Log.i(TAG, "verifyFindInPagePrevButton: Verified find in page previous result button is visible")
|
||||
}
|
||||
fun verifyFindInPageCloseButton() {
|
||||
Log.i(TAG, "verifyFindInPageCloseButton: Trying to verify find in page close button is visible")
|
||||
findInPageCloseButton()
|
||||
.check(matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||
Log.i(TAG, "verifyFindInPageCloseButton: Verified find in page close button is visible")
|
||||
}
|
||||
fun clickFindInPageNextButton() {
|
||||
Log.i(TAG, "clickFindInPageNextButton: Trying to click next result button")
|
||||
findInPageNextButton().click()
|
||||
Log.i(TAG, "clickFindInPageNextButton: Clicked next result button")
|
||||
}
|
||||
fun clickFindInPagePrevButton() {
|
||||
Log.i(TAG, "clickFindInPagePrevButton: Trying to click previous result button")
|
||||
findInPagePrevButton().click()
|
||||
Log.i(TAG, "clickFindInPagePrevButton: Clicked previous result button")
|
||||
}
|
||||
|
||||
fun enterFindInPageQuery(expectedText: String) {
|
||||
mDevice.waitNotNull(Until.findObject(By.res("org.mozilla.fenix.debug:id/find_in_page_query_text")), waitingTime)
|
||||
Log.i(TAG, "enterFindInPageQuery: Trying to clear find in page bar text")
|
||||
findInPageQuery().perform(clearText())
|
||||
Log.i(TAG, "enterFindInPageQuery: Cleared find in page bar text")
|
||||
mDevice.waitNotNull(Until.gone(By.res("org.mozilla.fenix.debug:id/find_in_page_result_text")), waitingTime)
|
||||
Log.i(TAG, "enterFindInPageQuery: Trying to type $expectedText in find in page bar")
|
||||
findInPageQuery().perform(typeText(expectedText))
|
||||
Log.i(TAG, "enterFindInPageQuery: Typed $expectedText to find in page bar")
|
||||
Log.i(TAG, "enterFindInPageQuery: Typed $expectedText in find page bar")
|
||||
mDevice.waitNotNull(Until.findObject(By.res("org.mozilla.fenix.debug:id/find_in_page_result_text")), waitingTime)
|
||||
}
|
||||
|
||||
fun verifyFindInPageResult(ratioCounter: String) {
|
||||
mDevice.waitNotNull(Until.findObject(By.text(ratioCounter)), waitingTime)
|
||||
Log.i(TAG, "verifyFindInPageResult: Trying to verify $ratioCounter results")
|
||||
findInPageResult().check(matches(withText((ratioCounter))))
|
||||
Log.i(TAG, "verifyFindInPageResult: Verified $ratioCounter results")
|
||||
}
|
||||
|
||||
class Transition {
|
||||
fun closeFindInPageWithCloseButton(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
||||
Log.i(TAG, "closeFindInPageWithCloseButton: Waiting for device to be idle")
|
||||
mDevice.waitForIdle()
|
||||
Log.i(TAG, "closeFindInPageWithCloseButton: Device was idle")
|
||||
Log.i(TAG, "closeFindInPageWithCloseButton: Trying to close find in page button")
|
||||
findInPageCloseButton().click()
|
||||
Log.i(TAG, "closeFindInPageWithCloseButton: Clicked close find in page button")
|
||||
BrowserRobot().interact()
|
||||
@ -77,11 +88,15 @@ class FindInPageRobot {
|
||||
}
|
||||
|
||||
fun closeFindInPageWithBackButton(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
||||
Log.i(TAG, "closeFindInPageWithBackButton: Waiting for device to be idle")
|
||||
mDevice.waitForIdle()
|
||||
Log.i(TAG, "closeFindInPageWithBackButton: Device was idle")
|
||||
|
||||
// Will need to press back 2x, the first will only dismiss the keyboard
|
||||
Log.i(TAG, "closeFindInPageWithBackButton: Trying to press 1x the device back button")
|
||||
mDevice.pressBack()
|
||||
Log.i(TAG, "closeFindInPageWithBackButton: Pressed 1x the device back button")
|
||||
Log.i(TAG, "closeFindInPageWithBackButton: Trying to press 2x the device back button")
|
||||
mDevice.pressBack()
|
||||
Log.i(TAG, "closeFindInPageWithBackButton: Pressed 2x the device back button")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user