No issue: adds new onboarding smoke tests
This commit is contained in:
parent
31e9f69aae
commit
8cf20cc6c6
|
@ -0,0 +1,50 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.fenix.ui
|
||||
|
||||
import androidx.compose.ui.test.junit4.AndroidComposeTestRule
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.mozilla.fenix.customannotations.SmokeTest
|
||||
import org.mozilla.fenix.helpers.HomeActivityTestRule
|
||||
import org.mozilla.fenix.ui.robots.homeScreen
|
||||
|
||||
/**
|
||||
* Tests for verifying the new onboarding features.
|
||||
* Note: This involves setting the feature flags on for the onboarding dialog and
|
||||
* other CFRs which are disabled elsewhere.
|
||||
*
|
||||
*/
|
||||
class OnboardingFeaturesTest {
|
||||
|
||||
@get:Rule
|
||||
val activityTestRule = AndroidComposeTestRule(
|
||||
HomeActivityTestRule(isHomeOnboardingDialogEnabled = true),
|
||||
) { it.activity }
|
||||
|
||||
@SmokeTest
|
||||
@Test
|
||||
fun upgradingUsersOnboardingScreensTest() {
|
||||
homeScreen {
|
||||
verifyUpgradingUserOnboardingFirstScreen(activityTestRule)
|
||||
clickGetStartedButton(activityTestRule)
|
||||
verifyUpgradingUserOnboardingSecondScreen(activityTestRule)
|
||||
clickSkipButton(activityTestRule)
|
||||
verifyHomeScreen()
|
||||
}
|
||||
}
|
||||
|
||||
@SmokeTest
|
||||
@Test
|
||||
fun upgradingUsersOnboardingSignInButtonTest() {
|
||||
homeScreen {
|
||||
verifyUpgradingUserOnboardingFirstScreen(activityTestRule)
|
||||
clickGetStartedButton(activityTestRule)
|
||||
verifyUpgradingUserOnboardingSecondScreen(activityTestRule)
|
||||
}.clickUpgradingUserOnboardingSignInButton(activityTestRule) {
|
||||
verifyTurnOnSyncMenu()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,6 +11,7 @@ import android.widget.EditText
|
|||
import androidx.compose.ui.test.assertIsDisplayed
|
||||
import androidx.compose.ui.test.hasText
|
||||
import androidx.compose.ui.test.junit4.ComposeTestRule
|
||||
import androidx.compose.ui.test.onNodeWithText
|
||||
import androidx.compose.ui.test.performClick
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
|
@ -132,6 +133,44 @@ class HomeScreenRobot {
|
|||
fun verifyPrivacyNoticeButton() = assertPrivacyNoticeButton()
|
||||
fun verifyStartBrowsingButton() = assertStartBrowsingButton()
|
||||
|
||||
// Upgrading users onboarding dialog
|
||||
fun verifyUpgradingUserOnboardingFirstScreen(testRule: ComposeTestRule) {
|
||||
testRule.also {
|
||||
it.onNodeWithText(getStringResource(R.string.onboarding_home_welcome_title_2))
|
||||
.assertIsDisplayed()
|
||||
|
||||
it.onNodeWithText(getStringResource(R.string.onboarding_home_welcome_description))
|
||||
.assertIsDisplayed()
|
||||
|
||||
it.onNodeWithText(getStringResource(R.string.onboarding_home_get_started_button))
|
||||
.assertIsDisplayed()
|
||||
}
|
||||
}
|
||||
|
||||
fun clickGetStartedButton(testRule: ComposeTestRule) =
|
||||
testRule.onNodeWithText(getStringResource(R.string.onboarding_home_get_started_button)).performClick()
|
||||
|
||||
fun verifyUpgradingUserOnboardingSecondScreen(testRule: ComposeTestRule) {
|
||||
testRule.also {
|
||||
it.onNodeWithText(getStringResource(R.string.onboarding_home_sync_title_3))
|
||||
.assertIsDisplayed()
|
||||
|
||||
it.onNodeWithText(getStringResource(R.string.onboarding_home_sync_description))
|
||||
.assertIsDisplayed()
|
||||
|
||||
it.onNodeWithText(getStringResource(R.string.onboarding_home_sign_in_button))
|
||||
.assertIsDisplayed()
|
||||
|
||||
it.onNodeWithText(getStringResource(R.string.onboarding_home_skip_button))
|
||||
.assertIsDisplayed()
|
||||
}
|
||||
}
|
||||
|
||||
fun clickSkipButton(testRule: ComposeTestRule) =
|
||||
testRule
|
||||
.onNodeWithText(getStringResource(R.string.onboarding_home_skip_button))
|
||||
.performClick()
|
||||
|
||||
fun verifyPrivateSessionMessage() = assertPrivateSessionMessage()
|
||||
|
||||
fun verifyExistingTopSitesList() = assertExistingTopSitesList()
|
||||
|
@ -354,6 +393,16 @@ class HomeScreenRobot {
|
|||
return SearchRobot.Transition()
|
||||
}
|
||||
|
||||
fun clickUpgradingUserOnboardingSignInButton(
|
||||
testRule: ComposeTestRule,
|
||||
interact: SyncSignInRobot.() -> Unit,
|
||||
): SyncSignInRobot.Transition {
|
||||
testRule.onNodeWithText("Sign in").performClick()
|
||||
|
||||
SyncSignInRobot().interact()
|
||||
return SyncSignInRobot.Transition()
|
||||
}
|
||||
|
||||
fun togglePrivateBrowsingMode() {
|
||||
mDevice.findObject(UiSelector().resourceId("$packageName:id/privateBrowsingButton"))
|
||||
.waitForExists(
|
||||
|
|
Loading…
Reference in New Issue