Skip to content

Commit

Permalink
Fix flaky removal of VPN profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Rawa committed Nov 14, 2024
1 parent b791bda commit b074574
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice
import androidx.test.uiautomator.UiObject2
import androidx.test.uiautomator.Until
import net.mullvad.mullvadvpn.test.common.constant.DEFAULT_TIMEOUT
import java.util.regex.Pattern
import net.mullvad.mullvadvpn.test.common.extension.findObjectByCaseInsensitiveText
import net.mullvad.mullvadvpn.test.common.extension.findObjectWithTimeout
Expand All @@ -22,8 +24,11 @@ class ForgetAllVpnAppsInSettingsTestRule : BeforeTestExecutionCallback {
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
}
)
val vpnSettingsButtons =
device.findObjects(By.res(SETTINGS_PACKAGE, VPN_SETTINGS_BUTTON_ID))

val vpnSettingsSelector = By.res(SETTINGS_PACKAGE, VPN_SETTINGS_BUTTON_ID)
device.wait(Until.hasObject(vpnSettingsSelector), DEFAULT_TIMEOUT)
val vpnSettingsButtons = device.findObjects(vpnSettingsSelector)

vpnSettingsButtons
.filter { !it.isHardcodedVpn() }
.forEach { button ->
Expand Down

0 comments on commit b074574

Please sign in to comment.