QA-954: Add testtags to Send screen elements (#4162)

This commit is contained in:
ifernandezdiaz 2024-10-29 20:21:08 -03:00 committed by GitHub
parent 78e7adfbc1
commit 540ece5a40
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 18 deletions

View file

@ -2,8 +2,7 @@ package com.x8bit.bitwarden.ui.platform.components.stepper
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.semantics import androidx.compose.ui.platform.testTag
import androidx.compose.ui.semantics.testTag
import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.KeyboardType
import com.x8bit.bitwarden.R import com.x8bit.bitwarden.R
import com.x8bit.bitwarden.ui.platform.base.util.ZERO_WIDTH_CHARACTER import com.x8bit.bitwarden.ui.platform.base.util.ZERO_WIDTH_CHARACTER
@ -38,8 +37,6 @@ fun BitwardenStepper(
isDecrementEnabled: Boolean = true, isDecrementEnabled: Boolean = true,
textFieldReadOnly: Boolean = true, textFieldReadOnly: Boolean = true,
stepperActionsTestTag: String? = null, stepperActionsTestTag: String? = null,
increaseButtonTestTag: String? = null,
decreaseButtonTestTag: String? = null,
) { ) {
val clampedValue = value?.coerceIn(range) val clampedValue = value?.coerceIn(range)
if (clampedValue != value && clampedValue != null) { if (clampedValue != value && clampedValue != null) {
@ -64,9 +61,7 @@ fun BitwardenStepper(
} }
}, },
isEnabled = isDecrementEnabled && !isAtRangeMinimum, isEnabled = isDecrementEnabled && !isAtRangeMinimum,
modifier = Modifier.semantics { modifier = Modifier.testTag("DecrementValue"),
decreaseButtonTestTag?.let { testTag = it }
},
) )
BitwardenTonalIconButton( BitwardenTonalIconButton(
vectorIconRes = R.drawable.ic_plus, vectorIconRes = R.drawable.ic_plus,
@ -78,9 +73,7 @@ fun BitwardenStepper(
} }
}, },
isEnabled = isIncrementEnabled && !isAtRangeMaximum, isEnabled = isIncrementEnabled && !isAtRangeMaximum,
modifier = Modifier.semantics { modifier = Modifier.testTag("IncrementValue"),
increaseButtonTestTag?.let { testTag = it }
},
) )
}, },
readOnly = textFieldReadOnly, readOnly = textFieldReadOnly,

View file

@ -613,8 +613,6 @@ private fun PasswordMinNumbersCounterItem(
value = minNumbers.coerceIn(minValue, maxValue), value = minNumbers.coerceIn(minValue, maxValue),
range = minValue..maxValue, range = minValue..maxValue,
onValueChange = onPasswordMinNumbersCounterChange, onValueChange = onPasswordMinNumbersCounterChange,
increaseButtonTestTag = "MinNumberIncreaseButton",
decreaseButtonTestTag = "MinNumberDecreaseButton",
modifier = Modifier modifier = Modifier
.testTag("MinNumberValueLabel") .testTag("MinNumberValueLabel")
.padding(horizontal = 16.dp), .padding(horizontal = 16.dp),
@ -633,8 +631,6 @@ private fun PasswordMinSpecialCharactersCounterItem(
value = minSpecial.coerceIn(minValue, maxValue), value = minSpecial.coerceIn(minValue, maxValue),
range = minValue..maxValue, range = minValue..maxValue,
onValueChange = onPasswordMinSpecialCharactersChange, onValueChange = onPasswordMinSpecialCharactersChange,
increaseButtonTestTag = "MinSpecialIncreaseButton",
decreaseButtonTestTag = "MinSpecialDecreaseButton",
modifier = Modifier modifier = Modifier
.testTag("MinSpecialValueLabel") .testTag("MinSpecialValueLabel")
.padding(horizontal = 16.dp), .padding(horizontal = 16.dp),
@ -720,8 +716,6 @@ private fun PassphraseNumWordsCounterItem(
range = minValue..maxValue, range = minValue..maxValue,
onValueChange = onPassphraseNumWordsCounterChange, onValueChange = onPassphraseNumWordsCounterChange,
stepperActionsTestTag = "NumberOfWordsStepper", stepperActionsTestTag = "NumberOfWordsStepper",
increaseButtonTestTag = "NumberOfWordsIncreaseButton",
decreaseButtonTestTag = "NumberOfWordsDecreaseButton",
modifier = Modifier modifier = Modifier
.testTag("NumberOfWordsLabel") .testTag("NumberOfWordsLabel")
.padding(horizontal = 16.dp), .padding(horizontal = 16.dp),

View file

@ -104,7 +104,8 @@ fun AddSendContent(
text = stringResource(id = R.string.send_disabled_warning), text = stringResource(id = R.string.send_disabled_warning),
modifier = Modifier modifier = Modifier
.padding(horizontal = 16.dp) .padding(horizontal = 16.dp)
.fillMaxWidth(), .fillMaxWidth()
.testTag("SendPolicyInEffectLabel"),
) )
Spacer(modifier = Modifier.height(16.dp)) Spacer(modifier = Modifier.height(16.dp))
} }
@ -113,7 +114,7 @@ fun AddSendContent(
BitwardenInfoCalloutCard( BitwardenInfoCalloutCard(
text = stringResource(id = R.string.send_options_policy_in_effect), text = stringResource(id = R.string.send_options_policy_in_effect),
modifier = Modifier modifier = Modifier
.testTag(tag = "SendOptionsPolicyInEffectLabel") .testTag(tag = "SendPolicyInEffectLabel")
.padding(horizontal = 16.dp) .padding(horizontal = 16.dp)
.fillMaxWidth(), .fillMaxWidth(),
) )