diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/OnboardingTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/OnboardingTest.kt index e5cd5aa602..a28cbaedbd 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/OnboardingTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/OnboardingTest.kt @@ -3,16 +3,18 @@ package org.mozilla.fenix.ui import android.content.res.Configuration import androidx.test.platform.app.InstrumentationRegistry import androidx.test.uiautomator.UiDevice +import mozilla.components.concept.engine.utils.EngineReleaseChannel import okhttp3.mockwebserver.MockWebServer import org.junit.After import org.junit.Before -import org.junit.Ignore import org.junit.Rule import org.junit.Test import org.mozilla.fenix.customannotations.SmokeTest +import org.mozilla.fenix.ext.components import org.mozilla.fenix.helpers.AndroidAssetDispatcher import org.mozilla.fenix.helpers.HomeActivityTestRule import org.mozilla.fenix.helpers.TestAssetHelper +import org.mozilla.fenix.helpers.TestHelper.runWithCondition import org.mozilla.fenix.helpers.TestHelper.verifyDarkThemeApplied import org.mozilla.fenix.helpers.TestHelper.verifyLightThemeApplied import org.mozilla.fenix.ui.robots.homeScreen @@ -228,14 +230,20 @@ class OnboardingTest { } @Test - @Ignore("Failing due to changes from https://github.com/mozilla-mobile/firefox-android/pull/969") fun youControlYourDataCardTest() { - homeScreen { - verifyPrivacyNoticeCard() - }.clickPrivacyNoticeButton { - verifyUrl(privacyNoticeLink) - }.goBack { - verifyPrivacyNoticeCard() + runWithCondition( + // Returns the GeckoView channel set for the current version, if a feature is limited to Nightly. + // Once this feature lands in Beta/RC we should remove the wrapper. + activityTestRule.activity.components.core.engine.version.releaseChannel == EngineReleaseChannel.NIGHTLY || + activityTestRule.activity.components.core.engine.version.releaseChannel == EngineReleaseChannel.BETA, + ) { + homeScreen { + verifyPrivacyNoticeCard() + }.clickPrivacyNoticeButton { + verifyCustomTabToolbarTitle("Firefox Privacy Notice") + }.goBackToOnboardingScreen { + verifyPrivacyNoticeCard() + } } } } 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 d4af3d7d4f..9b737bebf2 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 @@ -143,6 +143,13 @@ class CustomTabRobot { BrowserRobot().interact() return BrowserRobot.Transition() } + + fun goBackToOnboardingScreen(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition { + mDevice.pressBack() + + HomeScreenRobot().interact() + return HomeScreenRobot.Transition() + } } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt index fc4190e733..9608adfeed 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt @@ -819,11 +819,11 @@ class HomeScreenRobot { return SyncSignInRobot.Transition() } - fun clickPrivacyNoticeButton(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition { + fun clickPrivacyNoticeButton(interact: CustomTabRobot.() -> Unit): CustomTabRobot.Transition { privacyNoticeButton.clickAndWaitForNewWindow(waitingTimeShort) - BrowserRobot().interact() - return BrowserRobot.Transition() + CustomTabRobot().interact() + return CustomTabRobot.Transition() } } }