mirror of
https://github.com/bitwarden/android.git
synced 2024-11-22 01:16:02 +03:00
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:
parent
9240fb82e4
commit
b7ffa3966d
8 changed files with 10 additions and 14 deletions
|
@ -84,6 +84,7 @@ fun BitwardenSearchTopAppBar(
|
||||||
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done),
|
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.tabNavigation()
|
.tabNavigation()
|
||||||
|
.testTag("SearchFieldEntry")
|
||||||
.focusRequester(focusRequester)
|
.focusRequester(focusRequester)
|
||||||
.fillMaxWidth(),
|
.fillMaxWidth(),
|
||||||
)
|
)
|
||||||
|
|
|
@ -17,7 +17,6 @@ import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.testTag
|
import androidx.compose.ui.platform.testTag
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.semantics.semantics
|
import androidx.compose.ui.semantics.semantics
|
||||||
import androidx.compose.ui.semantics.testTag
|
|
||||||
import androidx.compose.ui.semantics.testTagsAsResourceId
|
import androidx.compose.ui.semantics.testTagsAsResourceId
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.DpOffset
|
import androidx.compose.ui.unit.DpOffset
|
||||||
|
@ -65,6 +64,7 @@ fun BitwardenOverflowActionItem(
|
||||||
containerColor = BitwardenTheme.colorScheme.background.primary,
|
containerColor = BitwardenTheme.colorScheme.background.primary,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.semantics { testTagsAsResourceId = true }
|
.semantics { testTagsAsResourceId = true }
|
||||||
|
.testTag("FloatingOptionsContent")
|
||||||
.widthIn(
|
.widthIn(
|
||||||
min = 112.dp,
|
min = 112.dp,
|
||||||
max = 280.dp,
|
max = 280.dp,
|
||||||
|
@ -72,16 +72,13 @@ fun BitwardenOverflowActionItem(
|
||||||
content = {
|
content = {
|
||||||
menuItemDataList.forEach { dropdownMenuItemData ->
|
menuItemDataList.forEach { dropdownMenuItemData ->
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
modifier = Modifier.semantics {
|
modifier = Modifier.testTag("FloatingOptionsItem"),
|
||||||
dropdownMenuItemData.testTag?.let {
|
|
||||||
testTag = it
|
|
||||||
}
|
|
||||||
},
|
|
||||||
colors = bitwardenMenuItemColors(),
|
colors = bitwardenMenuItemColors(),
|
||||||
text = {
|
text = {
|
||||||
Text(
|
Text(
|
||||||
text = dropdownMenuItemData.text,
|
text = dropdownMenuItemData.text,
|
||||||
style = BitwardenTheme.typography.bodyLarge,
|
style = BitwardenTheme.typography.bodyLarge,
|
||||||
|
modifier = Modifier.testTag("FloatingOptionsItemName"),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
onClick = {
|
onClick = {
|
||||||
|
@ -115,10 +112,8 @@ private fun BitwardenOverflowActionItem_preview() {
|
||||||
*
|
*
|
||||||
* @param text The text displayed for the item in the menu.
|
* @param text The text displayed for the item in the menu.
|
||||||
* @param onClick A callback for when the menu item is clicked.
|
* @param onClick A callback for when the menu item is clicked.
|
||||||
* @param testTag Optional test tag for the menu item.
|
|
||||||
*/
|
*/
|
||||||
data class OverflowMenuItemData(
|
data class OverflowMenuItemData(
|
||||||
val text: String,
|
val text: String,
|
||||||
val onClick: () -> Unit,
|
val onClick: () -> Unit,
|
||||||
val testTag: String? = null,
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -11,6 +11,7 @@ import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.platform.testTag
|
||||||
import androidx.compose.ui.semantics.selected
|
import androidx.compose.ui.semantics.selected
|
||||||
import androidx.compose.ui.semantics.semantics
|
import androidx.compose.ui.semantics.semantics
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
@ -35,6 +36,7 @@ fun BitwardenSelectionRow(
|
||||||
Row(
|
Row(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
|
.testTag("AlertRadioButtonOption")
|
||||||
.clickable(
|
.clickable(
|
||||||
interactionSource = remember { MutableInteractionSource() },
|
interactionSource = remember { MutableInteractionSource() },
|
||||||
indication = ripple(
|
indication = ripple(
|
||||||
|
@ -56,6 +58,7 @@ fun BitwardenSelectionRow(
|
||||||
text = text(),
|
text = text(),
|
||||||
color = BitwardenTheme.colorScheme.text.primary,
|
color = BitwardenTheme.colorScheme.text.primary,
|
||||||
style = BitwardenTheme.typography.bodyLarge,
|
style = BitwardenTheme.typography.bodyLarge,
|
||||||
|
modifier = Modifier.testTag("AlertRadioButtonOptionName"),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.painter.Painter
|
import androidx.compose.ui.graphics.painter.Painter
|
||||||
|
import androidx.compose.ui.platform.testTag
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.semantics.semantics
|
import androidx.compose.ui.semantics.semantics
|
||||||
import androidx.compose.ui.semantics.testTag
|
import androidx.compose.ui.semantics.testTag
|
||||||
|
@ -167,7 +168,7 @@ fun BitwardenListItem(
|
||||||
selectionItems = {
|
selectionItems = {
|
||||||
selectionDataList.forEach { itemData ->
|
selectionDataList.forEach { itemData ->
|
||||||
BitwardenBasicDialogRow(
|
BitwardenBasicDialogRow(
|
||||||
modifier = Modifier.semantics { itemData.testTag?.let { testTag = it } },
|
modifier = Modifier.testTag("AlertSelectionOption"),
|
||||||
text = itemData.text,
|
text = itemData.text,
|
||||||
onClick = {
|
onClick = {
|
||||||
shouldShowDialog = false
|
shouldShowDialog = false
|
||||||
|
|
|
@ -15,7 +15,6 @@ import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.platform.testTag
|
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.core.net.toUri
|
import androidx.core.net.toUri
|
||||||
|
@ -90,7 +89,6 @@ fun SearchScreen(
|
||||||
navigationIconContentDescription = stringResource(id = R.string.back),
|
navigationIconContentDescription = stringResource(id = R.string.back),
|
||||||
onNavigationIconClick = searchHandlers.onBackClick,
|
onNavigationIconClick = searchHandlers.onBackClick,
|
||||||
),
|
),
|
||||||
modifier = Modifier.testTag(tag = "SearchFieldEntry"),
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
|
|
@ -82,7 +82,6 @@ fun PasswordHistoryScreen(
|
||||||
BitwardenOverflowActionItem(
|
BitwardenOverflowActionItem(
|
||||||
menuItemDataList = persistentListOf(
|
menuItemDataList = persistentListOf(
|
||||||
OverflowMenuItemData(
|
OverflowMenuItemData(
|
||||||
testTag = "ClearPasswordList",
|
|
||||||
text = stringResource(id = R.string.clear),
|
text = stringResource(id = R.string.clear),
|
||||||
onClick = remember(viewModel) {
|
onClick = remember(viewModel) {
|
||||||
{
|
{
|
||||||
|
|
|
@ -78,7 +78,6 @@ fun SendListItem(
|
||||||
SelectionItemData(
|
SelectionItemData(
|
||||||
text = stringResource(id = R.string.copy_link),
|
text = stringResource(id = R.string.copy_link),
|
||||||
onClick = onCopyClick,
|
onClick = onCopyClick,
|
||||||
testTag = "Copy",
|
|
||||||
),
|
),
|
||||||
SelectionItemData(
|
SelectionItemData(
|
||||||
text = stringResource(id = R.string.share_link),
|
text = stringResource(id = R.string.share_link),
|
||||||
|
|
|
@ -57,7 +57,7 @@ fun VaultContent(
|
||||||
showDivider = true,
|
showDivider = true,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.testTag("FolderFilter")
|
.testTag("VerificationCodesFilter")
|
||||||
.padding(16.dp),
|
.padding(16.dp),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue