diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt index 9b94fa1f6..fec7c50c2 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt @@ -652,12 +652,6 @@ class SmokeTest { enhancedTrackingProtection { verifyEnhancedTrackingProtectionNotice() }.closeNotificationPopup {} - - browserScreen { - }.openThreeDotMenu { - }.openReportSiteIssue { - verifyUrl("webcompat.com/issues/new") - } } @Test @@ -1234,9 +1228,7 @@ class SmokeTest { ) customTabScreen { - browserScreen { - verifyPageContent(customTabPage.content) - } + verifyCustomTabCloseButton() }.openMainMenu { verifyPoweredByTextIsDisplayed() verifyCustomMenuItem(customMenuItem) @@ -1261,9 +1253,7 @@ class SmokeTest { ) customTabScreen { - browserScreen { - verifyPageContent(customTabPage.content) - } + verifyCustomTabCloseButton() }.openMainMenu { }.clickOpenInBrowserButton { verifyTabCounter("1") diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/CustomTabRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/CustomTabRobot.kt index 336255f3d..0ff73501f 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/CustomTabRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/CustomTabRobot.kt @@ -7,6 +7,7 @@ import androidx.test.espresso.Espresso.onView import androidx.test.espresso.action.ViewActions.click import androidx.test.espresso.assertion.ViewAssertions.matches import androidx.test.espresso.matcher.ViewMatchers.isDisplayed +import androidx.test.espresso.matcher.ViewMatchers.withContentDescription import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.uiautomator.UiSelector @@ -29,7 +30,10 @@ class CustomTabRobot { } fun verifyPoweredByTextIsDisplayed() { - mDevice.findObject(UiSelector().textContains("POWERED BY $appName")) + assertTrue( + mDevice.findObject(UiSelector().textContains("POWERED BY $appName")) + .waitForExists(waitingTime) + ) } fun verifyOpenInBrowserButtonExists() { @@ -43,7 +47,11 @@ class CustomTabRobot { fun verifyRefreshButtonExists() = assertTrue(refreshButton().waitForExists(waitingTime)) fun verifyCustomMenuItem(label: String) { - assertTrue(mDevice.findObject(UiSelector().text(label)).exists()) + assertTrue(mDevice.findObject(UiSelector().text(label)).waitForExists(waitingTime)) + } + + fun verifyCustomTabCloseButton() { + closeButton().check(matches(isDisplayed())) } class Transition { @@ -82,3 +90,5 @@ private fun refreshButton() = mDevice.findObject(UiSelector().description("Refre private fun forwardButton() = mDevice.findObject(UiSelector().description("Forward")) private fun backButton() = mDevice.findObject(UiSelector().description("Back")) + +private fun closeButton() = onView(withContentDescription("Return to previous app")) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuAddonsManagerRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuAddonsManagerRobot.kt index 8c048afea..fae51e4fc 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuAddonsManagerRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuAddonsManagerRobot.kt @@ -2,6 +2,7 @@ package org.mozilla.fenix.ui.robots import android.widget.RelativeLayout import androidx.test.espresso.Espresso.onView +import androidx.test.espresso.IdlingResourceTimeoutException import androidx.test.espresso.action.ViewActions.click import androidx.test.espresso.assertion.ViewAssertions.matches import androidx.test.espresso.matcher.ViewMatchers.Visibility @@ -17,6 +18,7 @@ import androidx.test.espresso.matcher.ViewMatchers.withParent import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.rule.ActivityTestRule import androidx.test.uiautomator.By +import androidx.test.uiautomator.UiSelector import androidx.test.uiautomator.Until import org.hamcrest.CoreMatchers.allOf import org.hamcrest.CoreMatchers.containsString @@ -38,9 +40,23 @@ import org.mozilla.fenix.helpers.ext.waitNotNull class SettingsSubMenuAddonsManagerRobot { fun verifyAddonPrompt(addonName: String) = assertAddonPrompt(addonName) + fun clickInstallAddon(addonName: String) = selectInstallAddon(addonName) - fun verifyDownloadAddonPrompt(addonName: String, activityTestRule: ActivityTestRule) = - assertDownloadingAddonPrompt(addonName, activityTestRule) + + fun verifyDownloadAddonPrompt( + addonName: String, + activityTestRule: ActivityTestRule + ) { + try { + assertDownloadingAddonPrompt(addonName, activityTestRule) + } catch (e: IdlingResourceTimeoutException) { + if (mDevice.findObject(UiSelector().text("Failed to install $addonName")).exists()) { + clickInstallAddon(addonName) + acceptInstallAddon() + assertDownloadingAddonPrompt(addonName, activityTestRule) + } + } + } fun cancelInstallAddon() = cancelInstall() fun acceptInstallAddon() = allowInstall()