From 5cc96850af9166e016328ff951709aa077d3c0a0 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Wed, 27 Jul 2022 11:50:14 +0100 Subject: [PATCH 1/7] updating font scale access as the activity wait no longer works with the latest changes --- .../app/ui/robot/settings/SettingsPreferencesRobot.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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..67810b6c89 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,6 +17,7 @@ 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 @@ -34,8 +35,7 @@ class SettingsPreferencesRobot { clickOn(R.string.settings_theme) clickDialogNegativeButton() clickOn(R.string.font_size) - waitUntilActivityVisible { - pressBack() - } + waitUntilViewVisible(withId(R.id.fons_scale_recycler)) + pressBack() } } From 746191163ac02e046aeef3b782a7afa58a65394f Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Wed, 27 Jul 2022 12:17:03 +0100 Subject: [PATCH 2/7] updating test verification interaction, there's no skip and we can press back instead --- .../java/im/vector/app/ui/robot/ElementRobot.kt | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) 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..e7e0441c4b 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 @@ -182,13 +182,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") } } From fe0c2fc57f524193f3472e740febd11f1437554a Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Wed, 27 Jul 2022 12:17:59 +0100 Subject: [PATCH 3/7] adding UI test support for the ftue onboarding feature flags --- .../im/vector/app/ui/robot/OnboardingRobot.kt | 82 +++++++++++++++---- 1 file changed, 68 insertions(+), 14 deletions(-) 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..820ec1d353 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 + } 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 + } 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( From 28362b53f80119342bbc87f535eba05367993516 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Wed, 27 Jul 2022 12:18:10 +0100 Subject: [PATCH 4/7] enabling the ftue feature flags --- .../src/main/java/im/vector/app/features/VectorFeatures.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 From 91e4536f371365c94fba67fa3e3efd29c8e8d421 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Wed, 27 Jul 2022 12:54:26 +0100 Subject: [PATCH 5/7] adding changelog entry --- changelog.d/2585.feature | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/2585.feature 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 From 8639b69e73e838e8b321362ff69d7198eacdfe21 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Wed, 27 Jul 2022 13:21:17 +0100 Subject: [PATCH 6/7] removing unused imports --- .../src/androidTest/java/im/vector/app/ui/robot/ElementRobot.kt | 1 - .../im/vector/app/ui/robot/settings/SettingsPreferencesRobot.kt | 2 -- 2 files changed, 3 deletions(-) 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 e7e0441c4b..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 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 67810b6c89..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 @@ -22,9 +22,7 @@ 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 { From 64c875e017267db01a6260380f348acd091004a1 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Wed, 27 Jul 2022 14:05:39 +0100 Subject: [PATCH 7/7] add ticket reference for TODO --- .../java/im/vector/app/ui/robot/OnboardingRobot.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 820ec1d353..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 @@ -44,7 +44,7 @@ class OnboardingRobot { private fun crawlCreateAccount() { if (defaultVectorFeatures.isOnboardingCombinedRegisterEnabled()) { - // TODO + // 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) @@ -57,7 +57,7 @@ class OnboardingRobot { private fun crawlAlreadyHaveAccount() { if (defaultVectorFeatures.isOnboardingCombinedLoginEnabled()) { - // TODO + // TODO https://github.com/vector-im/element-android/issues/6652 } else { clickOn(R.id.loginSplashAlreadyHaveAccount) OnboardingServersRobot().crawlSignIn()