BIT-1990: Add test tags for all rows in setting UI (#1129)

This commit is contained in:
David Perez 2024-03-12 16:49:37 -05:00 committed by Álison Fernandes
parent 2c6c5b3f6d
commit c9de5b919c
2 changed files with 32 additions and 7 deletions

View file

@ -26,6 +26,8 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
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.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
@ -88,6 +90,7 @@ fun SettingsScreen(
{ viewModel.trySendAction(SettingsAction.SettingsClick(it)) }
},
modifier = Modifier
.semantics { testTag = it.testTag }
.padding(horizontal = 16.dp)
.fillMaxWidth(),
)

View file

@ -99,12 +99,34 @@ sealed class SettingsAction {
* Enum representing the settings rows, such as "account security" or "vault".
*
* @property text The [Text] of the string that represents the label of each setting.
* @property testTag The value that should be set for the test tag. This is used in Appium testing.
*/
enum class Settings(val text: Text) {
ACCOUNT_SECURITY(R.string.account_security.asText()),
AUTO_FILL(R.string.autofill.asText()),
VAULT(R.string.vault.asText()),
APPEARANCE(R.string.appearance.asText()),
OTHER(R.string.other.asText()),
ABOUT(R.string.about.asText()),
enum class Settings(
val text: Text,
val testTag: String,
) {
ACCOUNT_SECURITY(
text = R.string.account_security.asText(),
testTag = "AccountSecuritySettingsButton",
),
AUTO_FILL(
text = R.string.autofill.asText(),
testTag = "AutofillSettingsButton",
),
VAULT(
text = R.string.vault.asText(),
testTag = "VaultSettingsButton",
),
APPEARANCE(
text = R.string.appearance.asText(),
testTag = "AppearanceSettingsButton",
),
OTHER(
text = R.string.other.asText(),
testTag = "OtherSettingsButton",
),
ABOUT(
text = R.string.about.asText(),
testTag = "AboutSettingsButton",
),
}