diff options
| author | Albin <albin@mullvad.net> | 2024-01-05 11:04:58 +0100 |
|---|---|---|
| committer | Albin <albin@mullvad.net> | 2024-01-05 11:04:58 +0100 |
| commit | f37b61533d7fc544478394755132e89a92041aed (patch) | |
| tree | ab716f760877d893f9c974bfe19422630b8a2abb /android/test/common/src | |
| parent | 2d0bad03c6e6ddf193e73fe7e17f582706b1d69d (diff) | |
| parent | d123576eca7f8f2f2b8540c9d94e40fdce47d523 (diff) | |
| download | mullvadvpn-f37b61533d7fc544478394755132e89a92041aed.tar.xz mullvadvpn-f37b61533d7fc544478394755132e89a92041aed.zip | |
Merge branch 'fix-broken-e2e-tests-droid-609'
Diffstat (limited to 'android/test/common/src')
| -rw-r--r-- | android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/interactor/AppInteractor.kt | 30 |
1 files changed, 23 insertions, 7 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..6921e6b362 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 @@ -13,9 +13,6 @@ import net.mullvad.mullvadvpn.test.common.constant.CONNECTION_TIMEOUT import net.mullvad.mullvadvpn.test.common.constant.LOGIN_PROMPT_TIMEOUT import net.mullvad.mullvadvpn.test.common.constant.LOGIN_TIMEOUT import net.mullvad.mullvadvpn.test.common.constant.MULLVAD_PACKAGE -import net.mullvad.mullvadvpn.test.common.constant.SETTINGS_COG_ID -import net.mullvad.mullvadvpn.test.common.constant.TUNNEL_INFO_ID -import net.mullvad.mullvadvpn.test.common.constant.TUNNEL_OUT_ADDRESS_ID import net.mullvad.mullvadvpn.test.common.extension.clickAgreeOnPrivacyDisclaimer import net.mullvad.mullvadvpn.test.common.extension.clickAllowOnNotificationPermissionPromptIfApiLevel33AndAbove import net.mullvad.mullvadvpn.test.common.extension.findObjectWithTimeout @@ -49,6 +46,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,20 +62,31 @@ 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) } fun extractIpAddress(): String { - device.findObjectWithTimeout(By.res(TUNNEL_INFO_ID)).click() + device.findObjectWithTimeout(By.res("location_info_test_tag")).click() return device - .findObjectWithTimeout(By.res(TUNNEL_OUT_ADDRESS_ID), CONNECTION_TIMEOUT) + .findObjectWithTimeout( + By.res("location_info_connection_out_test_tag"), + CONNECTION_TIMEOUT + ) .text .extractIpAddress() } fun clickSettingsCog() { - device.findObjectWithTimeout(By.res(SETTINGS_COG_ID)).click() + device.findObjectWithTimeout(By.res("top_bar_settings_button")).click() } fun clickAccountCog() { @@ -90,6 +106,6 @@ class AppInteractor(private val device: UiDevice, private val targetContext: Con } private fun String.extractIpAddress(): String { - return split(" ")[1].split(" ")[0] + return split(" ")[1].split(" ")[0] } } |
