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

View file

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

View file

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