mirror of
https://github.com/hmalik144/Driver.git
synced 2026-03-18 07:26:03 +00:00
- mid commit
Took 8 hours 5 minutes
This commit is contained in:
@@ -1,18 +1,17 @@
|
||||
package h_mal.appttude.com.driver.robots
|
||||
|
||||
import h_mal.appttude.com.driver.BaseTestRobot
|
||||
import h_mal.appttude.com.driver.FormRobot
|
||||
import h_mal.appttude.com.driver.R
|
||||
|
||||
fun delete(func: DeleteRobot.() -> Unit) = DeleteRobot().apply { func() }
|
||||
class DeleteRobot : BaseTestRobot() {
|
||||
class DeleteRobot : FormRobot() {
|
||||
|
||||
fun enterEmail(email: String) = fillEditText(R.id.email_update, email)
|
||||
fun enterPassword(password: String) = fillEditText(R.id.password_top, password)
|
||||
fun submitDelete() = clickButton(R.id.submission_button_label)
|
||||
|
||||
fun submitForm(email: String, password: String) {
|
||||
enterEmail(email)
|
||||
enterPassword(password)
|
||||
submitDelete()
|
||||
submit()
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,21 @@
|
||||
package h_mal.appttude.com.driver.robots
|
||||
|
||||
import h_mal.appttude.com.driver.BaseTestRobot
|
||||
import h_mal.appttude.com.driver.FormRobot
|
||||
import h_mal.appttude.com.driver.R
|
||||
import h_mal.appttude.com.driver.helpers.LICENSE
|
||||
import h_mal.appttude.com.driver.helpers.getImagePath
|
||||
|
||||
fun driversLicense(func: DriversLicenseRobot.() -> Unit) = DriversLicenseRobot().apply { func() }
|
||||
class DriversLicenseRobot : BaseTestRobot() {
|
||||
class DriversLicenseRobot : FormRobot() {
|
||||
|
||||
fun enterLicenseNumber(text: String) = fillEditText(R.id.lic_no, text)
|
||||
fun enterLicenseExpiry(text: String) = fillEditText(R.id.lic_expiry, text)
|
||||
fun selectImage() = clickButton(R.id.search_image)
|
||||
fun clickSubmit() = clickButton(R.id.submit)
|
||||
fun enterLicenseExpiry(year: Int, monthOfYear: Int, dayOfMonth: Int) = setDate(R.id.lic_expiry, year, monthOfYear, dayOfMonth)
|
||||
fun selectImage() = selectSingleImage(R.id.search_image, getImagePath(LICENSE))
|
||||
|
||||
fun submitForm(licenseNumber: String, licenseExpiry: String) {
|
||||
fun submitForm(licenseNumber: String, year: Int, monthOfYear: Int, dayOfMonth: Int) {
|
||||
selectImage()
|
||||
// TODO: select image in gallery
|
||||
enterLicenseNumber(licenseNumber)
|
||||
enterLicenseExpiry(licenseExpiry)
|
||||
clickSubmit()
|
||||
enterLicenseExpiry(year, monthOfYear, dayOfMonth)
|
||||
submit()
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,26 @@
|
||||
package h_mal.appttude.com.driver.robots
|
||||
|
||||
import h_mal.appttude.com.driver.BaseTestRobot
|
||||
import android.text.InputType
|
||||
import h_mal.appttude.com.driver.FormRobot
|
||||
import h_mal.appttude.com.driver.R
|
||||
|
||||
fun driversProfile(func: DriversProfileRobot.() -> Unit) = DriversProfileRobot().apply { func() }
|
||||
class DriversProfileRobot : BaseTestRobot() {
|
||||
class DriversProfileRobot : FormRobot() {
|
||||
|
||||
fun enterName(name: String) = fillEditText(R.id.names_input, name)
|
||||
fun enterAddress(address: String) = fillEditText(R.id.address_input, address)
|
||||
fun enterPostcode(postcode: String) = fillEditText(R.id.postcode_input, postcode)
|
||||
fun enterDateOfBirth(dob: String) = fillEditText(R.id.dob_input, dob)
|
||||
fun enterNINumber(niNumber: String) = fillEditText(R.id.ni_number, niNumber)
|
||||
fun enterDateFirstAvailable(year: Int, monthOfYear: Int, dayOfMonth: Int) = setDate(R.id.date_first, year, monthOfYear, dayOfMonth)
|
||||
|
||||
fun enterLicenseNumber(text: String) = fillEditText(R.id.lic_no, text)
|
||||
fun enterLicenseExpiry(text: String) = fillEditText(R.id.lic_expiry, text)
|
||||
fun selectImage() = clickButton(R.id.add_photo)
|
||||
fun clickSubmit() = clickButton(R.id.submit_driver)
|
||||
|
||||
fun submitForm(licenseNumber: String, licenseExpiry: String) {
|
||||
fun submitForm(name: String, address: String, postcode: String, dob: String, niNumber: String, year: Int, monthOfYear: Int, dayOfMonth: Int) {
|
||||
selectImage()
|
||||
// TODO: select image in gallery
|
||||
enterLicenseNumber(licenseNumber)
|
||||
enterLicenseExpiry(licenseExpiry)
|
||||
clickSubmit()
|
||||
enterName(name)
|
||||
enterAddress(address)
|
||||
submit()
|
||||
}
|
||||
}
|
||||
@@ -27,4 +27,5 @@ class HomeRobot : BaseTestRobot() {
|
||||
fun openDriverProfile() = clickButton(R.id.driver)
|
||||
fun openVehicleProfile() = clickButton(R.id.car)
|
||||
|
||||
fun requestProfile() = clickButton(R.id.request_driver_button)
|
||||
}
|
||||
@@ -1,22 +1,19 @@
|
||||
@file:JvmName("UpdateEmailRobotKt")
|
||||
|
||||
package h_mal.appttude.com.driver.robots
|
||||
|
||||
import h_mal.appttude.com.driver.BaseTestRobot
|
||||
import h_mal.appttude.com.driver.FormRobot
|
||||
import h_mal.appttude.com.driver.R
|
||||
|
||||
fun updateEmail(func: UpdateEmailRobot.() -> Unit) = UpdateEmailRobot().apply { func() }
|
||||
class UpdateEmailRobot : BaseTestRobot() {
|
||||
class UpdateEmailRobot : FormRobot() {
|
||||
|
||||
fun enterEmail(email: String) = fillEditText(R.id.email_update, email)
|
||||
fun enterPassword(password: String) = fillEditText(R.id.password_top, password)
|
||||
fun enterNewEmail(email: String) = fillEditText(R.id.new_email, email)
|
||||
fun submitDelete() = clickButton(R.id.submission_button_label)
|
||||
|
||||
fun submitForm(email: String, password: String, newEmail: String) {
|
||||
enterEmail(email)
|
||||
enterPassword(password)
|
||||
enterNewEmail(newEmail)
|
||||
submitDelete()
|
||||
submit()
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
package h_mal.appttude.com.driver.robots
|
||||
|
||||
import h_mal.appttude.com.driver.BaseTestRobot
|
||||
import h_mal.appttude.com.driver.FormRobot
|
||||
import h_mal.appttude.com.driver.R
|
||||
|
||||
fun updatePassword(func: UpdatePasswordRobot.() -> Unit) = UpdatePasswordRobot().apply { func() }
|
||||
class UpdatePasswordRobot : BaseTestRobot() {
|
||||
class UpdatePasswordRobot : FormRobot() {
|
||||
|
||||
fun enterEmail(email: String) = fillEditText(R.id.email_update, email)
|
||||
fun enterPassword(password: String) = fillEditText(R.id.password_top, password)
|
||||
fun enterNewPassword(email: String) = fillEditText(R.id.password_bottom, email)
|
||||
fun submitDelete() = clickButton(R.id.email_sign_up)
|
||||
fun submitDelete() = clickButton(R.id.submit)
|
||||
|
||||
fun submitForm(email: String, password: String, newPassword: String) {
|
||||
enterEmail(email)
|
||||
enterPassword(password)
|
||||
enterNewPassword(newPassword)
|
||||
submitDelete()
|
||||
submit()
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,18 @@
|
||||
package h_mal.appttude.com.driver.robots
|
||||
|
||||
import h_mal.appttude.com.driver.BaseTestRobot
|
||||
import h_mal.appttude.com.driver.FormRobot
|
||||
import h_mal.appttude.com.driver.R
|
||||
import h_mal.appttude.com.driver.helpers.PROFILE_PIC
|
||||
|
||||
fun updateProfile(func: UpdateProfileRobot.() -> Unit) = UpdateProfileRobot().apply { func() }
|
||||
class UpdateProfileRobot : BaseTestRobot() {
|
||||
class UpdateProfileRobot : FormRobot() {
|
||||
|
||||
fun enterName(name: String) = fillEditText(R.id.update_name, name)
|
||||
fun selectImage() = clickButton(R.id.profile_img)
|
||||
fun submitProfileUpdate() = clickButton(R.id.submit_update_profile)
|
||||
// fun selectImage() = selectSingleImage(R.id.profile_img, PROFILE_PIC)
|
||||
|
||||
fun submitForm(name: String) {
|
||||
selectImage()
|
||||
// TODO: select image in gallery
|
||||
// selectImage()
|
||||
enterName(name)
|
||||
submitProfileUpdate()
|
||||
submit()
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,5 @@
|
||||
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
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package h_mal.appttude.com.driver.tests.newUser
|
||||
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.LargeTest
|
||||
import androidx.test.rule.GrantPermissionRule
|
||||
import h_mal.appttude.com.driver.FirebaseTest
|
||||
import h_mal.appttude.com.driver.R
|
||||
import h_mal.appttude.com.driver.robots.*
|
||||
import h_mal.appttude.com.driver.ui.MainActivity
|
||||
import h_mal.appttude.com.driver.ui.user.LoginActivity
|
||||
import org.junit.*
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
|
||||
@LargeTest
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class SubmitNewDataActivityTest :
|
||||
FirebaseTest<MainActivity>(MainActivity::class.java, registered = true, signedIn = true) {
|
||||
|
||||
@get:Rule var permissionRule = GrantPermissionRule.grant(android.Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||
|
||||
@Test
|
||||
fun verifyUserRegistration_validUsernameAndPassword_loggedIn() {
|
||||
home {
|
||||
waitFor(2500)
|
||||
checkTitleExists(getResourceString(R.string.welcome_title))
|
||||
requestProfile()
|
||||
openDriverProfile()
|
||||
}
|
||||
driverScreen {
|
||||
|
||||
driverLicense()
|
||||
}
|
||||
driversLicense {
|
||||
submitForm("SAMPLE8456310LTU", 2022, 10, 2)
|
||||
}
|
||||
waitFor(5000)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user