Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-enable and fix testConnectAndVerifyWithConnectionCheck #6663

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ class AppInteractor(
device.findObjectWithTimeout(By.clazz("android.widget.EditText")).apply {
text = accountNumber
}
loginObject.parent.findObject(By.clazz(Button::class.java)).click()
val loginButton = loginObject.parent.findObject(By.clazz(Button::class.java))
loginButton.wait(Until.enabled(true), DEFAULT_INTERACTION_TIMEOUT)
loginButton.click()
}

fun attemptCreateAccount() {
Expand Down Expand Up @@ -91,7 +93,8 @@ class AppInteractor(
device.findObjectWithTimeout(By.res("location_info_test_tag")).click()
return device
.findObjectWithTimeout(
By.res("location_info_connection_out_test_tag"),
// Text exist and contains IP address
By.res("location_info_connection_out_test_tag").textContains("."),
CONNECTION_TIMEOUT
)
.text
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import net.mullvad.mullvadvpn.test.e2e.misc.AccountTestRule
import net.mullvad.mullvadvpn.test.e2e.misc.ConnCheckState
import net.mullvad.mullvadvpn.test.e2e.misc.SimpleMullvadHttpClient
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.RegisterExtension

Expand All @@ -35,7 +34,6 @@ class ConnectionTest : EndToEndTest(BuildConfig.FLAVOR_infrastructure) {
}

@Test
@Disabled("Disabled since the connection check isn't reliable in the stagemole infrastructure.")
fun testConnectAndVerifyWithConnectionCheck() {
// Given
app.launchAndEnsureLoggedIn(accountTestRule.validAccountNumber)
Expand Down
Loading