QA-970: Adding testTags for radiobutton and floating options elements (#4188)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Dave Severns <149429124+dseverns-livefront@users.noreply.github.com>
Co-authored-by: David Perez <david@livefront.com>
Co-authored-by: Patrick Honkonen <1883101+SaintPatrck@users.noreply.github.com>
Co-authored-by: Álison Fernandes <vvolkgang@users.noreply.github.com>
This commit is contained in:
ifernandezdiaz 2024-11-01 16:03:44 -03:00 committed by GitHub
parent 9240fb82e4
commit b7ffa3966d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 10 additions and 14 deletions

View file

@ -84,6 +84,7 @@ fun BitwardenSearchTopAppBar(
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done),
modifier = Modifier
.tabNavigation()
.testTag("SearchFieldEntry")
.focusRequester(focusRequester)
.fillMaxWidth(),
)

View file

@ -17,7 +17,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.testTag
import androidx.compose.ui.semantics.testTagsAsResourceId
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.DpOffset
@ -65,6 +64,7 @@ fun BitwardenOverflowActionItem(
containerColor = BitwardenTheme.colorScheme.background.primary,
modifier = Modifier
.semantics { testTagsAsResourceId = true }
.testTag("FloatingOptionsContent")
.widthIn(
min = 112.dp,
max = 280.dp,
@ -72,16 +72,13 @@ fun BitwardenOverflowActionItem(
content = {
menuItemDataList.forEach { dropdownMenuItemData ->
DropdownMenuItem(
modifier = Modifier.semantics {
dropdownMenuItemData.testTag?.let {
testTag = it
}
},
modifier = Modifier.testTag("FloatingOptionsItem"),
colors = bitwardenMenuItemColors(),
text = {
Text(
text = dropdownMenuItemData.text,
style = BitwardenTheme.typography.bodyLarge,
modifier = Modifier.testTag("FloatingOptionsItemName"),
)
},
onClick = {
@ -115,10 +112,8 @@ private fun BitwardenOverflowActionItem_preview() {
*
* @param text The text displayed for the item in the menu.
* @param onClick A callback for when the menu item is clicked.
* @param testTag Optional test tag for the menu item.
*/
data class OverflowMenuItemData(
val text: String,
val onClick: () -> Unit,
val testTag: String? = null,
)

View file

@ -11,6 +11,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.semantics.selected
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
@ -35,6 +36,7 @@ fun BitwardenSelectionRow(
Row(
modifier = modifier
.fillMaxWidth()
.testTag("AlertRadioButtonOption")
.clickable(
interactionSource = remember { MutableInteractionSource() },
indication = ripple(
@ -56,6 +58,7 @@ fun BitwardenSelectionRow(
text = text(),
color = BitwardenTheme.colorScheme.text.primary,
style = BitwardenTheme.typography.bodyLarge,
modifier = Modifier.testTag("AlertRadioButtonOptionName"),
)
}
}

View file

@ -22,6 +22,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.testTag
@ -167,7 +168,7 @@ fun BitwardenListItem(
selectionItems = {
selectionDataList.forEach { itemData ->
BitwardenBasicDialogRow(
modifier = Modifier.semantics { itemData.testTag?.let { testTag = it } },
modifier = Modifier.testTag("AlertSelectionOption"),
text = itemData.text,
onClick = {
shouldShowDialog = false

View file

@ -15,7 +15,6 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.core.net.toUri
@ -90,7 +89,6 @@ fun SearchScreen(
navigationIconContentDescription = stringResource(id = R.string.back),
onNavigationIconClick = searchHandlers.onBackClick,
),
modifier = Modifier.testTag(tag = "SearchFieldEntry"),
)
},
modifier = Modifier

View file

@ -82,7 +82,6 @@ fun PasswordHistoryScreen(
BitwardenOverflowActionItem(
menuItemDataList = persistentListOf(
OverflowMenuItemData(
testTag = "ClearPasswordList",
text = stringResource(id = R.string.clear),
onClick = remember(viewModel) {
{

View file

@ -78,7 +78,6 @@ fun SendListItem(
SelectionItemData(
text = stringResource(id = R.string.copy_link),
onClick = onCopyClick,
testTag = "Copy",
),
SelectionItemData(
text = stringResource(id = R.string.share_link),

View file

@ -57,7 +57,7 @@ fun VaultContent(
showDivider = true,
modifier = Modifier
.fillMaxWidth()
.testTag("FolderFilter")
.testTag("VerificationCodesFilter")
.padding(16.dp),
)
}