From 28746c1ba7fb4cf1b0584da979cc652a33b08bbf Mon Sep 17 00:00:00 2001 From: AndiAJ Date: Thu, 1 Feb 2024 20:49:39 +0200 Subject: [PATCH] Bug 1877945 - Add pairs of test logs to FindInPageRobot --- .../mozilla/fenix/ui/robots/FindInPageRobot.kt | 17 ++++++++++++++++- 1 file changed, 16 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 1b43737ca..7f0789c22 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 @@ -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")