diff options
| author | David Göransson <david.goransson@mullvad.net> | 2025-07-29 15:37:07 +0200 |
|---|---|---|
| committer | Jonatan Rhodin <jonatan.rhodin@mullvad.net> | 2025-07-29 16:07:29 +0200 |
| commit | 34c6f795b484494ee81614fff8baf7852ca2d469 (patch) | |
| tree | 00a1ef671391fd110ec3bafdb28185c708d64e2d /android | |
| parent | 93d42e2e3d688e19bb16c41ddc0a9aa119a80903 (diff) | |
| download | mullvadvpn-34c6f795b484494ee81614fff8baf7852ca2d469.tar.xz mullvadvpn-34c6f795b484494ee81614fff8baf7852ca2d469.zip | |
Check for both tag and name in location cells for e2e tests
Diffstat (limited to 'android')
3 files changed, 22 insertions, 1 deletions
diff --git a/android/lib/ui/component/src/main/kotlin/net/mullvad/mullvadvpn/lib/ui/component/relaylist/SelectableRelayListItem.kt b/android/lib/ui/component/src/main/kotlin/net/mullvad/mullvadvpn/lib/ui/component/relaylist/SelectableRelayListItem.kt index 289eb5aa9f..8c38610f9e 100644 --- a/android/lib/ui/component/src/main/kotlin/net/mullvad/mullvadvpn/lib/ui/component/relaylist/SelectableRelayListItem.kt +++ b/android/lib/ui/component/src/main/kotlin/net/mullvad/mullvadvpn/lib/ui/component/relaylist/SelectableRelayListItem.kt @@ -43,7 +43,10 @@ import net.mullvad.mullvadvpn.lib.ui.component.ExpandChevron import net.mullvad.mullvadvpn.lib.ui.designsystem.RelayListItem import net.mullvad.mullvadvpn.lib.ui.designsystem.RelayListItemDefaults import net.mullvad.mullvadvpn.lib.ui.designsystem.RelayListTokens +import net.mullvad.mullvadvpn.lib.ui.tag.CUSTOM_LIST_ENTRY_NAME_TAG import net.mullvad.mullvadvpn.lib.ui.tag.EXPAND_BUTTON_TEST_TAG +import net.mullvad.mullvadvpn.lib.ui.tag.GEOLOCATION_NAME_TAG +import net.mullvad.mullvadvpn.lib.ui.tag.RECENT_NAME_TAG @Composable @Preview @@ -100,6 +103,15 @@ fun SelectableRelayListItem( } Name( + modifier = + Modifier.testTag( + when (relayListItem) { + is RelayListItem.CustomListEntryItem -> CUSTOM_LIST_ENTRY_NAME_TAG + is RelayListItem.CustomListItem -> CUSTOM_LIST_ENTRY_NAME_TAG + is RelayListItem.GeoLocationItem -> GEOLOCATION_NAME_TAG + is RelayListItem.RecentListItem -> RECENT_NAME_TAG + } + ), name = relayListItem.hop.displayName(LocalContext.current), state = relayListItem.state, active = relayListItem.hop.isActive, diff --git a/android/lib/ui/tag/src/main/kotlin/net/mullvad/mullvadvpn/lib/ui/tag/TestTagConstants.kt b/android/lib/ui/tag/src/main/kotlin/net/mullvad/mullvadvpn/lib/ui/tag/TestTagConstants.kt index a8264b9b56..ba022e0edc 100644 --- a/android/lib/ui/tag/src/main/kotlin/net/mullvad/mullvadvpn/lib/ui/tag/TestTagConstants.kt +++ b/android/lib/ui/tag/src/main/kotlin/net/mullvad/mullvadvpn/lib/ui/tag/TestTagConstants.kt @@ -41,6 +41,10 @@ const val CIRCULAR_PROGRESS_INDICATOR_TEST_TAG = "circular_progress_indicator_te const val EXPAND_BUTTON_TEST_TAG = "expand_button_test_tag" const val LOCATION_CELL_TEST_TAG = "location_cell_test_tag" +const val GEOLOCATION_NAME_TAG = "geolocation_name_test_tag" +const val CUSTOM_LIST_NAME_TAG = "custom_list_name_test_tag" +const val CUSTOM_LIST_ENTRY_NAME_TAG = "custom_list_entry_name_test_tag" +const val RECENT_NAME_TAG = "recent_name_test_tag" // ConnectScreen const val SELECT_LOCATION_BUTTON_TEST_TAG = "select_location_button_test_tag" const val CONNECT_BUTTON_TEST_TAG = "connect_button_test_tag" diff --git a/android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/page/SelectLocationPage.kt b/android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/page/SelectLocationPage.kt index 86e3c89a08..404a81f9a8 100644 --- a/android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/page/SelectLocationPage.kt +++ b/android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/page/SelectLocationPage.kt @@ -2,6 +2,7 @@ package net.mullvad.mullvadvpn.test.common.page import androidx.test.uiautomator.By import net.mullvad.mullvadvpn.lib.ui.tag.EXPAND_BUTTON_TEST_TAG +import net.mullvad.mullvadvpn.lib.ui.tag.GEOLOCATION_NAME_TAG import net.mullvad.mullvadvpn.lib.ui.tag.SELECT_LOCATION_SCREEN_TEST_TAG import net.mullvad.mullvadvpn.test.common.extension.findObjectWithTimeout @@ -11,7 +12,11 @@ class SelectLocationPage internal constructor() : Page() { } fun clickLocationExpandButton(locationName: String) { - val locationCell = uiDevice.findObjectWithTimeout(By.text(locationName)).parent.parent + val locationCell = + uiDevice + .findObjectWithTimeout(By.textContains(locationName).res(GEOLOCATION_NAME_TAG)) + .parent + .parent val expandButton = locationCell.findObjectWithTimeout(By.res(EXPAND_BUTTON_TEST_TAG)) expandButton.click() } |
