Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Commit

Permalink
Bug 1880520 - [Onboarding] Enable "Add Search Widget" card
Browse files Browse the repository at this point in the history
As result of the experiment to add a new card, "Add Search Widget",
to onboarding, this new card will be now enabled by default.
  • Loading branch information
DreVla authored and mergify[bot] committed Mar 14, 2024
1 parent 2871877 commit e424cd7
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 15 deletions.
1 change: 0 additions & 1 deletion fenix/app/onboarding.fml.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ features:

add-search-widget:
card-type: add-search-widget
enabled: false
title: juno_onboarding_add_search_widget_title
body: juno_onboarding_add_search_widget_description
image-res: ic_onboarding_search_widget
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class OnboardingTest : TestSetup() {
fun verifyFirstOnboardingCardItemsFunctionalityTest() {
runWithLauncherIntent(activityTestRule) {
homeScreen {
clickNotNowOnboardingButton(activityTestRule)
clickDefaultCardNotNowOnboardingButton(activityTestRule)
verifySecondOnboardingCard(activityTestRule)
swipeSecondOnboardingCardToRight()
}.clickSetAsDefaultBrowserOnboardingButton(activityTestRule) {
Expand All @@ -49,7 +49,7 @@ class OnboardingTest : TestSetup() {
fun verifySecondOnboardingCardItemsTest() {
runWithLauncherIntent(activityTestRule) {
homeScreen {
clickNotNowOnboardingButton(activityTestRule)
clickDefaultCardNotNowOnboardingButton(activityTestRule)
verifySecondOnboardingCard(activityTestRule)
}
}
Expand All @@ -58,11 +58,13 @@ class OnboardingTest : TestSetup() {
// TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/2122344
@SmokeTest
@Test
fun verifySecondOnboardingCardSignInFunctionalityTest() {
fun verifyThirdOnboardingCardSignInFunctionalityTest() {
runWithLauncherIntent(activityTestRule) {
homeScreen {
clickNotNowOnboardingButton(activityTestRule)
clickDefaultCardNotNowOnboardingButton(activityTestRule)
verifySecondOnboardingCard(activityTestRule)
clickAddSearchWidgetNotNowOnboardingButton(activityTestRule)
verifyThirdOnboardingCard(activityTestRule)
}.clickSignInOnboardingButton(activityTestRule) {
verifyTurnOnSyncMenu()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,31 +201,72 @@ class HomeScreenRobot {
composeTestRule.also {
Log.i(TAG, "verifySecondOnboardingCard: Trying to verify that the second onboarding screen title exists")
it.onNodeWithText(
getStringResource(R.string.juno_onboarding_sign_in_title_2),
getStringResource(R.string.juno_onboarding_add_search_widget_title),
).assertExists()
Log.i(TAG, "verifySecondOnboardingCard: Verified that the second onboarding screen title exists")
Log.i(TAG, "verifySecondOnboardingCard: Trying to verify that the second onboarding screen description exists")
it.onNodeWithText(
getStringResource(R.string.juno_onboarding_sign_in_description_2),
getStringResource(R.string.juno_onboarding_add_search_widget_description),
).assertExists()
Log.i(TAG, "verifySecondOnboardingCard: Verified that the second onboarding screen description exists")
Log.i(TAG, "verifySecondOnboardingCard: Trying to verify that the first onboarding \"Sign in\" button exists")
it.onNodeWithText(
getStringResource(R.string.juno_onboarding_sign_in_positive_button),
getStringResource(R.string.juno_onboarding_add_search_widget_positive_button),
).assertExists()
Log.i(TAG, "verifySecondOnboardingCard: Verified that the first onboarding \"Add Firefox widget\" button exists")
Log.i(TAG, "verifySecondOnboardingCard: Trying to verify that the second onboarding \"Not now\" button exists")
it.onNodeWithTag(
getStringResource(R.string.juno_onboarding_add_search_widget_title) + "onboarding_card.negative_button",
).assertExists()
Log.i(TAG, "verifySecondOnboardingCard: Verified that the second onboarding \"Not now\" button exists")
}
}

fun verifyThirdOnboardingCard(composeTestRule: ComposeTestRule) {
composeTestRule.also {
Log.i(TAG, "verifyThirdOnboardingCard: Trying to verify that the third onboarding screen title exists")
it.onNodeWithText(
getStringResource(R.string.juno_onboarding_sign_in_title_2),
).assertExists()
Log.i(TAG, "verifyThirdOnboardingCard: Verified that the third onboarding screen title exists")
Log.i(TAG, "verifyThirdOnboardingCard: Trying to verify that the third onboarding screen description exists")
it.onNodeWithText(
getStringResource(R.string.juno_onboarding_sign_in_description_2),
).assertExists()
Log.i(TAG, "verifySecondOnboardingCard: Verified that the first onboarding \"Sign in\" button exists")
Log.i(TAG, "verifySecondOnboardingCard: Trying to verify that the first onboarding \"Not now\" button exists")
Log.i(TAG, "verifyThirdOnboardingCard: Verified that the third onboarding screen description exists")
Log.i(TAG, "verifyThirdOnboardingCard: Trying to verify that the first onboarding \"Sign in\" button exists")
it.onNodeWithText(
getStringResource(R.string.juno_onboarding_sign_in_negative_button),
getStringResource(R.string.juno_onboarding_sign_in_positive_button),
).assertExists()
Log.i(TAG, "verifySecondOnboardingCard: Verified that the first onboarding \"Not now\" button exists")
Log.i(TAG, "verifyThirdOnboardingCard: Verified that the first onboarding \"Sign in\" button exists")
Log.i(TAG, "verifyThirdOnboardingCard: Trying to verify that the third onboarding \"Not now\" button exists")
it.onNodeWithTag(
getStringResource(R.string.juno_onboarding_sign_in_title_2) + "onboarding_card.negative_button",
).assertExists()
Log.i(TAG, "verifySecondOnboardingCard: Verified that the third onboarding \"Not now\" button exists")
}
}

fun clickNotNowOnboardingButton(composeTestRule: ComposeTestRule) {
fun clickDefaultCardNotNowOnboardingButton(composeTestRule: ComposeTestRule) {
Log.i(TAG, "clickNotNowOnboardingButton: Trying to click \"Not now\" onboarding button")
composeTestRule.onNodeWithTag(
getStringResource(R.string.juno_onboarding_default_browser_title_nimbus_2) + "onboarding_card.negative_button",
).performClick()
Log.i(TAG, "clickNotNowOnboardingButton: Clicked \"Not now\" onboarding button")
}

fun clickAddSearchWidgetNotNowOnboardingButton(composeTestRule: ComposeTestRule) {
Log.i(TAG, "clickNotNowOnboardingButton: Trying to click \"Not now\" onboarding button")
composeTestRule.onNodeWithTag(
getStringResource(R.string.juno_onboarding_add_search_widget_title) + "onboarding_card.negative_button",
).performClick()
Log.i(TAG, "clickNotNowOnboardingButton: Clicked \"Not now\" onboarding button")
}

fun clickSyncSignInWidgetNotNowOnboardingButton(composeTestRule: ComposeTestRule) {
Log.i(TAG, "clickNotNowOnboardingButton: Trying to click \"Not now\" onboarding button")
composeTestRule.onNodeWithText(
getStringResource(R.string.juno_onboarding_default_browser_negative_button),
composeTestRule.onNodeWithTag(
getStringResource(R.string.juno_onboarding_sign_in_title_2) + "onboarding_card.negative_button",
).performClick()
Log.i(TAG, "clickNotNowOnboardingButton: Clicked \"Not now\" onboarding button")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.compose.foundation.layout.BoxWithConstraintsScope
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
Expand All @@ -25,6 +26,8 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.testTag
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -138,13 +141,23 @@ fun OnboardingPage(
modifier = Modifier.padding(horizontal = 16.dp),
) {
PrimaryButton(
modifier = Modifier
.fillMaxWidth()
.semantics {
testTag = pageState.title + "onboarding_card.positive_button"
},
text = pageState.primaryButton.text,
onClick = pageState.primaryButton.onClick,
)

if (pageState.secondaryButton != null) {
Spacer(modifier = Modifier.height(8.dp))
SecondaryButton(
modifier = Modifier
.fillMaxWidth()
.semantics {
testTag = pageState.title + "onboarding_card.negative_button"
},
text = pageState.secondaryButton.text,
onClick = pageState.secondaryButton.onClick,
)
Expand Down

0 comments on commit e424cd7

Please sign in to comment.