diff --git a/changelog.d/5519.wip b/changelog.d/5519.wip new file mode 100644 index 0000000000..c5a6112ad9 --- /dev/null +++ b/changelog.d/5519.wip @@ -0,0 +1 @@ +Finalising FTUE onboarding account creation personalization steps but keeping feature disabled until other parts are complete \ No newline at end of file diff --git a/vector/src/androidTest/java/im/vector/app/ui/robot/OnboardingRobot.kt b/vector/src/androidTest/java/im/vector/app/ui/robot/OnboardingRobot.kt index d051488ad7..97e3b281c0 100644 --- a/vector/src/androidTest/java/im/vector/app/ui/robot/OnboardingRobot.kt +++ b/vector/src/androidTest/java/im/vector/app/ui/robot/OnboardingRobot.kt @@ -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,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") { diff --git a/vector/src/main/res/values/donottranslate.xml b/vector/src/main/res/values/donottranslate.xml index d8e06459c8..2895d72a98 100755 --- a/vector/src/main/res/values/donottranslate.xml +++ b/vector/src/main/res/values/donottranslate.xml @@ -10,22 +10,4 @@ Cut the slack from teams. - Personalize profile - Take me home - Congratulations! - Your account %s has been created. - - Choose a display name - This will be shown when you send messages. - Display Name - You can change this later - - Add a profile picture - You can change this anytime. - Let\'s go - You\'re all set! - Your preferences have been saved. - - Save and continue - Skip this step diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index a276e07b1e..59eb6e2911 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -1863,6 +1863,25 @@ Looking to join an existing server? Connect to server + Personalize profile + Take me home + Congratulations! + Your account %s has been created. + + Choose a display name + This will be shown when you send messages. + Display Name + You can change this later + + Add a profile picture + You can change this anytime. + Let\'s go + You\'re all set! + Your preferences have been saved. + + Save and continue + Skip this step + It\'s your conversation. Own it. Chat with people directly or in groups Keep conversations private with encryption diff --git a/vector/src/test/java/im/vector/app/features/onboarding/OnboardingViewModelTest.kt b/vector/src/test/java/im/vector/app/features/onboarding/OnboardingViewModelTest.kt index 118bf689d2..a682d025b8 100644 --- a/vector/src/test/java/im/vector/app/features/onboarding/OnboardingViewModelTest.kt +++ b/vector/src/test/java/im/vector/app/features/onboarding/OnboardingViewModelTest.kt @@ -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, diff --git a/vector/src/test/java/im/vector/app/test/fakes/FakeVectorFeatures.kt b/vector/src/test/java/im/vector/app/test/fakes/FakeVectorFeatures.kt index b6e06bcdda..aeabcce7cd 100644 --- a/vector/src/test/java/im/vector/app/test/fakes/FakeVectorFeatures.kt +++ b/vector/src/test/java/im/vector/app/test/fakes/FakeVectorFeatures.kt @@ -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() { + + fun givenPersonalisationEnabled() { + every { isOnboardingPersonalizeEnabled() } returns true + } }