From 4dee0fddf152892ecbc7021dec8cf591fdaf2c02 Mon Sep 17 00:00:00 2001 From: Niklas Berglund Date: Fri, 23 Aug 2024 11:41:39 +0200 Subject: [PATCH] Handle alternative wording for deleting VPN profile --- .../rule/ForgetAllVpnAppsInSettingsTestRule.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/rule/ForgetAllVpnAppsInSettingsTestRule.kt b/android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/rule/ForgetAllVpnAppsInSettingsTestRule.kt index 9457b7862e38..2bb751c5d261 100644 --- a/android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/rule/ForgetAllVpnAppsInSettingsTestRule.kt +++ b/android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/rule/ForgetAllVpnAppsInSettingsTestRule.kt @@ -23,14 +23,22 @@ class ForgetAllVpnAppsInSettingsTestRule : BeforeTestExecutionCallback { device.findObjects(By.res(SETTINGS_PACKAGE, VPN_SETTINGS_BUTTON_ID)) vpnSettingsButtons.forEach { button -> button.click() - device.findObjectWithTimeout(By.text(FORGET_VPN_VPN_BUTTON_TEXT)).click() - device.findObjectByCaseInsensitiveText(FORGET_VPN_VPN_CONFIRM_BUTTON_TEXT).click() + + try { + device.findObjectWithTimeout(By.text(FORGET_VPN_VPN_BUTTON_TEXT)).click() + device.findObjectByCaseInsensitiveText(FORGET_VPN_VPN_CONFIRM_BUTTON_TEXT).click() + } catch (_: Exception) { + device.findObjectWithTimeout(By.text(DELETE_VPN_PROFILE_TEXT)).click() + device.findObjectWithTimeout(By.text(DELETE_VPN_CONFIRM_BUTTON_TEXT)).click() + } } } companion object { private const val FORGET_VPN_VPN_BUTTON_TEXT = "Forget VPN" + private const val DELETE_VPN_PROFILE_TEXT = "Delete VPN profile" private const val FORGET_VPN_VPN_CONFIRM_BUTTON_TEXT = "Forget" + private const val DELETE_VPN_CONFIRM_BUTTON_TEXT = "DELETE" private const val SETTINGS_PACKAGE = "com.android.settings" private const val VPN_SETTINGS_BUTTON_ID = "settings_button" }