diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/field/BitwardenTextFieldWithActions.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/field/BitwardenTextFieldWithActions.kt index f27cbd0e4..ec5209fa2 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/field/BitwardenTextFieldWithActions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/field/BitwardenTextFieldWithActions.kt @@ -50,6 +50,7 @@ fun BitwardenTextFieldWithActions( keyboardType: KeyboardType = KeyboardType.Text, trailingIconContent: (@Composable () -> Unit)? = null, actions: @Composable RowScope.() -> Unit = {}, + actionsTestTag: String? = null, textFieldTestTag: String? = null, ) { Row( @@ -73,7 +74,10 @@ fun BitwardenTextFieldWithActions( shouldAddCustomLineBreaks = shouldAddCustomLineBreaks, visualTransformation = visualTransformation, ) - BitwardenRowOfActions(actions) + BitwardenRowOfActions( + modifier = Modifier.run { actionsTestTag?.let { semantics { testTag = it } } ?: this }, + actions = actions, + ) } } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/row/BitwardenRowOfActions.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/row/BitwardenRowOfActions.kt index 90165c431..08d53861b 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/row/BitwardenRowOfActions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/row/BitwardenRowOfActions.kt @@ -26,9 +26,12 @@ import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme * layout individual icons or buttons. */ @Composable -fun BitwardenRowOfActions(actions: @Composable RowScope.() -> Unit) { +fun BitwardenRowOfActions( + modifier: Modifier = Modifier, + actions: @Composable RowScope.() -> Unit, +) { Row( - modifier = Modifier.padding(start = 8.dp), + modifier = modifier.padding(start = 8.dp), horizontalArrangement = Arrangement.spacedBy(8.dp), verticalAlignment = Alignment.CenterVertically, content = actions, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/stepper/BitwardenStepper.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/stepper/BitwardenStepper.kt index e0ce5172d..5310b464a 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/stepper/BitwardenStepper.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/stepper/BitwardenStepper.kt @@ -39,6 +39,7 @@ fun BitwardenStepper( isIncrementEnabled: Boolean = true, isDecrementEnabled: Boolean = true, textFieldReadOnly: Boolean = true, + stepperActionsTestTag: String? = null, increaseButtonTestTag: String? = null, decreaseButtonTestTag: String? = null, ) { @@ -53,6 +54,7 @@ fun BitwardenStepper( value = clampedValue ?.toString() ?: ZERO_WIDTH_CHARACTER, + actionsTestTag = stepperActionsTestTag, actions = { BitwardenIconButtonWithResource( iconRes = IconResource( diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/toggle/BitwardenSwitchWithActions.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/toggle/BitwardenSwitchWithActions.kt index 705331f3f..a9c0c3f66 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/toggle/BitwardenSwitchWithActions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/toggle/BitwardenSwitchWithActions.kt @@ -64,7 +64,7 @@ fun BitwardenSwitchWithActions( onCheckedChange = null, ) - BitwardenRowOfActions(actions) + BitwardenRowOfActions(actions = actions) } } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/generator/GeneratorScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/generator/GeneratorScreen.kt index 4c544f7eb..aa75f8e56 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/generator/GeneratorScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/generator/GeneratorScreen.kt @@ -830,6 +830,7 @@ private fun PassphraseNumWordsCounterItem( value = coercedNumWords, range = minValue..maxValue, onValueChange = onPassphraseNumWordsCounterChange, + stepperActionsTestTag = "NumberOfWordsStepper", increaseButtonTestTag = "NumberOfWordsIncreaseButton", decreaseButtonTestTag = "NumberOfWordsDecreaseButton", modifier = Modifier