mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
adding onboarding option crawling to the sanity tests
This commit is contained in:
parent
a3dd3a830c
commit
eb763bb5bb
3 changed files with 100 additions and 0 deletions
|
@ -55,6 +55,10 @@ class UiAllScreensSanityTest {
|
|||
fun allScreensTest() {
|
||||
IdlingPolicies.setMasterPolicyTimeout(120, TimeUnit.SECONDS)
|
||||
|
||||
elementRobot.onboarding {
|
||||
crawl()
|
||||
}
|
||||
|
||||
// Create an account
|
||||
val userId = "UiTest_" + UUID.randomUUID().toString()
|
||||
elementRobot.signUp(userId)
|
||||
|
|
|
@ -40,6 +40,10 @@ import timber.log.Timber
|
|||
|
||||
class ElementRobot {
|
||||
|
||||
fun onboarding(block: OnboardingRobot.() -> Unit) {
|
||||
block(OnboardingRobot())
|
||||
}
|
||||
|
||||
fun signUp(userId: String) {
|
||||
val onboardingRobot = OnboardingRobot()
|
||||
onboardingRobot.createAccount(userId = userId)
|
||||
|
|
|
@ -18,6 +18,7 @@ package im.vector.app.ui.robot
|
|||
|
||||
import androidx.test.espresso.Espresso.closeSoftKeyboard
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.Espresso.pressBack
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import com.adevinta.android.barista.assertion.BaristaEnabledAssertions.assertDisabled
|
||||
|
@ -31,6 +32,24 @@ import im.vector.app.waitForView
|
|||
|
||||
class OnboardingRobot {
|
||||
|
||||
fun crawl() {
|
||||
waitUntilViewVisible(withId(R.id.loginSplashSubmit))
|
||||
crawlGetStarted()
|
||||
crawlAlreadyHaveAccount()
|
||||
}
|
||||
|
||||
private fun crawlGetStarted() {
|
||||
clickOn(R.id.loginSplashSubmit)
|
||||
AuthOptionsRobot().crawlGetStarted()
|
||||
pressBack()
|
||||
}
|
||||
|
||||
private fun crawlAlreadyHaveAccount() {
|
||||
clickOn(R.id.loginSplashAlreadyHaveAccount)
|
||||
AuthOptionsRobot().crawlAlreadyHaveAccount()
|
||||
pressBack()
|
||||
}
|
||||
|
||||
fun createAccount(userId: String, password: String = "password", homeServerUrl: String = "http://10.0.2.2:8080") {
|
||||
initSession(true, userId, password, homeServerUrl)
|
||||
}
|
||||
|
@ -73,3 +92,76 @@ class OnboardingRobot {
|
|||
clickOn(R.id.loginSubmit)
|
||||
}
|
||||
}
|
||||
|
||||
class AuthOptionsRobot {
|
||||
|
||||
fun crawlGetStarted() {
|
||||
assertDisplayed(R.id.loginServerTitle, R.string.login_server_title)
|
||||
crawlMatrixServer(isSignUp = true)
|
||||
crawlEmsServer()
|
||||
crawlOtherServer(isSignUp = true)
|
||||
crawlSignInWithMatrixId()
|
||||
}
|
||||
|
||||
fun crawlAlreadyHaveAccount() {
|
||||
assertDisplayed(R.id.loginServerTitle, R.string.login_server_title)
|
||||
crawlMatrixServer(isSignUp = false)
|
||||
crawlEmsServer()
|
||||
crawlOtherServer(isSignUp = false)
|
||||
crawlSignInWithMatrixId()
|
||||
}
|
||||
|
||||
private fun crawlOtherServer(isSignUp: Boolean) {
|
||||
clickOn(R.id.loginServerChoiceOther)
|
||||
waitUntilViewVisible(withId(R.id.loginServerUrlFormTitle))
|
||||
writeTo(R.id.loginServerUrlFormHomeServerUrl, "https://chat.mozilla.org")
|
||||
clickOn(R.id.loginServerUrlFormSubmit)
|
||||
waitUntilViewVisible(withId(R.id.loginSignupSigninTitle))
|
||||
assertDisplayed(R.id.loginSignupSigninText, "Connect to chat.mozilla.org")
|
||||
assertDisplayed(R.id.loginSignupSigninSubmit, R.string.login_signin_sso)
|
||||
pressBack()
|
||||
|
||||
writeTo(R.id.loginServerUrlFormHomeServerUrl, "https://matrix.org")
|
||||
clickOn(R.id.loginServerUrlFormSubmit)
|
||||
assetMatrixSignInOptions(isSignUp)
|
||||
pressBack()
|
||||
pressBack()
|
||||
}
|
||||
|
||||
private fun crawlEmsServer() {
|
||||
clickOn(R.id.loginServerChoiceEms)
|
||||
waitUntilViewVisible(withId(R.id.loginServerUrlFormTitle))
|
||||
assertDisplayed(R.id.loginServerUrlFormTitle, R.string.login_connect_to_modular)
|
||||
|
||||
writeTo(R.id.loginServerUrlFormHomeServerUrl, "https://one.ems.host")
|
||||
clickOn(R.id.loginServerUrlFormSubmit)
|
||||
|
||||
waitUntilViewVisible(withId(R.id.loginSignupSigninTitle))
|
||||
assertDisplayed(R.id.loginSignupSigninText, "one.ems.host")
|
||||
assertDisplayed(R.id.loginSignupSigninSubmit, R.string.login_signin_sso)
|
||||
pressBack()
|
||||
pressBack()
|
||||
}
|
||||
|
||||
private fun crawlMatrixServer(isSignUp: Boolean) {
|
||||
clickOn(R.id.loginServerChoiceMatrixOrg)
|
||||
assetMatrixSignInOptions(isSignUp)
|
||||
pressBack()
|
||||
}
|
||||
|
||||
private fun assetMatrixSignInOptions(isSignUp: Boolean) {
|
||||
waitUntilViewVisible(withId(R.id.loginTitle))
|
||||
when (isSignUp) {
|
||||
true -> assertDisplayed(R.id.loginTitle, "Sign up to matrix.org")
|
||||
false -> assertDisplayed(R.id.loginTitle, "Connect to matrix.org")
|
||||
}
|
||||
}
|
||||
|
||||
private fun crawlSignInWithMatrixId() {
|
||||
clickOn(R.id.loginServerIKnowMyIdSubmit)
|
||||
waitUntilViewVisible(withId(R.id.loginTitle))
|
||||
assertDisplayed(R.id.loginTitle, R.string.login_signin_matrix_id_title)
|
||||
pressBack()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue