Skip to content

Commit 9e943bb

Browse files
committed
Fix test tags
1 parent 76cfee7 commit 9e943bb

File tree

4 files changed

+18
-15
lines changed

4 files changed

+18
-15
lines changed

android/lib/feature/location/impl/src/androidTest/kotlin/net/mullvad/mullvadvpn/feature/location/impl/SelectLocationScreenTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import net.mullvad.mullvadvpn.lib.model.RelayListType
3434
import net.mullvad.mullvadvpn.lib.ui.component.relaylist.RelayListItem
3535
import net.mullvad.mullvadvpn.lib.ui.designsystem.Hierarchy
3636
import net.mullvad.mullvadvpn.lib.ui.designsystem.Position
37-
import net.mullvad.mullvadvpn.lib.ui.tag.GEOLOCATION_NAME_TAG
37+
import net.mullvad.mullvadvpn.lib.ui.tag.GEOLOCATION_ITEM_TAG
3838
import net.mullvad.mullvadvpn.lib.ui.tag.RECENT_CELL_TEST_TAG
3939
import net.mullvad.mullvadvpn.lib.ui.tag.SELECT_LOCATION_CUSTOM_LIST_BOTTOM_SHEET_TEST_TAG
4040
import net.mullvad.mullvadvpn.lib.ui.tag.SELECT_LOCATION_LOCATION_BOTTOM_SHEET_TEST_TAG
@@ -495,7 +495,7 @@ class SelectLocationScreenTest {
495495

496496
// Assert
497497
onNodeTextAndAncestorTag(
498-
ancestorTag = GEOLOCATION_NAME_TAG,
498+
ancestorTag = GEOLOCATION_ITEM_TAG,
499499
text = selectableItem.name,
500500
useUnmergedTree = true,
501501
)

android/lib/ui/component/src/main/kotlin/net/mullvad/mullvadvpn/lib/ui/component/relaylist/SelectableRelayListItem.kt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ import net.mullvad.mullvadvpn.lib.ui.component.ExpandChevronDivider
1919
import net.mullvad.mullvadvpn.lib.ui.component.listitem.SelectableListItem
2020
import net.mullvad.mullvadvpn.lib.ui.designsystem.ListItemClickArea
2121
import net.mullvad.mullvadvpn.lib.ui.resource.R
22-
import net.mullvad.mullvadvpn.lib.ui.tag.CUSTOM_LIST_ENTRY_NAME_TAG
22+
import net.mullvad.mullvadvpn.lib.ui.tag.CUSTOM_LIST_ENTRY_ITEM_TAG
23+
import net.mullvad.mullvadvpn.lib.ui.tag.CUSTOM_LIST_ITEM_TAG
2324
import net.mullvad.mullvadvpn.lib.ui.tag.EXPAND_BUTTON_TEST_TAG
24-
import net.mullvad.mullvadvpn.lib.ui.tag.GEOLOCATION_NAME_TAG
25-
import net.mullvad.mullvadvpn.lib.ui.tag.RECENT_NAME_TAG
25+
import net.mullvad.mullvadvpn.lib.ui.tag.GEOLOCATION_ITEM_TAG
26+
import net.mullvad.mullvadvpn.lib.ui.tag.RECENT_ITEM_TAG
2627
import net.mullvad.mullvadvpn.lib.ui.theme.AppTheme
2728
import net.mullvad.mullvadvpn.lib.ui.theme.color.AlphaInactive
2829
import net.mullvad.mullvadvpn.lib.ui.theme.color.AlphaVisible
@@ -65,10 +66,10 @@ fun SelectableRelayListItem(
6566
onLongClick = onLongClick,
6667
testTag =
6768
when (relayListItem) {
68-
is RelayListItem.CustomListEntryItem -> CUSTOM_LIST_ENTRY_NAME_TAG
69-
is RelayListItem.CustomListItem -> CUSTOM_LIST_ENTRY_NAME_TAG
70-
is RelayListItem.GeoLocationItem -> GEOLOCATION_NAME_TAG
71-
is RelayListItem.RecentListItem -> RECENT_NAME_TAG
69+
is RelayListItem.CustomListEntryItem -> CUSTOM_LIST_ENTRY_ITEM_TAG
70+
is RelayListItem.CustomListItem -> CUSTOM_LIST_ITEM_TAG
71+
is RelayListItem.GeoLocationItem -> GEOLOCATION_ITEM_TAG
72+
is RelayListItem.RecentListItem -> RECENT_ITEM_TAG
7273
},
7374
trailingContent = {
7475
if (relayListItem.canExpand) {

android/lib/ui/tag/src/main/kotlin/net/mullvad/mullvadvpn/lib/ui/tag/TestTagConstants.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ const val LOCATION_CELL_TEST_TAG = "location_cell_test_tag"
6161
const val RECENT_CELL_TEST_TAG = "recent_cell_test_tag"
6262
const val HOP_SELECTOR_ENTRY_TEST_TAG = "hop_selector_entry_test_tag"
6363

64-
const val GEOLOCATION_NAME_TAG = "geolocation_name_test_tag"
65-
const val CUSTOM_LIST_NAME_TAG = "custom_list_name_test_tag"
66-
const val CUSTOM_LIST_ENTRY_NAME_TAG = "custom_list_entry_name_test_tag"
67-
const val RECENT_NAME_TAG = "recent_name_test_tag"
64+
const val GEOLOCATION_ITEM_TAG = "geolocation_item_test_tag"
65+
const val CUSTOM_LIST_ITEM_TAG = "custom_list_item_test_tag"
66+
const val CUSTOM_LIST_ENTRY_ITEM_TAG = "custom_list_entry_item_test_tag"
67+
const val RECENT_ITEM_TAG = "recent_item_test_tag"
6868
// ConnectScreen
6969
const val SELECT_LOCATION_BUTTON_TEST_TAG = "select_location_button_test_tag"
7070
const val CONNECT_BUTTON_TEST_TAG = "connect_button_test_tag"

android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/page/SelectLocationPage.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import androidx.test.uiautomator.Direction
55
import androidx.test.uiautomator.Until
66
import androidx.test.uiautomator.waitForStableInActiveWindow
77
import net.mullvad.mullvadvpn.lib.ui.tag.EXPAND_BUTTON_TEST_TAG
8-
import net.mullvad.mullvadvpn.lib.ui.tag.GEOLOCATION_NAME_TAG
8+
import net.mullvad.mullvadvpn.lib.ui.tag.GEOLOCATION_ITEM_TAG
99
import net.mullvad.mullvadvpn.lib.ui.tag.SELECT_LOCATION_LIST_TEST_TAG
1010
import net.mullvad.mullvadvpn.lib.ui.tag.SELECT_LOCATION_MENU_BUTTON_TEST_TAG
1111
import net.mullvad.mullvadvpn.lib.ui.tag.SELECT_LOCATION_SCREEN_TEST_TAG
@@ -20,7 +20,9 @@ class SelectLocationPage internal constructor() : Page() {
2020
fun clickLocationExpandButton(locationName: String) {
2121
val locationCell =
2222
uiDevice
23-
.findObjectWithTimeout(By.textContains(locationName).res(GEOLOCATION_NAME_TAG))
23+
.findObjectWithTimeout(
24+
By.textContains(locationName).hasAncestor(By.res(GEOLOCATION_ITEM_TAG))
25+
)
2426
.parent
2527
.parent
2628
val expandButton = locationCell.findObjectWithTimeout(By.res(EXPAND_BUTTON_TEST_TAG))

0 commit comments

Comments
 (0)