Skip to content

Commit

Permalink
Handle alternative wording for deleting VPN profile
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasberglund committed Aug 23, 2024
1 parent 099cceb commit 30d6c3f
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down

0 comments on commit 30d6c3f

Please sign in to comment.