mirror of
https://github.com/bitwarden/android.git
synced 2025-02-16 20:09:59 +03:00
BIT-2078: Add element IDs for search screen (#1145)
This commit is contained in:
parent
1a41fcb5c8
commit
888e079f09
17 changed files with 160 additions and 13 deletions
|
@ -51,8 +51,10 @@ import kotlinx.collections.immutable.persistentListOf
|
|||
* dialog.
|
||||
* @param modifier An optional [Modifier] for this Composable, defaulting to an empty Modifier.
|
||||
* This allows the caller to specify things like padding, size, etc.
|
||||
* @param labelTestTag The optional test tag for the [label].
|
||||
* @param optionsTestTag The optional test tag for the options button.
|
||||
* @param supportingLabel An optional secondary text label to display beneath the label.
|
||||
* @param supportingLabelTestTag The optional test tag for the [supportingLabel].
|
||||
* @param trailingLabelIcons An optional list of small icons to be displayed after the [label].
|
||||
*/
|
||||
@Suppress("LongMethod")
|
||||
|
@ -63,8 +65,10 @@ fun BitwardenListItem(
|
|||
onClick: () -> Unit,
|
||||
selectionDataList: ImmutableList<SelectionItemData>,
|
||||
modifier: Modifier = Modifier,
|
||||
labelTestTag: String? = null,
|
||||
optionsTestTag: String? = null,
|
||||
supportingLabel: String? = null,
|
||||
supportingLabelTestTag: String? = null,
|
||||
trailingLabelIcons: ImmutableList<IconResource> = persistentListOf(),
|
||||
) {
|
||||
var shouldShowDialog by rememberSaveable { mutableStateOf(false) }
|
||||
|
@ -98,25 +102,30 @@ fun BitwardenListItem(
|
|||
color = MaterialTheme.colorScheme.onSurface,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
modifier = Modifier.weight(weight = 1f, fill = false),
|
||||
modifier = Modifier
|
||||
.semantics { labelTestTag?.let { testTag = it } }
|
||||
.weight(weight = 1f, fill = false),
|
||||
)
|
||||
|
||||
trailingLabelIcons.forEach {
|
||||
trailingLabelIcons.forEach { iconResource ->
|
||||
Spacer(modifier = Modifier.width(8.dp))
|
||||
Icon(
|
||||
painter = it.iconPainter,
|
||||
contentDescription = it.contentDescription,
|
||||
painter = iconResource.iconPainter,
|
||||
contentDescription = iconResource.contentDescription,
|
||||
tint = MaterialTheme.colorScheme.secondary,
|
||||
modifier = Modifier.size(16.dp),
|
||||
modifier = Modifier
|
||||
.semantics { iconResource.testTag?.let { testTag = it } }
|
||||
.size(16.dp),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
supportingLabel?.let {
|
||||
supportingLabel?.let { supportLabel ->
|
||||
Text(
|
||||
text = it,
|
||||
text = supportLabel,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
modifier = Modifier.semantics { supportingLabelTestTag?.let { testTag = it } },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,10 +13,12 @@ import kotlinx.parcelize.Parcelize
|
|||
*
|
||||
* @property iconPainter Painter for the icon.
|
||||
* @property contentDescription String for the icon's content description.
|
||||
* @property testTag The optional test tag to associate with this icon.
|
||||
*/
|
||||
data class IconResource(
|
||||
val iconPainter: Painter,
|
||||
val contentDescription: String,
|
||||
val testTag: String? = null,
|
||||
)
|
||||
|
||||
/**
|
||||
|
@ -24,12 +26,14 @@ data class IconResource(
|
|||
*
|
||||
* @property iconRes Resource for the icon.
|
||||
* @property contentDescription The icon's content description.
|
||||
* @property testTag The optional test tag to associate with this icon.
|
||||
*/
|
||||
@Parcelize
|
||||
data class IconRes(
|
||||
@DrawableRes
|
||||
val iconRes: Int,
|
||||
val contentDescription: Text,
|
||||
val testTag: String? = null,
|
||||
) : Parcelable
|
||||
|
||||
/**
|
||||
|
@ -46,4 +50,5 @@ fun IconRes.toIconResource(): IconResource =
|
|||
IconResource(
|
||||
iconPainter = painterResource(id = iconRes),
|
||||
contentDescription = contentDescription(),
|
||||
testTag = testTag,
|
||||
)
|
||||
|
|
|
@ -112,7 +112,10 @@ fun SearchContent(
|
|||
BitwardenListItem(
|
||||
startIcon = it.iconData,
|
||||
label = it.title,
|
||||
labelTestTag = it.titleTestTag,
|
||||
supportingLabel = it.subtitle,
|
||||
supportingLabelTestTag = it.subtitleTestTag,
|
||||
optionsTestTag = it.overflowTestTag,
|
||||
onClick = {
|
||||
if (it.autofillSelectionOptions.isNotEmpty()) {
|
||||
autofillSelectionOptionsItem = it
|
||||
|
|
|
@ -770,11 +770,14 @@ data class SearchState(
|
|||
data class DisplayItem(
|
||||
val id: String,
|
||||
val title: String,
|
||||
val titleTestTag: String,
|
||||
val subtitle: String?,
|
||||
val subtitleTestTag: String,
|
||||
val totpCode: String?,
|
||||
val iconData: IconData,
|
||||
val extraIconList: List<IconRes>,
|
||||
val overflowOptions: List<ListingItemOverflowAction>,
|
||||
val overflowTestTag: String?,
|
||||
val autofillSelectionOptions: List<AutofillSelectionOption>,
|
||||
val shouldDisplayMasterPasswordReprompt: Boolean,
|
||||
) : Parcelable
|
||||
|
|
|
@ -183,13 +183,16 @@ private fun CipherView.toDisplayItem(
|
|||
SearchState.DisplayItem(
|
||||
id = id.orEmpty(),
|
||||
title = name,
|
||||
titleTestTag = "CipherNameLabel",
|
||||
subtitle = subtitle,
|
||||
subtitleTestTag = "CipherSubTitleLabel",
|
||||
iconData = this.toIconData(
|
||||
baseIconUrl = baseIconUrl,
|
||||
isIconLoadingDisabled = isIconLoadingDisabled,
|
||||
),
|
||||
extraIconList = toLabelIcons(),
|
||||
overflowOptions = toOverflowActions(),
|
||||
overflowTestTag = "CipherOptionsButton",
|
||||
totpCode = login?.totp,
|
||||
autofillSelectionOptions = AutofillSelectionOption
|
||||
.entries
|
||||
|
@ -322,7 +325,9 @@ private fun SendView.toDisplayItem(
|
|||
SearchState.DisplayItem(
|
||||
id = id.orEmpty(),
|
||||
title = name,
|
||||
titleTestTag = "SendNameLabel",
|
||||
subtitle = deletionDate.toFormattedPattern(DELETION_DATE_PATTERN, clock),
|
||||
subtitleTestTag = "SendDateLabel",
|
||||
iconData = IconData.Local(
|
||||
iconRes = when (type) {
|
||||
SendType.TEXT -> R.drawable.ic_send_text
|
||||
|
@ -331,6 +336,7 @@ private fun SendView.toDisplayItem(
|
|||
),
|
||||
extraIconList = toLabelIcons(clock = clock),
|
||||
overflowOptions = toOverflowActions(baseWebSendUrl = baseWebSendUrl),
|
||||
overflowTestTag = "SendOptionsButton",
|
||||
totpCode = null,
|
||||
autofillSelectionOptions = emptyList(),
|
||||
shouldDisplayMasterPasswordReprompt = false,
|
||||
|
|
|
@ -11,25 +11,31 @@ import com.x8bit.bitwarden.ui.platform.base.util.asText
|
|||
enum class SendStatusIcon(
|
||||
@DrawableRes val iconRes: Int,
|
||||
val contentDescription: Text,
|
||||
val testTag: String,
|
||||
) {
|
||||
DISABLED(
|
||||
iconRes = R.drawable.ic_send_disabled,
|
||||
contentDescription = R.string.disabled.asText(),
|
||||
testTag = "DisabledSendIcon",
|
||||
),
|
||||
PASSWORD(
|
||||
iconRes = R.drawable.ic_send_password,
|
||||
contentDescription = R.string.password.asText(),
|
||||
testTag = "PasswordProtectedSendIcon",
|
||||
),
|
||||
EXPIRED(
|
||||
iconRes = R.drawable.ic_send_expired,
|
||||
contentDescription = R.string.expired.asText(),
|
||||
testTag = "ExpiredSendIcon",
|
||||
),
|
||||
MAX_ACCESS_COUNT_REACHED(
|
||||
iconRes = R.drawable.ic_send_max_access_count_reached,
|
||||
contentDescription = R.string.maximum_access_count_reached.asText(),
|
||||
testTag = "MaxAccessSendIcon",
|
||||
),
|
||||
PENDING_DELETE(
|
||||
iconRes = R.drawable.ic_send_pending_delete,
|
||||
contentDescription = R.string.pending_delete.asText(),
|
||||
testTag = "PendingDeletionSendIcon",
|
||||
),
|
||||
}
|
||||
|
|
|
@ -19,7 +19,13 @@ fun SendView.toLabelIcons(clock: Clock = Clock.systemDefaultZone()): List<IconRe
|
|||
SendStatusIcon.EXPIRED.takeIf { expirationDate?.isBefore(clock.instant()) == true },
|
||||
SendStatusIcon.PENDING_DELETE.takeIf { deletionDate.isBefore(clock.instant()) },
|
||||
)
|
||||
.map { IconRes(iconRes = it.iconRes, contentDescription = it.contentDescription) }
|
||||
.map {
|
||||
IconRes(
|
||||
iconRes = it.iconRes,
|
||||
contentDescription = it.contentDescription,
|
||||
testTag = it.testTag,
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the list of overflow actions to be displayed for a [SendView].
|
||||
|
|
|
@ -196,7 +196,10 @@ fun VaultItemListingContent(
|
|||
BitwardenListItem(
|
||||
startIcon = it.iconData,
|
||||
label = it.title,
|
||||
labelTestTag = it.titleTestTag,
|
||||
supportingLabel = it.subtitle,
|
||||
supportingLabelTestTag = it.subtitleTestTag,
|
||||
optionsTestTag = it.optionsTestTag,
|
||||
onClick = {
|
||||
if (it.isAutofill && it.shouldShowMasterPasswordReprompt) {
|
||||
masterPasswordRepromptData =
|
||||
|
|
|
@ -875,9 +875,12 @@ data class VaultItemListingState(
|
|||
*
|
||||
* @property id the id of the item.
|
||||
* @property title title of the item.
|
||||
* @property titleTestTag The test tag associated with the [title].
|
||||
* @property subtitle subtitle of the item (nullable).
|
||||
* @property subtitleTestTag The test tag associated with the [subtitle].
|
||||
* @property iconData data for the icon to be displayed (nullable).
|
||||
* @property overflowOptions list of options for the item's overflow menu.
|
||||
* @property optionsTestTag The test tag associated with the [overflowOptions].
|
||||
* @property isAutofill whether or not this screen is part of an autofill flow.
|
||||
* @property shouldShowMasterPasswordReprompt whether or not a master password reprompt is
|
||||
* required for various secure actions.
|
||||
|
@ -885,10 +888,13 @@ data class VaultItemListingState(
|
|||
data class DisplayItem(
|
||||
val id: String,
|
||||
val title: String,
|
||||
val titleTestTag: String,
|
||||
val subtitle: String?,
|
||||
val subtitleTestTag: String,
|
||||
val iconData: IconData,
|
||||
val extraIconList: List<IconRes>,
|
||||
val overflowOptions: List<ListingItemOverflowAction>,
|
||||
val optionsTestTag: String,
|
||||
val isAutofill: Boolean,
|
||||
val shouldShowMasterPasswordReprompt: Boolean,
|
||||
)
|
||||
|
|
|
@ -272,13 +272,16 @@ private fun CipherView.toDisplayItem(
|
|||
VaultItemListingState.DisplayItem(
|
||||
id = id.orEmpty(),
|
||||
title = name,
|
||||
titleTestTag = "CipherNameLabel",
|
||||
subtitle = subtitle,
|
||||
subtitleTestTag = "CipherSubTitleLabel",
|
||||
iconData = this.toIconData(
|
||||
baseIconUrl = baseIconUrl,
|
||||
isIconLoadingDisabled = isIconLoadingDisabled,
|
||||
),
|
||||
extraIconList = toLabelIcons(),
|
||||
overflowOptions = toOverflowActions(),
|
||||
optionsTestTag = "CipherOptionsButton",
|
||||
isAutofill = isAutofill,
|
||||
shouldShowMasterPasswordReprompt = reprompt == CipherRepromptType.PASSWORD,
|
||||
)
|
||||
|
@ -308,7 +311,9 @@ private fun SendView.toDisplayItem(
|
|||
VaultItemListingState.DisplayItem(
|
||||
id = id.orEmpty(),
|
||||
title = name,
|
||||
titleTestTag = "SendNameLabel",
|
||||
subtitle = deletionDate.toFormattedPattern(DELETION_DATE_PATTERN, clock),
|
||||
subtitleTestTag = "SendDateLabel",
|
||||
iconData = IconData.Local(
|
||||
iconRes = when (type) {
|
||||
SendType.TEXT -> R.drawable.ic_send_text
|
||||
|
@ -317,6 +322,7 @@ private fun SendView.toDisplayItem(
|
|||
),
|
||||
extraIconList = toLabelIcons(clock = clock),
|
||||
overflowOptions = toOverflowActions(baseWebSendUrl = baseWebSendUrl),
|
||||
optionsTestTag = "SendOptionsButton",
|
||||
isAutofill = false,
|
||||
shouldShowMasterPasswordReprompt = false,
|
||||
)
|
||||
|
|
|
@ -53,6 +53,10 @@ fun CipherView.toLabelIcons(): List<IconRes> {
|
|||
VaultTrailingIcon.ATTACHMENT.takeIf { this.attachments?.isNotEmpty() == true },
|
||||
)
|
||||
.map {
|
||||
IconRes(iconRes = it.iconRes, contentDescription = it.contentDescription)
|
||||
IconRes(
|
||||
iconRes = it.iconRes,
|
||||
contentDescription = it.contentDescription,
|
||||
testTag = it.testTag,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,13 +11,16 @@ import com.x8bit.bitwarden.ui.platform.base.util.asText
|
|||
enum class VaultTrailingIcon(
|
||||
@DrawableRes val iconRes: Int,
|
||||
val contentDescription: Text,
|
||||
val testTag: String,
|
||||
) {
|
||||
COLLECTION(
|
||||
iconRes = R.drawable.ic_collection,
|
||||
contentDescription = R.string.collections.asText(),
|
||||
testTag = "CipherInCollectionIcon",
|
||||
),
|
||||
ATTACHMENT(
|
||||
iconRes = R.drawable.ic_attachment,
|
||||
contentDescription = R.string.attachments.asText(),
|
||||
testTag = "CipherWithAttachmentsIcon",
|
||||
),
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Add table
Reference in a new issue