From 3f4113b66d2c697b4a5a80dd49772abc5036a0ce Mon Sep 17 00:00:00 2001 From: AndiAJ Date: Tue, 21 Sep 2021 16:18:48 +0300 Subject: [PATCH] Exit onboarding tour UI tests --- .../org/mozilla/fenix/ui/HomeScreenTest.kt | 59 +++++++++++++++++-- .../mozilla/fenix/ui/robots/BrowserRobot.kt | 7 +++ 2 files changed, 62 insertions(+), 4 deletions(-) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/HomeScreenTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/HomeScreenTest.kt index 020bbd8210e0..3dc313d8af59 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/HomeScreenTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/HomeScreenTest.kt @@ -4,15 +4,15 @@ package org.mozilla.fenix.ui +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.uiautomator.By import androidx.test.uiautomator.UiDevice +import androidx.test.uiautomator.Until import org.junit.Rule import org.junit.Test import org.mozilla.fenix.helpers.HomeActivityTestRule -import androidx.test.platform.app.InstrumentationRegistry -import androidx.test.uiautomator.By -import androidx.test.uiautomator.Until -import org.mozilla.fenix.helpers.ext.waitNotNull import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime +import org.mozilla.fenix.helpers.ext.waitNotNull import org.mozilla.fenix.ui.robots.homeScreen /** @@ -88,4 +88,55 @@ class HomeScreenTest { verifyHomeComponent() } } + + @Test + fun dismissOnboardingUsingSettingsTest() { + homeScreen { + verifyWelcomeHeader() + }.openThreeDotMenu { + }.openSettings { + verifyBasicsHeading() + }.goBack { + verifyExistingTopSitesList() + } + } + + @Test + fun dismissOnboardingUsingBookmarksTest() { + homeScreen { + verifyWelcomeHeader() + }.openThreeDotMenu { + }.openBookmarks { + verifyBookmarksMenuView() + navigateUp() + } + homeScreen { + verifyExistingTopSitesList() + } + } + + @Test + fun dismissOnboardingUsingHelpTest() { + homeScreen { + verifyWelcomeHeader() + }.openThreeDotMenu { + }.openHelp { + verifyHelpUrl() + }.goBack { + verifyExistingTopSitesList() + } + } + + @Test + fun toolbarTapDoesntDismissOnboardingTest() { + homeScreen { + verifyWelcomeHeader() + }.openSearch { + verifyScanButton() + verifySearchEngineButton() + verifyKeyboardVisibility() + }.dismissSearchBar { + verifyWelcomeHeader() + } + } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt index 7837b2005910..767b04cafbfc 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt @@ -535,6 +535,13 @@ class BrowserRobot { return HomeScreenRobot.Transition() } + fun goBack(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition { + mDevice.pressBack() + + HomeScreenRobot().interact() + return HomeScreenRobot.Transition() + } + fun clickTabCrashedCloseButton(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition { assertTrue(