From e977e0292a3ca09ca4e2ba337ca1b035f80e3aa7 Mon Sep 17 00:00:00 2001 From: AndiAJ Date: Thu, 2 Jun 2022 17:39:41 +0300 Subject: [PATCH] For #25125 fix flaky downloadMultipleFileTypesTest UI test --- .../java/org/mozilla/fenix/helpers/TestAssetHelper.kt | 2 +- .../java/org/mozilla/fenix/ui/DownloadFileTypesTest.kt | 5 ----- .../java/org/mozilla/fenix/ui/robots/DownloadRobot.kt | 5 +++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/src/androidTest/java/org/mozilla/fenix/helpers/TestAssetHelper.kt b/app/src/androidTest/java/org/mozilla/fenix/helpers/TestAssetHelper.kt index 1b60d89b82..cf9aaf27f3 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/helpers/TestAssetHelper.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/helpers/TestAssetHelper.kt @@ -5,9 +5,9 @@ package org.mozilla.fenix.helpers import android.net.Uri -import java.util.concurrent.TimeUnit import okhttp3.mockwebserver.MockWebServer import org.mozilla.fenix.helpers.ext.toUri +import java.util.concurrent.TimeUnit /** * Helper for hosting web pages locally for testing purposes. diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/DownloadFileTypesTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/DownloadFileTypesTest.kt index dcb05d64ae..99cd4479ff 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/DownloadFileTypesTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/DownloadFileTypesTest.kt @@ -14,7 +14,6 @@ import org.junit.runners.Parameterized import org.mozilla.fenix.customannotations.SmokeTest import org.mozilla.fenix.helpers.FeatureSettingsHelper import org.mozilla.fenix.helpers.HomeActivityIntentTestRule -import org.mozilla.fenix.helpers.RetryTestRule import org.mozilla.fenix.ui.robots.navigationToolbar /** @@ -33,10 +32,6 @@ class DownloadFileTypesTest(fileName: String) { @get:Rule val activityTestRule = HomeActivityIntentTestRule() - @Rule - @JvmField - val retryTestRule = RetryTestRule(3) - companion object { // Creating test data. The test will take each file name as a parameter and run it individually. @JvmStatic diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/DownloadRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/DownloadRobot.kt index e7962b8f24..5dcbda43a2 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/DownloadRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/DownloadRobot.kt @@ -27,6 +27,7 @@ import org.junit.Assert.assertTrue import org.mozilla.fenix.R import org.mozilla.fenix.helpers.Constants.PackageName.GOOGLE_APPS_PHOTOS import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime +import org.mozilla.fenix.helpers.TestAssetHelper.waitingTimeLong import org.mozilla.fenix.helpers.TestHelper import org.mozilla.fenix.helpers.TestHelper.assertExternalAppOpens import org.mozilla.fenix.helpers.TestHelper.packageName @@ -140,12 +141,12 @@ private fun assertDownloadPrompt(fileName: String) { assertTrue( "Download prompt button not visible", mDevice.findObject(UiSelector().resourceId("$packageName:id/download_button")) - .waitForExists(waitingTime) + .waitForExists(waitingTimeLong) ) assertTrue( "$fileName title doesn't match", mDevice.findObject(UiSelector().text(fileName)) - .waitForExists(waitingTime) + .waitForExists(waitingTimeLong) ) break