mirror of
https://github.com/hmalik144/Driver.git
synced 2026-03-18 07:26:03 +00:00
- Tests updated and yml updated
Took 1 hour 2 minutes
This commit is contained in:
@@ -62,6 +62,15 @@ jobs:
|
|||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: app/build/reports/androidTests/connected
|
path: app/build/reports/androidTests/connected
|
||||||
destination: reports
|
destination: reports
|
||||||
|
# Then publish the artifacts of the Firebase emulator logs!
|
||||||
|
- run:
|
||||||
|
name: save firebase emulator logs
|
||||||
|
command: |
|
||||||
|
mkdir -p /tmp/firebase_logs
|
||||||
|
cp *.log /tmp/firebase_logs
|
||||||
|
- store_artifacts:
|
||||||
|
path: /tmp/firebase_logs
|
||||||
|
destination: logs
|
||||||
# Then publish the results of the Instrumentation tests!
|
# Then publish the results of the Instrumentation tests!
|
||||||
- store_test_results:
|
- store_test_results:
|
||||||
path: app/build/outputs/androidTest-results/connected
|
path: app/build/outputs/androidTest-results/connected
|
||||||
|
|||||||
@@ -60,7 +60,8 @@ open class FirebaseTest<T : BaseActivity<*>>(
|
|||||||
|
|
||||||
// remove the user we created for testing
|
// remove the user we created for testing
|
||||||
suspend fun removeUser() {
|
suspend fun removeUser() {
|
||||||
firebaseAuthSource.getUser()?.email?.let {
|
getEmail()?.let {
|
||||||
|
if (firebaseAuthSource.getUser() == null) firebaseAuthSource.signIn(email = it, password = USER_PASSWORD).await()
|
||||||
firebaseAuthSource.reauthenticate(it, USER_PASSWORD).await()
|
firebaseAuthSource.reauthenticate(it, USER_PASSWORD).await()
|
||||||
firebaseAuthSource.deleteProfile().await()
|
firebaseAuthSource.deleteProfile().await()
|
||||||
}
|
}
|
||||||
@@ -68,7 +69,8 @@ open class FirebaseTest<T : BaseActivity<*>>(
|
|||||||
|
|
||||||
fun generateEmailAddress(): String {
|
fun generateEmailAddress(): String {
|
||||||
val suffix = (1000..50000).random()
|
val suffix = (1000..50000).random()
|
||||||
return "test-${suffix}@test-account.com"
|
email ="test-${suffix}@test-account.com"
|
||||||
|
return email!!
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getEmail(): String? {
|
fun getEmail(): String? {
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package h_mal.appttude.com.tests
|
||||||
|
|
||||||
|
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
|
import androidx.test.filters.LargeTest
|
||||||
|
import h_mal.appttude.com.FirebaseTest
|
||||||
|
import h_mal.appttude.com.R
|
||||||
|
import h_mal.appttude.com.USER_PASSWORD
|
||||||
|
import h_mal.appttude.com.robots.home
|
||||||
|
import h_mal.appttude.com.robots.login
|
||||||
|
import h_mal.appttude.com.robots.register
|
||||||
|
import h_mal.appttude.com.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) {
|
||||||
|
|
||||||
|
@Before
|
||||||
|
fun waitForSplashScreen() {
|
||||||
|
waitFor(100)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun verifyUserLogin_validUsernameAndPassword_loggedIn() {
|
||||||
|
login {
|
||||||
|
println("lets get the email = ${getEmail()}")
|
||||||
|
setEmail(getEmail())
|
||||||
|
setPassword(USER_PASSWORD)
|
||||||
|
clickLogin()
|
||||||
|
}
|
||||||
|
home {
|
||||||
|
checkTitleExists(getResourceString(R.string.welcome_title))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,7 +16,7 @@ import org.junit.runner.RunWith
|
|||||||
|
|
||||||
@LargeTest
|
@LargeTest
|
||||||
@RunWith(AndroidJUnit4::class)
|
@RunWith(AndroidJUnit4::class)
|
||||||
class UserAuthenticationActivityTest : FirebaseTest<LoginActivity>(LoginActivity::class.java, registered = true, signedIn = false) {
|
class UserAuthenticationActivityTest : FirebaseTest<LoginActivity>(LoginActivity::class.java) {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun waitForSplashScreen() {
|
fun waitForSplashScreen() {
|
||||||
@@ -40,16 +40,4 @@ class UserAuthenticationActivityTest : FirebaseTest<LoginActivity>(LoginActivity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
fun verifyUserLogin_validUsernameAndPassword_loggedIn() {
|
|
||||||
login {
|
|
||||||
println("lets get the email = ${getEmail()}")
|
|
||||||
setEmail(getEmail())
|
|
||||||
setPassword(USER_PASSWORD)
|
|
||||||
clickLogin()
|
|
||||||
}
|
|
||||||
home {
|
|
||||||
checkTitleExists(getResourceString(R.string.welcome_title))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user