summaryrefslogtreecommitdiffhomepage
path: root/android/test/common
diff options
context:
space:
mode:
authorsaber safavi <saber.safavi@codic.se>2023-12-28 14:26:36 +0100
committerAlbin <albin@mullvad.net>2024-01-05 10:43:47 +0100
commitb4e789c36efba733b2f267ffd34d7f6875623f76 (patch)
tree1adcd9a45df25c595f1c026f61e4f227b19d089a /android/test/common
parent2d0bad03c6e6ddf193e73fe7e17f582706b1d69d (diff)
downloadmullvadvpn-b4e789c36efba733b2f267ffd34d7f6875623f76.tar.xz
mullvadvpn-b4e789c36efba733b2f267ffd34d7f6875623f76.zip
Add automate logout ui tests
Diffstat (limited to 'android/test/common')
-rw-r--r--android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/interactor/AppInteractor.kt16
1 files changed, 16 insertions, 0 deletions
diff --git a/android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/interactor/AppInteractor.kt b/android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/interactor/AppInteractor.kt
index 2909b4edd0..74bc7703d5 100644
--- a/android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/interactor/AppInteractor.kt
+++ b/android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/interactor/AppInteractor.kt
@@ -49,6 +49,14 @@ class AppInteractor(private val device: UiDevice, private val targetContext: Con
ensureLoggedIn()
}
+ fun launchAndCreateAccount() {
+ launch()
+ device.clickAgreeOnPrivacyDisclaimer()
+ device.clickAllowOnNotificationPermissionPromptIfApiLevel33AndAbove()
+ attemptCreateAccount()
+ ensureAccountCreated()
+ }
+
fun attemptLogin(accountToken: String) {
val loginObject =
device.findObjectWithTimeout(By.clazz("android.widget.EditText")).apply {
@@ -57,6 +65,14 @@ class AppInteractor(private val device: UiDevice, private val targetContext: Con
loginObject.parent.findObject(By.clazz(Button::class.java)).click()
}
+ private fun attemptCreateAccount() {
+ device.findObjectWithTimeout(By.text("Create account")).click()
+ }
+
+ private fun ensureAccountCreated() {
+ device.findObjectWithTimeout(By.text("Congrats!"), LOGIN_TIMEOUT)
+ }
+
fun ensureLoggedIn() {
device.findObjectWithTimeout(By.text("UNSECURED CONNECTION"), LOGIN_TIMEOUT)
}