-
Notifications
You must be signed in to change notification settings - Fork 349
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate ConnectionTest e2e tests to use POP
- Loading branch information
1 parent
4baba02
commit 3fe2615
Showing
13 changed files
with
372 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 70 additions & 1 deletion
71
android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/page/ConnectPage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,79 @@ | ||
package net.mullvad.mullvadvpn.test.common.page | ||
|
||
import androidx.test.uiautomator.By | ||
import net.mullvad.mullvadvpn.test.common.constant.VERY_LONG_TIMEOUT | ||
import net.mullvad.mullvadvpn.test.common.extension.findObjectWithTimeout | ||
|
||
class ConnectPage internal constructor() : Page() { | ||
private val disconnectSelector = By.text("Disconnect") | ||
private val cancelSelector = By.text("Cancel") | ||
private val connectedSelector = By.text("CONNECTED") | ||
private val connectingSelector = By.text("CONNECTING...") | ||
|
||
override fun assertIsDisplayed() { | ||
uiDevice.findObjectWithTimeout(By.res("connect_card_header_test_tag")) | ||
uiDevice.findObjectWithTimeout(By.res(CONNECT_CARD_HEADER_TEST_TAG)) | ||
} | ||
|
||
fun clickSelectLocation() { | ||
uiDevice.findObjectWithTimeout(By.res(SELECT_LOCATION_BUTTON_TEST_TAG)).click() | ||
} | ||
|
||
fun clickConnect() { | ||
uiDevice.findObjectWithTimeout(By.res(CONNECT_BUTTON_TEST_TAG)).click() | ||
} | ||
|
||
fun clickDisconnect() { | ||
uiDevice.findObjectWithTimeout(disconnectSelector).click() | ||
} | ||
|
||
fun clickCancel() { | ||
uiDevice.findObjectWithTimeout(cancelSelector).click() | ||
} | ||
|
||
fun waitForConnectedLabel(timeout: Long = VERY_LONG_TIMEOUT) { | ||
uiDevice.findObjectWithTimeout(connectedSelector, timeout) | ||
} | ||
|
||
fun waitForConnectingLabel() { | ||
uiDevice.findObjectWithTimeout(connectingSelector) | ||
} | ||
|
||
/** | ||
* Extracts the in IPv4 address from the connection card. It is a prerequisite that the | ||
* connection card is in collapsed state. | ||
*/ | ||
fun extractInIpv4Address(): String { | ||
uiDevice.findObjectWithTimeout(By.res("connect_card_header_test_tag")).click() | ||
val inString = | ||
uiDevice | ||
.findObjectWithTimeout( | ||
By.res("location_info_connection_in_test_tag"), | ||
VERY_LONG_TIMEOUT, | ||
) | ||
.text | ||
|
||
val extractedIpAddress = inString.split(" ")[0].split(":")[0] | ||
return extractedIpAddress | ||
} | ||
|
||
/** | ||
* Extracts the out IPv4 address from the connection card. It is a prerequisite that the | ||
* connection card is in collapsed state. | ||
*/ | ||
fun extractOutIpv4Address(): String { | ||
uiDevice.findObjectWithTimeout(By.res("connect_card_header_test_tag")).click() | ||
return uiDevice | ||
.findObjectWithTimeout( | ||
// Text exist and contains IP address | ||
By.res("location_info_connection_out_test_tag").textContains("."), | ||
VERY_LONG_TIMEOUT, | ||
) | ||
.text | ||
} | ||
|
||
companion object { | ||
const val CONNECT_CARD_HEADER_TEST_TAG = "connect_card_header_test_tag" | ||
const val SELECT_LOCATION_BUTTON_TEST_TAG = "select_location_button_test_tag" | ||
const val CONNECT_BUTTON_TEST_TAG = "connect_button_test_tag" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/page/SelectLocationPage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package net.mullvad.mullvadvpn.test.common.page | ||
|
||
import androidx.test.uiautomator.By | ||
import net.mullvad.mullvadvpn.test.common.extension.findObjectWithTimeout | ||
|
||
class SelectLocationPage internal constructor() : Page() { | ||
override fun assertIsDisplayed() { | ||
uiDevice.findObjectWithTimeout(By.res(SELECT_LOCATION_SCREEN_TEST_TAG)) | ||
} | ||
|
||
fun clickLocationExpandButton(locationName: String) { | ||
val locationCell = uiDevice.findObjectWithTimeout(By.text(locationName)).parent.parent | ||
val expandButton = locationCell.findObjectWithTimeout(By.res(EXPAND_BUTTON_TEST_TAG)) | ||
expandButton.click() | ||
} | ||
|
||
fun clickLocationCell(locationName: String) { | ||
uiDevice.findObjectWithTimeout(By.text(locationName)).click() | ||
} | ||
|
||
companion object { | ||
const val SELECT_LOCATION_SCREEN_TEST_TAG = "select_location_screen_test_tag" | ||
const val EXPAND_BUTTON_TEST_TAG = "expand_button_test_tag" | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/page/SettingsPage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package net.mullvad.mullvadvpn.test.common.page | ||
|
||
import androidx.test.uiautomator.By | ||
import net.mullvad.mullvadvpn.test.common.extension.findObjectWithTimeout | ||
|
||
class SettingsPage internal constructor() : Page() { | ||
private val settingsSelector = By.text("Settings") | ||
|
||
override fun assertIsDisplayed() { | ||
uiDevice.findObjectWithTimeout(settingsSelector) | ||
} | ||
|
||
fun clickVpnSettings() { | ||
uiDevice.findObjectWithTimeout(By.res(VPN_SETTINGS_CELL_TEST_TAG)).click() | ||
} | ||
|
||
companion object { | ||
const val VPN_SETTINGS_CELL_TEST_TAG = "vpn_settings_cell_test_tag" | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...on/src/main/kotlin/net/mullvad/mullvadvpn/test/common/page/SystemVpnConfigurationAlert.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package net.mullvad.mullvadvpn.test.common.page | ||
|
||
import androidx.test.uiautomator.By | ||
import net.mullvad.mullvadvpn.test.common.extension.findObjectWithTimeout | ||
|
||
class SystemVpnConfigurationAlert internal constructor() : Page() { | ||
private val okSelector = By.text("OK") | ||
|
||
override fun assertIsDisplayed() { | ||
uiDevice.findObjectWithTimeout(okSelector) | ||
} | ||
|
||
fun clickOk() { | ||
uiDevice.findObjectWithTimeout(okSelector).click() | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/page/TopBar.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package net.mullvad.mullvadvpn.test.common.page | ||
|
||
import androidx.test.uiautomator.By | ||
import net.mullvad.mullvadvpn.test.common.extension.findObjectWithTimeout | ||
|
||
class TopBar internal constructor() : Page() { | ||
override fun assertIsDisplayed() { | ||
uiDevice.findObjectWithTimeout(By.res(TOP_BAR_TEST_TAG)) | ||
} | ||
|
||
fun clickSettings() { | ||
uiDevice.findObjectWithTimeout(By.res(TOP_BAR_SETTINGS_BUTTON)).click() | ||
} | ||
|
||
fun clickAccount() { | ||
uiDevice.findObjectWithTimeout(By.res(TOP_BAR_ACCOUNT_BUTTON)).click() | ||
} | ||
|
||
companion object { | ||
const val TOP_BAR_TEST_TAG = "top_bar_test_tag" | ||
const val TOP_BAR_ACCOUNT_BUTTON = "top_bar_account_button" | ||
const val TOP_BAR_SETTINGS_BUTTON = "top_bar_settings_button" | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
...id/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/page/VpnSettingsPage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package net.mullvad.mullvadvpn.test.common.page | ||
|
||
import androidx.test.uiautomator.By | ||
import androidx.test.uiautomator.Direction | ||
import androidx.test.uiautomator.Until | ||
import net.mullvad.mullvadvpn.test.common.extension.findObjectWithTimeout | ||
|
||
class VpnSettingsPage internal constructor() : Page() { | ||
private val vpnSettingsSelector = By.text("VPN settings") | ||
private val localNetworkSharingSelector = By.text("Local network sharing") | ||
|
||
override fun assertIsDisplayed() { | ||
uiDevice.findObjectWithTimeout(vpnSettingsSelector) | ||
} | ||
|
||
fun clickLocalNetworkSharingSwitch() { | ||
val localNetworkSharingCell = | ||
uiDevice.findObjectWithTimeout(localNetworkSharingSelector).parent | ||
val localNetworkSharingSwitch = | ||
localNetworkSharingCell.findObjectWithTimeout(By.res(SWITCH_TEST_TAG)) | ||
|
||
localNetworkSharingSwitch.click() | ||
} | ||
|
||
fun scrollUntilWireguardObfuscationUdpOverTcpCell() { | ||
scrollUntilCell(WIREGUARD_OBFUSCATION_UDP_OVER_TCP_CELL_TEST_TAG) | ||
} | ||
|
||
fun scrollUntilWireguardObfuscationOffCell() { | ||
scrollUntilCell(WIREGUARD_OBFUSCATION_OFF_CELL_TEST_TAG) | ||
} | ||
|
||
fun clickWireguardObfuscationUdpOverTcpCell() { | ||
uiDevice | ||
.findObjectWithTimeout(By.res(WIREGUARD_OBFUSCATION_UDP_OVER_TCP_CELL_TEST_TAG)) | ||
.click() | ||
} | ||
|
||
fun clickWireguardObfuscationOffCell() { | ||
uiDevice.findObjectWithTimeout(By.res(WIREGUARD_OBFUSCATION_OFF_CELL_TEST_TAG)).click() | ||
} | ||
|
||
private fun scrollUntilCell(testTag: String) { | ||
val scrollView2 = uiDevice.findObjectWithTimeout(By.res(SETTINGS_SCROLL_VIEW_TEST_TAG)) | ||
scrollView2.scrollUntil(Direction.DOWN, Until.hasObject(By.res(testTag))) | ||
} | ||
|
||
companion object { | ||
const val SETTINGS_SCROLL_VIEW_TEST_TAG = "lazy_list_vpn_settings_test_tag" | ||
const val WIREGUARD_OBFUSCATION_UDP_OVER_TCP_CELL_TEST_TAG = | ||
"wireguard_obfuscation_udp_over_tcp_cell_test_tag" | ||
const val WIREGUARD_OBFUSCATION_OFF_CELL_TEST_TAG = | ||
"wireguard_obfuscation_off_cell_test_tag" | ||
const val SWITCH_TEST_TAG = "switch_test_tag" | ||
} | ||
} |
Oops, something went wrong.