Bug 1848144 - Onboarding tests TestRail Matching

fenix/118.0
oana.horvath 10 months ago committed by mergify[bot]
parent 697839c07f
commit 08431e4a8b

@ -34,6 +34,7 @@ import androidx.test.espresso.IdlingRegistry
import androidx.test.espresso.IdlingResource
import androidx.test.espresso.action.ViewActions.longClick
import androidx.test.espresso.assertion.ViewAssertions
import androidx.test.espresso.intent.Intents
import androidx.test.espresso.intent.Intents.intended
import androidx.test.espresso.intent.matcher.IntentMatchers.toPackage
import androidx.test.espresso.matcher.ViewMatchers.hasSibling
@ -118,6 +119,12 @@ object TestHelper {
fun closeApp(activity: HomeActivityIntentTestRule) =
activity.activity.finishAndRemoveTask()
fun relaunchCleanApp(activity: HomeActivityIntentTestRule) {
closeApp(activity)
Intents.release()
activity.launchActivity(null)
}
fun getPermissionAllowID(): String {
return when
(Build.VERSION.SDK_INT > Build.VERSION_CODES.P) {

@ -7,35 +7,50 @@ 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.helpers.HomeActivityIntentTestRule
import org.mozilla.fenix.helpers.TestHelper.mDevice
import org.mozilla.fenix.helpers.TestHelper.relaunchCleanApp
import org.mozilla.fenix.ui.robots.homeScreen
/**
* Tests for verifying the new onboarding features.
* Note: This involves setting the feature flag On for the onboarding dialog
* Tests for verifying the onboarding feature for users upgrading from a version older than 106.
* Note: This involves setting the feature flag On for the onboarding cards
*
*/
class OnboardingFeaturesTest {
class UpgradingUsersOnboardingTest {
@get:Rule
val activityTestRule = AndroidComposeTestRule(
HomeActivityTestRule(isHomeOnboardingDialogEnabled = true),
HomeActivityIntentTestRule(isHomeOnboardingDialogEnabled = true),
) { it.activity }
@SmokeTest
// https://testrail.stage.mozaws.net/index.php?/cases/view/1913592
@Test
fun upgradingUsersOnboardingScreensTest() {
homeScreen {
verifyUpgradingUserOnboardingFirstScreen(activityTestRule)
clickGetStartedButton(activityTestRule)
verifyUpgradingUserOnboardingSecondScreen(activityTestRule)
}
}
// https://testrail.stage.mozaws.net/index.php?/cases/view/1913591
@Test
fun upgradingUsersOnboardingCanBeSkippedTest() {
homeScreen {
verifyUpgradingUserOnboardingFirstScreen(activityTestRule)
clickCloseButton(activityTestRule)
verifyHomeScreen()
relaunchCleanApp(activityTestRule.activityRule)
clickGetStartedButton(activityTestRule)
verifyUpgradingUserOnboardingSecondScreen(activityTestRule)
clickSkipButton(activityTestRule)
verifyHomeScreen()
}
}
// https://testrail.stage.mozaws.net/index.php?/cases/view/1932156
@Test
fun upgradingUsersOnboardingSignInButtonTest() {
homeScreen {

@ -14,6 +14,7 @@ import androidx.compose.ui.test.assert
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.assertIsNotSelected
import androidx.compose.ui.test.assertIsSelected
import androidx.compose.ui.test.hasContentDescription
import androidx.compose.ui.test.hasText
import androidx.compose.ui.test.junit4.ComposeTestRule
import androidx.compose.ui.test.onChildAt
@ -252,6 +253,9 @@ class HomeScreenRobot {
fun clickGetStartedButton(testRule: ComposeTestRule) =
testRule.onNodeWithText(getStringResource(R.string.onboarding_home_get_started_button)).performClick()
fun clickCloseButton(testRule: ComposeTestRule) =
testRule.onNode(hasContentDescription("Close")).performClick()
fun verifyUpgradingUserOnboardingSecondScreen(testRule: ComposeTestRule) {
testRule.also {
it.onNodeWithText(getStringResource(R.string.onboarding_home_sync_title_3))

Loading…
Cancel
Save