FTUE - Finalising personalisation journey (#5519)

* enabling the personalisation flow and promoting the strings for translation

* delegating the fake vector features to the static defaults, the fake exists for allowing overrides when needed

* incorporating the personalisation screens into the UI test signup

* adding changelog entry

* removing unused import

* putting the personalisation UI test flow behind the feature flag so that we can keep it disabled

* disabling the personalisation flow, we'll batch enable with other parts of the FTUE flow

* enabling the personalisation feature for registration unit tests which expect it to be enabled
This commit is contained in:
Adam Brown 2022-03-30 09:09:46 +01:00 committed by GitHub
parent 9c333c96c4
commit 9d3d574d28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 50 additions and 28 deletions

1
changelog.d/5519.wip Normal file
View file

@ -0,0 +1 @@
Finalising FTUE onboarding account creation personalization steps but keeping feature disabled until other parts are complete

View file

@ -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 {
@ -57,8 +58,22 @@ 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))
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") {
initSession(false, userId, password, homeServerUrl)

View file

@ -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>

View file

@ -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>

View file

@ -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
@ -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()
@ -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()
@ -384,7 +387,7 @@ class OnboardingViewModelTest {
ReAuthHelper(),
FakeStringProvider().instance,
FakeHomeServerHistoryService(),
FakeVectorFeatures(),
fakeVectorFeatures,
FakeAnalyticsTracker(),
fakeUriFilenameResolver.instance,
fakeRegisterActionHandler.instance,

View file

@ -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
}
}