mirror of
https://github.com/hmalik144/Driver.git
synced 2026-03-18 07:26:03 +00:00
- mid commit
Took 4 hours 2 minutes
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
package h_mal.appttude.com.driver.robots
|
||||
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.contrib.DrawerActions
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import h_mal.appttude.com.driver.BaseTestRobot
|
||||
import h_mal.appttude.com.driver.R
|
||||
|
||||
@@ -8,4 +11,20 @@ class HomeRobot : BaseTestRobot() {
|
||||
|
||||
fun checkTitleExists(title: String) = matchText(R.id.prova_title_tv, title)
|
||||
|
||||
fun openDrawer() {
|
||||
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open())
|
||||
}
|
||||
|
||||
fun closeDrawer() {
|
||||
onView(withId(R.id.drawer_layout)).perform(DrawerActions.close())
|
||||
}
|
||||
|
||||
fun updateProfile() {
|
||||
openDrawer()
|
||||
clickButton(R.id.nav_user_settings)
|
||||
}
|
||||
|
||||
fun openDriverProfile() = clickButton(R.id.driver)
|
||||
fun openVehicleProfile() = clickButton(R.id.car)
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
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)
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
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,17 @@
|
||||
package h_mal.appttude.com.driver.robots
|
||||
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.contrib.DrawerActions
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import h_mal.appttude.com.driver.BaseTestRobot
|
||||
import h_mal.appttude.com.driver.R
|
||||
|
||||
fun update(func: UpdateRobot.() -> Unit) = UpdateRobot().apply { func() }
|
||||
class UpdateRobot : BaseTestRobot() {
|
||||
|
||||
fun updateEmail() = clickButton(R.id.update_email_button)
|
||||
fun updatePassword() = clickButton(R.id.update_password_button)
|
||||
fun updateProfile() = clickButton(R.id.update_profile_button)
|
||||
fun deleteProfile() = clickButton(R.id.delete_profile)
|
||||
|
||||
}
|
||||
@@ -33,7 +33,10 @@ class UserAuthenticationActivityTest : FirebaseTest<LoginActivity>(LoginActivity
|
||||
}
|
||||
home {
|
||||
checkTitleExists(getResourceString(R.string.welcome_title))
|
||||
updateProfile()
|
||||
}
|
||||
|
||||
// TODO: update user details
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user