mirror of
https://github.com/bitwarden/android.git
synced 2026-08-25 17:09:55 -05:00
QA Automation - Locators for Android (#214)
This commit is contained in:
+9
-3
@@ -251,6 +251,7 @@ fun EditItemContent(
|
||||
Spacer(Modifier.height(8.dp))
|
||||
BitwardenTextField(
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "NameTextField" }
|
||||
.fillMaxSize()
|
||||
.padding(horizontal = 16.dp),
|
||||
label = stringResource(id = R.string.name),
|
||||
@@ -264,6 +265,7 @@ fun EditItemContent(
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
BitwardenPasswordField(
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "KeyTextField" }
|
||||
.fillMaxSize()
|
||||
.padding(horizontal = 16.dp),
|
||||
label = stringResource(id = R.string.key),
|
||||
@@ -278,6 +280,7 @@ fun EditItemContent(
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
BitwardenTextField(
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "UsernameTextField" }
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
label = stringResource(id = R.string.username),
|
||||
@@ -331,6 +334,7 @@ private fun AdvancedOptions(
|
||||
Column(modifier = modifier) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "CollapseAdvancedOptions" }
|
||||
.padding(vertical = 4.dp)
|
||||
.clip(RoundedCornerShape(28.dp))
|
||||
.clickable(
|
||||
@@ -381,7 +385,7 @@ private fun AdvancedOptions(
|
||||
BitwardenMultiSelectButton(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.semantics { testTag = "ItemTypePicker" },
|
||||
.semantics { testTag = "OTPItemTypePicker" },
|
||||
label = stringResource(id = R.string.otp_type),
|
||||
options = typeOptionsWithStrings.values.toImmutableList(),
|
||||
selectedOption = viewState.itemData.type.name,
|
||||
@@ -403,7 +407,8 @@ private fun AdvancedOptions(
|
||||
Spacer(Modifier.height(8.dp))
|
||||
BitwardenMultiSelectButton(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth(),
|
||||
.fillMaxWidth()
|
||||
.semantics { testTag = "AlgorithmItemTypePicker" },
|
||||
label = stringResource(id = R.string.algorithm),
|
||||
options = algorithmOptionsWithStrings.values.toImmutableList(),
|
||||
selectedOption = viewState.itemData.algorithm.name,
|
||||
@@ -430,7 +435,8 @@ private fun AdvancedOptions(
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
BitwardenMultiSelectButton(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth(),
|
||||
.fillMaxWidth()
|
||||
.semantics { testTag = "RefreshPeriodItemTypePicker" },
|
||||
label = stringResource(id = R.string.refresh_period),
|
||||
options = refreshPeriodOptionsWithStrings.values.toImmutableList(),
|
||||
selectedOption = stringResource(
|
||||
|
||||
+10
-1
@@ -27,6 +27,8 @@ import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTag
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
@@ -69,6 +71,7 @@ fun VaultVerificationCodeItem(
|
||||
Box(modifier = modifier) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "Item" }
|
||||
.then(
|
||||
if (allowLongPress) {
|
||||
Modifier.combinedClickable(
|
||||
@@ -98,7 +101,9 @@ fun VaultVerificationCodeItem(
|
||||
iconData = startIcon,
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colorScheme.onSurface,
|
||||
modifier = Modifier.size(24.dp),
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "BitwardenIcon" }
|
||||
.size(24.dp),
|
||||
)
|
||||
|
||||
Column(
|
||||
@@ -108,6 +113,7 @@ fun VaultVerificationCodeItem(
|
||||
) {
|
||||
if (!primaryLabel.isNullOrEmpty()) {
|
||||
Text(
|
||||
modifier = Modifier.semantics { testTag = "Name" },
|
||||
text = primaryLabel,
|
||||
style = MaterialTheme.typography.bodyLarge,
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
@@ -118,6 +124,7 @@ fun VaultVerificationCodeItem(
|
||||
|
||||
if (!secondaryLabel.isNullOrEmpty()) {
|
||||
Text(
|
||||
modifier = Modifier.semantics { testTag = "Username" },
|
||||
text = secondaryLabel,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
@@ -128,12 +135,14 @@ fun VaultVerificationCodeItem(
|
||||
}
|
||||
|
||||
BitwardenCircularCountdownIndicator(
|
||||
modifier = Modifier.semantics { testTag = "CircularCountDown" },
|
||||
timeLeftSeconds = timeLeftSeconds,
|
||||
periodSeconds = periodSeconds,
|
||||
alertThresholdSeconds = alertThresholdSeconds,
|
||||
)
|
||||
|
||||
Text(
|
||||
modifier = Modifier.semantics { testTag = "AuthCode" },
|
||||
text = authCode.chunked(3).joinToString(" "),
|
||||
style = MaterialTheme.typography.bodyLarge,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
|
||||
+5
@@ -27,6 +27,8 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTag
|
||||
import androidx.compose.ui.text.input.KeyboardCapitalization
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
@@ -175,6 +177,7 @@ fun ManualCodeEntryScreen(
|
||||
}
|
||||
},
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "NameTextField" }
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
)
|
||||
@@ -192,6 +195,7 @@ fun ManualCodeEntryScreen(
|
||||
},
|
||||
capitalization = KeyboardCapitalization.Characters,
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "KeyTextField" }
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
)
|
||||
@@ -203,6 +207,7 @@ fun ManualCodeEntryScreen(
|
||||
{ viewModel.trySendAction(ManualCodeEntryAction.CodeSubmit) }
|
||||
},
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "AddCodeButton" }
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user