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 26, 2024
1 parent c74e13e commit 4dee0fd
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 4dee0fd

Please sign in to comment.