mirror of
https://github.com/hmalik144/Driver.git
synced 2026-03-18 07:26:03 +00:00
- flavours compartmentalised
Took 10 hours 11 minutes
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package h_mal.appttude.com.driver.robots
|
||||
|
||||
import h_mal.appttude.com.driver.BaseTestRobot
|
||||
import h_mal.appttude.com.driver.R
|
||||
|
||||
fun home(func: HomeRobot.() -> Unit) = HomeRobot().apply { func() }
|
||||
class HomeRobot : BaseTestRobot() {
|
||||
|
||||
fun checkTitleExists(title: String) = matchText(R.id.prova_title_tv, title)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package h_mal.appttude.com.driver.robots
|
||||
|
||||
import h_mal.appttude.com.driver.BaseTestRobot
|
||||
import h_mal.appttude.com.driver.R
|
||||
|
||||
|
||||
fun login(func: LoginRobot.() -> Unit) = LoginRobot().apply { func() }
|
||||
class LoginRobot : BaseTestRobot() {
|
||||
|
||||
fun setEmail(email: String?) = fillEditText(R.id.email, email)
|
||||
|
||||
fun setPassword(pass: String) = fillEditText(R.id.password, pass)
|
||||
|
||||
fun clickLogin() = clickButton(R.id.email_sign_in_button)
|
||||
|
||||
fun clickRegister() = clickButton(R.id.register_button)
|
||||
|
||||
fun clickForgotPassword() = clickButton(R.id.forgot)
|
||||
|
||||
fun checkEmailError(err: String) = checkErrorOnTextEntry(R.id.email, err)
|
||||
|
||||
fun checkPasswordError(err: String) = checkErrorOnTextEntry(R.id.password, err)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package h_mal.appttude.com.driver.robots
|
||||
|
||||
import h_mal.appttude.com.driver.BaseTestRobot
|
||||
import h_mal.appttude.com.driver.R
|
||||
|
||||
fun register(func: RegisterRobot.() -> Unit) = RegisterRobot().apply { func() }
|
||||
class RegisterRobot : BaseTestRobot() {
|
||||
|
||||
fun setName(name: String) = fillEditText(R.id.name_register, name)
|
||||
|
||||
fun setEmail(email: String) = fillEditText(R.id.email_register, email)
|
||||
|
||||
fun setPassword(pass: String) = fillEditText(R.id.password_top, pass)
|
||||
|
||||
fun setPasswordConfirm(pass: String) = fillEditText(R.id.password_bottom, pass)
|
||||
|
||||
fun clickLogin() = clickButton(R.id.email_sign_up)
|
||||
|
||||
fun checkNameError(err: String) = checkErrorOnTextEntry(R.id.name_register, err)
|
||||
|
||||
fun checkEmailError(err: String) = checkErrorOnTextEntry(R.id.email_register, err)
|
||||
|
||||
fun checkPasswordError(err: String) = checkErrorOnTextEntry(R.id.password_top, err)
|
||||
|
||||
fun checkPasswordConfirmError(err: String) = checkErrorOnTextEntry(R.id.password_bottom, err)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package h_mal.appttude.com.driver.tests
|
||||
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.LargeTest
|
||||
import h_mal.appttude.com.driver.FirebaseTest
|
||||
import h_mal.appttude.com.driver.R
|
||||
import h_mal.appttude.com.driver.USER_PASSWORD
|
||||
import h_mal.appttude.com.driver.robots.home
|
||||
import h_mal.appttude.com.driver.robots.login
|
||||
import h_mal.appttude.com.driver.ui.user.LoginActivity
|
||||
import org.junit.*
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
|
||||
@LargeTest
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class RegisteredUserAuthenticationActivityTest :
|
||||
FirebaseTest<LoginActivity>(LoginActivity::class.java, registered = true, signedIn = false) {
|
||||
|
||||
@Test
|
||||
fun verifyUserLogin_validUsernameAndPassword_loggedIn() {
|
||||
login {
|
||||
waitFor(1100)
|
||||
setEmail(getEmail())
|
||||
setPassword(USER_PASSWORD)
|
||||
clickLogin()
|
||||
}
|
||||
home {
|
||||
checkTitleExists(getResourceString(R.string.welcome_title))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package h_mal.appttude.com.driver.tests
|
||||
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.LargeTest
|
||||
import h_mal.appttude.com.driver.FirebaseTest
|
||||
import h_mal.appttude.com.driver.R
|
||||
import h_mal.appttude.com.driver.USER_PASSWORD
|
||||
import h_mal.appttude.com.driver.robots.home
|
||||
import h_mal.appttude.com.driver.robots.login
|
||||
import h_mal.appttude.com.driver.robots.register
|
||||
import h_mal.appttude.com.driver.ui.user.LoginActivity
|
||||
import org.junit.*
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
|
||||
@LargeTest
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class UserAuthenticationActivityTest : FirebaseTest<LoginActivity>(LoginActivity::class.java) {
|
||||
|
||||
@Test
|
||||
fun verifyUserRegistration_validUsernameAndPassword_loggedIn() {
|
||||
login {
|
||||
waitFor(1100)
|
||||
clickRegister()
|
||||
}
|
||||
register {
|
||||
setName("Test User")
|
||||
setEmail(generateEmailAddress())
|
||||
setPassword(USER_PASSWORD)
|
||||
setPasswordConfirm(USER_PASSWORD)
|
||||
clickLogin()
|
||||
}
|
||||
home {
|
||||
checkTitleExists(getResourceString(R.string.welcome_title))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user