BIT-2078: Add element IDs for search screen (#1145)

This commit is contained in:
David Perez
2024-06-20 17:08:07 +01:00
committed by Álison Fernandes
parent 1a41fcb5c8
commit 888e079f09
17 changed files with 160 additions and 13 deletions
@@ -21,7 +21,9 @@ fun createMockDisplayItemForCipher(
SearchState.DisplayItem(
id = "mockId-$number",
title = "mockName-$number",
titleTestTag = "CipherNameLabel",
subtitle = "mockUsername-$number",
subtitleTestTag = "CipherSubTitleLabel",
iconData = IconData.Network(
uri = "https://vault.bitwarden.com/icons/www.mockuri.com/icon.png",
fallbackIconRes = R.drawable.ic_login_item,
@@ -30,10 +32,12 @@ fun createMockDisplayItemForCipher(
IconRes(
iconRes = R.drawable.ic_collection,
contentDescription = R.string.collections.asText(),
testTag = "CipherInCollectionIcon",
),
IconRes(
iconRes = R.drawable.ic_attachment,
contentDescription = R.string.attachments.asText(),
testTag = "CipherWithAttachmentsIcon",
),
),
overflowOptions = listOf(
@@ -52,6 +56,7 @@ fun createMockDisplayItemForCipher(
url = "www.mockuri$number.com",
),
),
overflowTestTag = "CipherOptionsButton",
totpCode = "mockTotp-$number",
autofillSelectionOptions = emptyList(),
shouldDisplayMasterPasswordReprompt = false,
@@ -62,16 +67,20 @@ fun createMockDisplayItemForCipher(
SearchState.DisplayItem(
id = "mockId-$number",
title = "mockName-$number",
titleTestTag = "CipherNameLabel",
subtitle = null,
subtitleTestTag = "CipherSubTitleLabel",
iconData = IconData.Local(R.drawable.ic_secure_note_item),
extraIconList = listOf(
IconRes(
iconRes = R.drawable.ic_collection,
contentDescription = R.string.collections.asText(),
testTag = "CipherInCollectionIcon",
),
IconRes(
iconRes = R.drawable.ic_attachment,
contentDescription = R.string.attachments.asText(),
testTag = "CipherWithAttachmentsIcon",
),
),
overflowOptions = listOf(
@@ -81,6 +90,7 @@ fun createMockDisplayItemForCipher(
notes = "mockNotes-$number",
),
),
overflowTestTag = "CipherOptionsButton",
totpCode = null,
autofillSelectionOptions = emptyList(),
shouldDisplayMasterPasswordReprompt = false,
@@ -91,16 +101,20 @@ fun createMockDisplayItemForCipher(
SearchState.DisplayItem(
id = "mockId-$number",
title = "mockName-$number",
titleTestTag = "CipherNameLabel",
subtitle = "mockBrand-$number, *er-$number",
subtitleTestTag = "CipherSubTitleLabel",
iconData = IconData.Local(R.drawable.ic_card_item),
extraIconList = listOf(
IconRes(
iconRes = R.drawable.ic_collection,
contentDescription = R.string.collections.asText(),
testTag = "CipherInCollectionIcon",
),
IconRes(
iconRes = R.drawable.ic_attachment,
contentDescription = R.string.attachments.asText(),
testTag = "CipherWithAttachmentsIcon",
),
),
overflowOptions = listOf(
@@ -113,6 +127,7 @@ fun createMockDisplayItemForCipher(
securityCode = "mockCode-$number",
),
),
overflowTestTag = "CipherOptionsButton",
totpCode = null,
autofillSelectionOptions = emptyList(),
shouldDisplayMasterPasswordReprompt = false,
@@ -123,22 +138,27 @@ fun createMockDisplayItemForCipher(
SearchState.DisplayItem(
id = "mockId-$number",
title = "mockName-$number",
titleTestTag = "CipherNameLabel",
subtitle = "mockFirstName-${number}mockLastName-$number",
subtitleTestTag = "CipherSubTitleLabel",
iconData = IconData.Local(R.drawable.ic_identity_item),
extraIconList = listOf(
IconRes(
iconRes = R.drawable.ic_collection,
contentDescription = R.string.collections.asText(),
testTag = "CipherInCollectionIcon",
),
IconRes(
iconRes = R.drawable.ic_attachment,
contentDescription = R.string.attachments.asText(),
testTag = "CipherWithAttachmentsIcon",
),
),
overflowOptions = listOf(
ListingItemOverflowAction.VaultAction.ViewClick(cipherId = "mockId-$number"),
ListingItemOverflowAction.VaultAction.EditClick(cipherId = "mockId-$number"),
),
overflowTestTag = "CipherOptionsButton",
totpCode = null,
autofillSelectionOptions = emptyList(),
shouldDisplayMasterPasswordReprompt = false,
@@ -159,16 +179,20 @@ fun createMockDisplayItemForSend(
SearchState.DisplayItem(
id = "mockId-$number",
title = "mockName-$number",
titleTestTag = "SendNameLabel",
subtitle = "Oct 27, 2023, 12:00 PM",
subtitleTestTag = "SendDateLabel",
iconData = IconData.Local(R.drawable.ic_send_file),
extraIconList = listOf(
IconRes(
iconRes = R.drawable.ic_send_password,
contentDescription = R.string.password.asText(),
testTag = "PasswordProtectedSendIcon",
),
IconRes(
iconRes = R.drawable.ic_send_max_access_count_reached,
contentDescription = R.string.maximum_access_count_reached.asText(),
testTag = "MaxAccessSendIcon",
),
),
overflowOptions = listOf(
@@ -182,6 +206,7 @@ fun createMockDisplayItemForSend(
ListingItemOverflowAction.SendAction.RemovePasswordClick(sendId = "mockId-$number"),
ListingItemOverflowAction.SendAction.DeleteClick(sendId = "mockId-$number"),
),
overflowTestTag = "SendOptionsButton",
totpCode = null,
autofillSelectionOptions = emptyList(),
shouldDisplayMasterPasswordReprompt = false,
@@ -192,16 +217,20 @@ fun createMockDisplayItemForSend(
SearchState.DisplayItem(
id = "mockId-$number",
title = "mockName-$number",
titleTestTag = "SendNameLabel",
subtitle = "Oct 27, 2023, 12:00 PM",
subtitleTestTag = "SendDateLabel",
iconData = IconData.Local(R.drawable.ic_send_text),
extraIconList = listOf(
IconRes(
iconRes = R.drawable.ic_send_password,
contentDescription = R.string.password.asText(),
testTag = "PasswordProtectedSendIcon",
),
IconRes(
iconRes = R.drawable.ic_send_max_access_count_reached,
contentDescription = R.string.maximum_access_count_reached.asText(),
testTag = "MaxAccessSendIcon",
),
),
overflowOptions = listOf(
@@ -215,6 +244,7 @@ fun createMockDisplayItemForSend(
ListingItemOverflowAction.SendAction.RemovePasswordClick(sendId = "mockId-$number"),
ListingItemOverflowAction.SendAction.DeleteClick(sendId = "mockId-$number"),
),
overflowTestTag = "SendOptionsButton",
totpCode = null,
autofillSelectionOptions = emptyList(),
shouldDisplayMasterPasswordReprompt = false,
@@ -118,22 +118,27 @@ private val ALL_SEND_STATUS_ICONS: List<IconRes> = listOf(
IconRes(
iconRes = SendStatusIcon.DISABLED.iconRes,
contentDescription = SendStatusIcon.DISABLED.contentDescription,
testTag = SendStatusIcon.DISABLED.testTag,
),
IconRes(
iconRes = SendStatusIcon.PASSWORD.iconRes,
contentDescription = SendStatusIcon.PASSWORD.contentDescription,
testTag = SendStatusIcon.PASSWORD.testTag,
),
IconRes(
iconRes = SendStatusIcon.MAX_ACCESS_COUNT_REACHED.iconRes,
contentDescription = SendStatusIcon.MAX_ACCESS_COUNT_REACHED.contentDescription,
testTag = SendStatusIcon.MAX_ACCESS_COUNT_REACHED.testTag,
),
IconRes(
iconRes = SendStatusIcon.EXPIRED.iconRes,
contentDescription = SendStatusIcon.EXPIRED.contentDescription,
testTag = SendStatusIcon.EXPIRED.testTag,
),
IconRes(
iconRes = SendStatusIcon.PENDING_DELETE.iconRes,
contentDescription = SendStatusIcon.PENDING_DELETE.contentDescription,
testTag = SendStatusIcon.PENDING_DELETE.testTag,
),
)
@@ -1469,7 +1469,9 @@ private fun createDisplayItem(number: Int): VaultItemListingState.DisplayItem =
VaultItemListingState.DisplayItem(
id = "mockId-$number",
title = "mockTitle-$number",
titleTestTag = "SendNameLabel",
subtitle = "mockSubtitle-$number",
subtitleTestTag = "SendDateLabel",
iconData = IconData.Local(R.drawable.ic_card_item),
extraIconList = listOf(
IconRes(
@@ -1500,6 +1502,7 @@ private fun createDisplayItem(number: Int): VaultItemListingState.DisplayItem =
ListingItemOverflowAction.SendAction.RemovePasswordClick(sendId = "mockId-$number"),
ListingItemOverflowAction.SendAction.DeleteClick(sendId = "mockId-$number"),
),
optionsTestTag = "SendOptionsButton",
isAutofill = false,
shouldShowMasterPasswordReprompt = false,
)
@@ -1508,12 +1511,15 @@ private fun createCipherDisplayItem(number: Int): VaultItemListingState.DisplayI
VaultItemListingState.DisplayItem(
id = "mockId-$number",
title = "mockTitle-$number",
titleTestTag = "CipherNameLabel",
subtitle = "mockSubtitle-$number",
subtitleTestTag = "CipherSubTitleLabel",
iconData = IconData.Local(R.drawable.ic_vault),
extraIconList = emptyList(),
overflowOptions = listOf(
ListingItemOverflowAction.VaultAction.EditClick(cipherId = "mockId-$number"),
),
optionsTestTag = "CipherOptionsButton",
isAutofill = false,
shouldShowMasterPasswordReprompt = false,
)
@@ -22,7 +22,9 @@ fun createMockDisplayItemForCipher(
VaultItemListingState.DisplayItem(
id = "mockId-$number",
title = "mockName-$number",
titleTestTag = "CipherNameLabel",
subtitle = subtitle,
subtitleTestTag = "CipherSubTitleLabel",
iconData = IconData.Network(
"https://vault.bitwarden.com/icons/www.mockuri.com/icon.png",
fallbackIconRes = R.drawable.ic_login_item,
@@ -31,10 +33,12 @@ fun createMockDisplayItemForCipher(
IconRes(
iconRes = R.drawable.ic_collection,
contentDescription = R.string.collections.asText(),
testTag = "CipherInCollectionIcon",
),
IconRes(
iconRes = R.drawable.ic_attachment,
contentDescription = R.string.attachments.asText(),
testTag = "CipherWithAttachmentsIcon",
),
),
overflowOptions = listOf(
@@ -53,6 +57,7 @@ fun createMockDisplayItemForCipher(
url = "www.mockuri$number.com",
),
),
optionsTestTag = "CipherOptionsButton",
isAutofill = false,
shouldShowMasterPasswordReprompt = false,
)
@@ -62,16 +67,20 @@ fun createMockDisplayItemForCipher(
VaultItemListingState.DisplayItem(
id = "mockId-$number",
title = "mockName-$number",
titleTestTag = "CipherNameLabel",
subtitle = subtitle,
subtitleTestTag = "CipherSubTitleLabel",
iconData = IconData.Local(R.drawable.ic_secure_note_item),
extraIconList = listOf(
IconRes(
iconRes = R.drawable.ic_collection,
contentDescription = R.string.collections.asText(),
testTag = "CipherInCollectionIcon",
),
IconRes(
iconRes = R.drawable.ic_attachment,
contentDescription = R.string.attachments.asText(),
testTag = "CipherWithAttachmentsIcon",
),
),
overflowOptions = listOf(
@@ -81,6 +90,7 @@ fun createMockDisplayItemForCipher(
notes = "mockNotes-$number",
),
),
optionsTestTag = "CipherOptionsButton",
isAutofill = false,
shouldShowMasterPasswordReprompt = false,
)
@@ -90,16 +100,20 @@ fun createMockDisplayItemForCipher(
VaultItemListingState.DisplayItem(
id = "mockId-$number",
title = "mockName-$number",
titleTestTag = "CipherNameLabel",
subtitle = subtitle,
subtitleTestTag = "CipherSubTitleLabel",
iconData = IconData.Local(R.drawable.ic_card_item),
extraIconList = listOf(
IconRes(
iconRes = R.drawable.ic_collection,
contentDescription = R.string.collections.asText(),
testTag = "CipherInCollectionIcon",
),
IconRes(
iconRes = R.drawable.ic_attachment,
contentDescription = R.string.attachments.asText(),
testTag = "CipherWithAttachmentsIcon",
),
),
overflowOptions = listOf(
@@ -112,6 +126,7 @@ fun createMockDisplayItemForCipher(
securityCode = "mockCode-$number",
),
),
optionsTestTag = "CipherOptionsButton",
isAutofill = false,
shouldShowMasterPasswordReprompt = false,
)
@@ -121,22 +136,27 @@ fun createMockDisplayItemForCipher(
VaultItemListingState.DisplayItem(
id = "mockId-$number",
title = "mockName-$number",
titleTestTag = "CipherNameLabel",
subtitle = subtitle,
subtitleTestTag = "CipherSubTitleLabel",
iconData = IconData.Local(R.drawable.ic_identity_item),
extraIconList = listOf(
IconRes(
iconRes = R.drawable.ic_collection,
contentDescription = R.string.collections.asText(),
testTag = "CipherInCollectionIcon",
),
IconRes(
iconRes = R.drawable.ic_attachment,
contentDescription = R.string.attachments.asText(),
testTag = "CipherWithAttachmentsIcon",
),
),
overflowOptions = listOf(
ListingItemOverflowAction.VaultAction.ViewClick(cipherId = "mockId-$number"),
ListingItemOverflowAction.VaultAction.EditClick(cipherId = "mockId-$number"),
),
optionsTestTag = "CipherOptionsButton",
isAutofill = false,
shouldShowMasterPasswordReprompt = false,
)
@@ -156,16 +176,20 @@ fun createMockDisplayItemForSend(
VaultItemListingState.DisplayItem(
id = "mockId-$number",
title = "mockName-$number",
titleTestTag = "SendNameLabel",
subtitle = "Oct 27, 2023, 12:00 PM",
subtitleTestTag = "SendDateLabel",
iconData = IconData.Local(R.drawable.ic_send_file),
extraIconList = listOf(
IconRes(
iconRes = R.drawable.ic_send_password,
contentDescription = R.string.password.asText(),
testTag = "PasswordProtectedSendIcon",
),
IconRes(
iconRes = R.drawable.ic_send_max_access_count_reached,
contentDescription = R.string.maximum_access_count_reached.asText(),
testTag = "MaxAccessSendIcon",
),
),
overflowOptions = listOf(
@@ -179,6 +203,7 @@ fun createMockDisplayItemForSend(
ListingItemOverflowAction.SendAction.RemovePasswordClick(sendId = "mockId-$number"),
ListingItemOverflowAction.SendAction.DeleteClick(sendId = "mockId-$number"),
),
optionsTestTag = "SendOptionsButton",
isAutofill = false,
shouldShowMasterPasswordReprompt = false,
)
@@ -188,16 +213,20 @@ fun createMockDisplayItemForSend(
VaultItemListingState.DisplayItem(
id = "mockId-$number",
title = "mockName-$number",
titleTestTag = "SendNameLabel",
subtitle = "Oct 27, 2023, 12:00 PM",
subtitleTestTag = "SendDateLabel",
iconData = IconData.Local(R.drawable.ic_send_text),
extraIconList = listOf(
IconRes(
iconRes = R.drawable.ic_send_password,
contentDescription = R.string.password.asText(),
testTag = "PasswordProtectedSendIcon",
),
IconRes(
iconRes = R.drawable.ic_send_max_access_count_reached,
contentDescription = R.string.maximum_access_count_reached.asText(),
testTag = "MaxAccessSendIcon",
),
),
overflowOptions = listOf(
@@ -211,6 +240,7 @@ fun createMockDisplayItemForSend(
ListingItemOverflowAction.SendAction.RemovePasswordClick(sendId = "mockId-$number"),
ListingItemOverflowAction.SendAction.DeleteClick(sendId = "mockId-$number"),
),
optionsTestTag = "SendOptionsButton",
isAutofill = false,
shouldShowMasterPasswordReprompt = false,
)
@@ -247,7 +247,11 @@ class CipherViewExtensionsTest {
)
val expected = listOf(VaultTrailingIcon.COLLECTION).map {
IconRes(iconRes = it.iconRes, contentDescription = it.contentDescription)
IconRes(
iconRes = it.iconRes,
contentDescription = it.contentDescription,
testTag = it.testTag,
)
}
val result = cipher.toLabelIcons()
@@ -263,7 +267,11 @@ class CipherViewExtensionsTest {
)
val expected = listOf(VaultTrailingIcon.COLLECTION).map {
IconRes(iconRes = it.iconRes, contentDescription = it.contentDescription)
IconRes(
iconRes = it.iconRes,
contentDescription = it.contentDescription,
testTag = it.testTag,
)
}
val result = cipher.toLabelIcons()
@@ -279,7 +287,11 @@ class CipherViewExtensionsTest {
)
val expected = listOf(VaultTrailingIcon.ATTACHMENT).map {
IconRes(iconRes = it.iconRes, contentDescription = it.contentDescription)
IconRes(
iconRes = it.iconRes,
contentDescription = it.contentDescription,
testTag = it.testTag,
)
}
val result = cipher.toLabelIcons()
@@ -295,7 +307,11 @@ class CipherViewExtensionsTest {
VaultTrailingIcon.COLLECTION,
VaultTrailingIcon.ATTACHMENT,
).map {
IconRes(iconRes = it.iconRes, contentDescription = it.contentDescription)
IconRes(
iconRes = it.iconRes,
contentDescription = it.contentDescription,
testTag = it.testTag,
)
}
val result = cipher.toLabelIcons()