Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FTUE - Finalising personalisation journey #5519

Merged
merged 8 commits into from
Mar 30, 2022
1 change: 1 addition & 0 deletions changelog.d/5519.wip
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Finalising FTUE onboarding account creation personalization steps but keeping feature disabled until other parts are complete
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn
import com.adevinta.android.barista.interaction.BaristaEditTextInteractions.writeTo
import im.vector.app.R
import im.vector.app.espresso.tools.waitUntilViewVisible
import im.vector.app.features.DefaultVectorFeatures
import im.vector.app.waitForView

class OnboardingRobot {
Expand Down Expand Up @@ -57,7 +58,21 @@ class OnboardingRobot {
fun createAccount(userId: String, password: String = "password", homeServerUrl: String = "http://10.0.2.2:8080") {
initSession(true, userId, password, homeServerUrl)
waitUntilViewVisible(withText(R.string.ftue_account_created_congratulations_title))
clickOn(R.string.ftue_account_created_take_me_home)
if (DefaultVectorFeatures().isOnboardingPersonalizeEnabled()) {
clickOn(R.string.ftue_account_created_personalize)

waitUntilViewVisible(withText(R.string.ftue_display_name_title))
writeTo(R.id.displayNameInput, "UI automation")
clickOn(R.string.ftue_personalize_submit)

waitUntilViewVisible(withText(R.string.ftue_profile_picture_title))
clickOn(R.string.ftue_personalize_skip_this_step)

waitUntilViewVisible(withText(R.string.ftue_personalize_complete_title))
clickOn(R.string.ftue_personalize_lets_go)
} else {
clickOn(R.string.ftue_account_created_take_me_home)
}
}

fun login(userId: String, password: String = "password", homeServerUrl: String = "http://10.0.2.2:8080") {
Expand Down
18 changes: 0 additions & 18 deletions vector/src/main/res/values/donottranslate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,4 @@
<string name="cut_the_slack_from_teams" translatable="false">Cut the slack from teams.</string>

<!-- WIP -->
<string name="ftue_account_created_personalize" translatable="false">Personalize profile</string>
<string name="ftue_account_created_take_me_home" translatable="false">Take me home</string>
<string name="ftue_account_created_congratulations_title" translatable="false">Congratulations!</string>
<string name="ftue_account_created_subtitle" translatable="false">Your account %s has been created.</string>

<string name="ftue_display_name_title" translatable="false">Choose a display name</string>
<string name="ftue_display_name_subtitle" translatable="false">This will be shown when you send messages.</string>
<string name="ftue_display_name_entry_title" translatable="false">Display Name</string>
<string name="ftue_display_name_entry_footer" translatable="false">You can change this later</string>

<string name="ftue_profile_picture_title" translatable="false">Add a profile picture</string>
<string name="ftue_profile_picture_subtitle" translatable="false">You can change this anytime.</string>
<string name="ftue_personalize_lets_go" translatable="false">Let\'s go</string>
<string name="ftue_personalize_complete_title" translatable="false">You\'re all set!</string>
<string name="ftue_personalize_complete_subtitle" translatable="false">Your preferences have been saved.</string>

<string name="ftue_personalize_submit" translatable="false">Save and continue</string>
<string name="ftue_personalize_skip_this_step" translatable="false">Skip this step</string>
</resources>
19 changes: 19 additions & 0 deletions vector/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1863,6 +1863,25 @@
<string name="ftue_auth_use_case_join_existing_server">Looking to join an existing server?</string>
<string name="ftue_auth_use_case_connect_to_server">Connect to server</string>

<string name="ftue_account_created_personalize">Personalize profile</string>
<string name="ftue_account_created_take_me_home">Take me home</string>
<string name="ftue_account_created_congratulations_title">Congratulations!</string>
<string name="ftue_account_created_subtitle">Your account %s has been created.</string>

<string name="ftue_display_name_title">Choose a display name</string>
<string name="ftue_display_name_subtitle">This will be shown when you send messages.</string>
<string name="ftue_display_name_entry_title">Display Name</string>
<string name="ftue_display_name_entry_footer">You can change this later</string>

<string name="ftue_profile_picture_title">Add a profile picture</string>
<string name="ftue_profile_picture_subtitle">You can change this anytime.</string>
<string name="ftue_personalize_lets_go">Let\'s go</string>
<string name="ftue_personalize_complete_title">You\'re all set!</string>
<string name="ftue_personalize_complete_subtitle">Your preferences have been saved.</string>

<string name="ftue_personalize_submit">Save and continue</string>
<string name="ftue_personalize_skip_this_step">Skip this step</string>

<string name="login_splash_title">It\'s your conversation. Own it.</string>
<string name="login_splash_text1">Chat with people directly or in groups</string>
<string name="login_splash_text2">Keep conversations private with encryption</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class OnboardingViewModelTest {
private val fakeAuthenticationService = FakeAuthenticationService()
private val fakeRegisterActionHandler = FakeRegisterActionHandler()
private val fakeDirectLoginUseCase = FakeDirectLoginUseCase()
private val fakeVectorFeatures = FakeVectorFeatures()

lateinit var viewModel: OnboardingViewModel

Expand Down Expand Up @@ -224,7 +225,8 @@ class OnboardingViewModelTest {
}

@Test
fun `when registering account, then updates state and emits account created event`() = runTest {
fun `given personalisation enabled, when registering account, then updates state and emits account created event`() = runTest {
fakeVectorFeatures.givenPersonalisationEnabled()
givenRegistrationResultFor(A_LOADABLE_REGISTER_ACTION, RegistrationResult.Success(fakeSession))
givenSuccessfullyCreatesAccount(A_HOMESERVER_CAPABILITIES)
val test = viewModel.test()
Expand All @@ -242,7 +244,8 @@ class OnboardingViewModelTest {
}

@Test
fun `given registration has started and has dummy step to do, when handling action, then ignores other steps and executes dummy`() = runTest {
fun `given personalisation enabled and registration has started and has dummy step to do, when handling action, then ignores other steps and executes dummy`() = runTest {
fakeVectorFeatures.givenPersonalisationEnabled()
givenSuccessfulRegistrationForStartAndDummySteps(missingStages = listOf(Stage.Dummy(mandatory = true)))
val test = viewModel.test()

Expand Down Expand Up @@ -384,7 +387,7 @@ class OnboardingViewModelTest {
ReAuthHelper(),
FakeStringProvider().instance,
FakeHomeServerHistoryService(),
FakeVectorFeatures(),
fakeVectorFeatures,
FakeAnalyticsTracker(),
fakeUriFilenameResolver.instance,
fakeRegisterActionHandler.instance,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@

package im.vector.app.test.fakes

import im.vector.app.features.DefaultVectorFeatures
import im.vector.app.features.VectorFeatures
import io.mockk.every
import io.mockk.spyk

class FakeVectorFeatures : VectorFeatures {
override fun onboardingVariant() = VectorFeatures.OnboardingVariant.FTUE_AUTH
override fun isOnboardingAlreadyHaveAccountSplashEnabled() = true
override fun isOnboardingSplashCarouselEnabled() = true
override fun isOnboardingUseCaseEnabled() = true
override fun isOnboardingPersonalizeEnabled() = true
class FakeVectorFeatures : VectorFeatures by spyk<DefaultVectorFeatures>() {

fun givenPersonalisationEnabled() {
every { isOnboardingPersonalizeEnabled() } returns true
}
}