From 54ea8f28fdb6f99515180b02d93ceabee87732a1 Mon Sep 17 00:00:00 2001 From: AndiAJ Date: Thu, 7 Nov 2024 15:24:00 +0000 Subject: [PATCH] Bug 1929837 - Improve running duration time for verifyCopyPDFTextOptionTest and verifyCopyTextOptionTest UI tests r=aaronmt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on the [[ https://storage.googleapis.com/mobile-allure-test-reports/Fenix/allure-report/index.html | Allure report ]] these UI tests had a 1m 30s running duration time. To improve the running times, I've removed some unnecessary steps from the UI test, reduced the waiting time in some cases and removed some unnecessary waits. Managed to improve the running durations as it follows: verifyCopyPDFTextOptionTest - From an average of 1m 34s to 41s (**running duration reduced by approx. 53s**) verifyCopyTextOptionTest - From an average of 1m 27s to 42s (**running duration reduced by approx. 45s**) Both UI tests successfully passed 100x on Firebase ✅ All UI tests successfully passed 2x on Firebase ✅ Differential Revision: https://phabricator.services.mozilla.com/D228307 --- .../java/org/mozilla/fenix/ui/TextSelectionTest.kt | 2 -- .../org/mozilla/fenix/ui/robots/BrowserRobot.kt | 2 +- .../org/mozilla/fenix/ui/robots/SearchRobot.kt | 14 ++++---------- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/TextSelectionTest.kt b/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/TextSelectionTest.kt index aca9eb2ecc74..f4cda34c62c4 100644 --- a/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/TextSelectionTest.kt +++ b/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/TextSelectionTest.kt @@ -71,7 +71,6 @@ class TextSelectionTest : TestSetup() { longClickPageObject(itemContainingText("content")) clickContextMenuItem("Copy") }.openNavigationToolbar { - openEditURLView() } searchScreen { @@ -170,7 +169,6 @@ class TextSelectionTest : TestSetup() { longClickPageObject(itemContainingText("Crossing")) clickContextMenuItem("Copy") }.openNavigationToolbar { - openEditURLView() } searchScreen { diff --git a/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt b/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt index d552809bf020..64000f24a512 100644 --- a/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt +++ b/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt @@ -1503,7 +1503,7 @@ fun longClickPageObject(item: UiObject) { fun clickContextMenuItem(item: String) { mDevice.waitNotNull( Until.findObject(text(item)), - waitingTime, + waitingTimeShort, ) Log.i(TAG, "clickContextMenuItem: Trying to click context menu item: $item") mDevice.findObject(text(item)).click() diff --git a/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SearchRobot.kt b/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SearchRobot.kt index 5f0157400c17..a6bfdcaf87e5 100644 --- a/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SearchRobot.kt +++ b/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SearchRobot.kt @@ -304,13 +304,6 @@ class SearchRobot { } fun longClickToolbar() { - Log.i(TAG, "longClickToolbar: Waiting for $waitingTime ms for $packageName window to be updated") - mDevice.waitForWindowUpdate(packageName, waitingTime) - Log.i(TAG, "longClickToolbar: Waited for $waitingTime ms for $packageName window to be updated") - Log.i(TAG, "longClickToolbar: Waiting for $waitingTime ms for the awesome bar to exist") - mDevice.findObject(UiSelector().resourceId("$packageName:id/awesomeBar")) - .waitForExists(waitingTime) - Log.i(TAG, "longClickToolbar: Waited for $waitingTime ms for the awesome bar to exist") Log.i(TAG, "longClickToolbar: Waiting for $waitingTime ms for the toolbar to exist") mDevice.findObject(UiSelector().resourceId("$packageName:id/toolbar")) .waitForExists(waitingTime) @@ -321,9 +314,9 @@ class SearchRobot { } fun clickPasteText() { - Log.i(TAG, "clickPasteText: Waiting for $waitingTime ms for the \"Paste\" option to exist") - mDevice.findObject(UiSelector().textContains("Paste")).waitForExists(waitingTime) - Log.i(TAG, "clickPasteText: Waited for $waitingTime ms for the \"Paste\" option to exist") + Log.i(TAG, "clickPasteText: Waiting for $waitingTimeShort ms for the \"Paste\" option to exist") + mDevice.findObject(UiSelector().textContains("Paste")).waitForExists(waitingTimeShort) + Log.i(TAG, "clickPasteText: Waited for $waitingTimeShort ms for the \"Paste\" option to exist") Log.i(TAG, "clickPasteText: Trying to click the \"Paste\" button") mDevice.findObject(By.textContains("Paste")).click() Log.i(TAG, "clickPasteText: Clicked the \"Paste\" button") @@ -336,6 +329,7 @@ class SearchRobot { assertUIObjectExists( itemWithResIdAndText("$packageName:id/mozac_browser_toolbar_edit_url_view", expectedText), exists = exists, + waitingTime = waitingTimeShort, ) fun verifySearchBarPosition(bottomPosition: Boolean) {