diff --git a/changelog.d/2585.feature b/changelog.d/2585.feature new file mode 100644 index 0000000000..eedbac1e88 --- /dev/null +++ b/changelog.d/2585.feature @@ -0,0 +1 @@ +FTUE - Enable improved login and register onboarding flows diff --git a/vector/src/androidTest/java/im/vector/app/ui/robot/ElementRobot.kt b/vector/src/androidTest/java/im/vector/app/ui/robot/ElementRobot.kt index 3b54a8607b..b6fbfc23ab 100644 --- a/vector/src/androidTest/java/im/vector/app/ui/robot/ElementRobot.kt +++ b/vector/src/androidTest/java/im/vector/app/ui/robot/ElementRobot.kt @@ -23,7 +23,6 @@ import androidx.test.espresso.Espresso.pressBack import androidx.test.espresso.action.ViewActions import androidx.test.espresso.action.ViewActions.click import androidx.test.espresso.assertion.ViewAssertions -import androidx.test.espresso.matcher.ViewMatchers import androidx.test.espresso.matcher.ViewMatchers.isDisplayed import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.espresso.matcher.ViewMatchers.withText @@ -182,13 +181,8 @@ class ElementRobot { val activity = EspressoHelper.getCurrentActivity()!! val popup = activity.findViewById(com.tapadoo.alerter.R.id.llAlertBackground)!! activity.runOnUiThread { popup.performClick() } - - waitUntilViewVisible(withId(R.id.bottomSheetFragmentContainer)) - waitUntilViewVisible(ViewMatchers.withText(R.string.action_skip)) - clickOn(R.string.action_skip) - assertDisplayed(R.string.are_you_sure) - clickOn(R.string.action_skip) waitUntilViewVisible(withId(R.id.bottomSheetFragmentContainer)) + pressBack() }.onFailure { Timber.w(it, "Verification popup missing") } } 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 350bbf8ba3..e72535c116 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 @@ -34,31 +34,46 @@ import im.vector.app.waitForView class OnboardingRobot { + private val defaultVectorFeatures = DefaultVectorFeatures() + fun crawl() { waitUntilViewVisible(withId(R.id.loginSplashSubmit)) - crawlGetStarted() + crawlCreateAccount() crawlAlreadyHaveAccount() } - private fun crawlGetStarted() { - clickOn(R.id.loginSplashSubmit) - assertDisplayed(R.id.useCaseHeaderTitle, R.string.ftue_auth_use_case_title) - clickOn(R.id.useCaseOptionOne) - OnboardingServersRobot().crawlSignUp() - pressBack() - pressBack() + private fun crawlCreateAccount() { + if (defaultVectorFeatures.isOnboardingCombinedRegisterEnabled()) { + // TODO https://github.com/vector-im/element-android/issues/6652 + } else { + clickOn(R.id.loginSplashSubmit) + assertDisplayed(R.id.useCaseHeaderTitle, R.string.ftue_auth_use_case_title) + clickOn(R.id.useCaseOptionOne) + OnboardingServersRobot().crawlSignUp() + pressBack() + pressBack() + } } private fun crawlAlreadyHaveAccount() { - clickOn(R.id.loginSplashAlreadyHaveAccount) - OnboardingServersRobot().crawlSignIn() - pressBack() + if (defaultVectorFeatures.isOnboardingCombinedLoginEnabled()) { + // TODO https://github.com/vector-im/element-android/issues/6652 + } else { + clickOn(R.id.loginSplashAlreadyHaveAccount) + OnboardingServersRobot().crawlSignIn() + pressBack() + } } fun createAccount(userId: String, password: String = "password", homeServerUrl: String = "http://10.0.2.2:8080") { - initSession(true, userId, password, homeServerUrl) + if (defaultVectorFeatures.isOnboardingCombinedRegisterEnabled()) { + createAccountViaCombinedRegister(homeServerUrl, userId, password) + } else { + initSession(true, userId, password, homeServerUrl) + } + waitUntilViewVisible(withText(R.string.ftue_account_created_congratulations_title)) - if (DefaultVectorFeatures().isOnboardingPersonalizeEnabled()) { + if (defaultVectorFeatures.isOnboardingPersonalizeEnabled()) { clickOn(R.string.ftue_account_created_personalize) waitUntilViewVisible(withText(R.string.ftue_display_name_title)) @@ -75,8 +90,47 @@ class OnboardingRobot { } } + private fun createAccountViaCombinedRegister(homeServerUrl: String, userId: String, password: String) { + waitUntilViewVisible(withId(R.id.loginSplashSubmit)) + assertDisplayed(R.id.loginSplashSubmit, R.string.login_splash_create_account) + clickOn(R.id.loginSplashSubmit) + clickOn(R.id.useCaseOptionOne) + + waitUntilViewVisible(withId(R.id.createAccountRoot)) + clickOn(R.id.editServerButton) + writeTo(R.id.chooseServerInput, homeServerUrl) + closeSoftKeyboard() + clickOn(R.id.chooseServerSubmit) + waitUntilViewVisible(withId(R.id.createAccountRoot)) + + writeTo(R.id.createAccountInput, userId) + writeTo(R.id.createAccountPasswordInput, password) + clickOn(R.id.createAccountSubmit) + } + fun login(userId: String, password: String = "password", homeServerUrl: String = "http://10.0.2.2:8080") { - initSession(false, userId, password, homeServerUrl) + if (defaultVectorFeatures.isOnboardingCombinedLoginEnabled()) { + loginViaCombinedLogin(homeServerUrl, userId, password) + } else { + initSession(false, userId, password, homeServerUrl) + } + } + + private fun loginViaCombinedLogin(homeServerUrl: String, userId: String, password: String) { + waitUntilViewVisible(withId(R.id.loginSplashSubmit)) + assertDisplayed(R.id.loginSplashSubmit, R.string.login_splash_create_account) + clickOn(R.id.loginSplashAlreadyHaveAccount) + + waitUntilViewVisible(withId(R.id.loginRoot)) + clickOn(R.id.editServerButton) + writeTo(R.id.chooseServerInput, homeServerUrl) + closeSoftKeyboard() + clickOn(R.id.chooseServerSubmit) + waitUntilViewVisible(withId(R.id.loginRoot)) + + writeTo(R.id.loginInput, userId) + writeTo(R.id.loginPasswordInput, password) + clickOn(R.id.loginSubmit) } private fun initSession( diff --git a/vector/src/androidTest/java/im/vector/app/ui/robot/settings/SettingsPreferencesRobot.kt b/vector/src/androidTest/java/im/vector/app/ui/robot/settings/SettingsPreferencesRobot.kt index bb09ee30f2..126cfafa18 100644 --- a/vector/src/androidTest/java/im/vector/app/ui/robot/settings/SettingsPreferencesRobot.kt +++ b/vector/src/androidTest/java/im/vector/app/ui/robot/settings/SettingsPreferencesRobot.kt @@ -17,13 +17,12 @@ package im.vector.app.ui.robot.settings import androidx.test.espresso.Espresso.pressBack +import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.espresso.matcher.ViewMatchers.withText import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn import com.adevinta.android.barista.interaction.BaristaDialogInteractions.clickDialogNegativeButton import im.vector.app.R -import im.vector.app.espresso.tools.waitUntilActivityVisible import im.vector.app.espresso.tools.waitUntilViewVisible -import im.vector.app.features.settings.font.FontScaleSettingActivity class SettingsPreferencesRobot { @@ -34,8 +33,7 @@ class SettingsPreferencesRobot { clickOn(R.string.settings_theme) clickDialogNegativeButton() clickOn(R.string.font_size) - waitUntilActivityVisible { - pressBack() - } + waitUntilViewVisible(withId(R.id.fons_scale_recycler)) + pressBack() } } diff --git a/vector/src/main/java/im/vector/app/features/VectorFeatures.kt b/vector/src/main/java/im/vector/app/features/VectorFeatures.kt index b48fb62a3a..3a56f31b72 100644 --- a/vector/src/main/java/im/vector/app/features/VectorFeatures.kt +++ b/vector/src/main/java/im/vector/app/features/VectorFeatures.kt @@ -46,9 +46,9 @@ class DefaultVectorFeatures : VectorFeatures { override fun isOnboardingAlreadyHaveAccountSplashEnabled() = true override fun isOnboardingSplashCarouselEnabled() = true override fun isOnboardingUseCaseEnabled() = true - override fun isOnboardingPersonalizeEnabled() = false - override fun isOnboardingCombinedRegisterEnabled() = false - override fun isOnboardingCombinedLoginEnabled() = false + override fun isOnboardingPersonalizeEnabled() = true + override fun isOnboardingCombinedRegisterEnabled() = true + override fun isOnboardingCombinedLoginEnabled() = true override fun allowExternalUnifiedPushDistributors(): Boolean = Config.ALLOW_EXTERNAL_UNIFIED_PUSH_DISTRIBUTORS override fun isScreenSharingEnabled(): Boolean = true override fun forceUsageOfOpusEncoder(): Boolean = false