From f0363a27bb10cb83945e5efea5f861064978585b Mon Sep 17 00:00:00 2001 From: AndiAJ Date: Thu, 22 Feb 2024 18:18:03 +0200 Subject: [PATCH] Bug 1881349 - Fix failing Fenix UI tests --- .../java/org/mozilla/fenix/ui/robots/SearchRobot.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SearchRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SearchRobot.kt index 04f0c420dd..9186d141ef 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SearchRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SearchRobot.kt @@ -27,6 +27,7 @@ import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.uiautomator.By +import androidx.test.uiautomator.UiScrollable import androidx.test.uiautomator.UiSelector import org.hamcrest.CoreMatchers.allOf import org.junit.Assert.assertTrue @@ -295,9 +296,11 @@ class SearchRobot { } fun tapOutsideToDismissSearchBar() { - Log.i(TAG, "tapOutsideToDismissSearchBar: Trying to click the search wrapper") - itemWithResId("$packageName:id/search_wrapper").click() - Log.i(TAG, "tapOutsideToDismissSearchBar: Clicked the search wrapper") + Log.i(TAG, "tapOutsideToDismissSearchBar: Trying to perform a backward scroll action") + // After updating UIAutomator to 2.3.0 the click action doesn't seem to dismiss anymore the awesome bar + // On the other hand, the scroll action seems to be working properly and dismisses the awesome bar + UiScrollable(UiSelector().resourceId("$packageName:id/search_wrapper")).scrollBackward() + Log.i(TAG, "tapOutsideToDismissSearchBar: Performed a backward scroll action") Log.i(TAG, "tapOutsideToDismissSearchBar: Waiting for $waitingTime ms for the edit mode toolbar to be gone") browserToolbarEditView().waitUntilGone(waitingTime) Log.i(TAG, "tapOutsideToDismissSearchBar: Waited for $waitingTime ms for the edit mode toolbar to be gone")