diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/BitwardenAccountSwitcher.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/BitwardenAccountSwitcher.kt index ec1b3ce51..acfa32f3b 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/BitwardenAccountSwitcher.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/BitwardenAccountSwitcher.kt @@ -34,10 +34,14 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment +import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.semantics.clearAndSetSemantics +import androidx.compose.ui.semantics.semantics +import androidx.compose.ui.semantics.testTag +import androidx.compose.ui.semantics.testTagsAsResourceId import androidx.compose.ui.unit.dp import com.x8bit.bitwarden.R import com.x8bit.bitwarden.ui.platform.base.util.lowercaseWithCurrentLocal @@ -84,7 +88,7 @@ private const val MAXIMUM_ACCOUNT_LIMIT = 5 * @param topAppBarScrollBehavior Used to derive the background color of the content and keep it in * sync with the associated app bar. */ -@OptIn(ExperimentalMaterial3Api::class) +@OptIn(ExperimentalMaterial3Api::class, ExperimentalComposeUiApi::class) @Suppress("LongMethod") @Composable fun BitwardenAccountSwitcher( @@ -137,7 +141,7 @@ fun BitwardenAccountSwitcher( } } - Box(modifier = modifier) { + Box(modifier = modifier.semantics { testTagsAsResourceId = true }) { BitwardenAnimatedScrim( isVisible = isVisible, onClick = onDismissRequest, @@ -196,6 +200,7 @@ private fun AnimatedAccountSwitcher( ) { LazyColumn( modifier = modifier + .semantics { testTag = "AccountListView" } // To prevent going all the way up to the bottom of the screen, we'll add some small // bottom padding. .padding(bottom = 24.dp) @@ -209,6 +214,7 @@ private fun AnimatedAccountSwitcher( onSwitchAccountLongClick = onSwitchAccountLongClick, modifier = Modifier .fillMaxWidth() + .semantics { testTag = "AccountIconButton" } .padding(horizontal = 16.dp), ) HorizontalDivider( @@ -222,6 +228,7 @@ private fun AnimatedAccountSwitcher( onClick = onAddAccountClick, modifier = Modifier .fillMaxWidth() + .semantics { testTag = "AddAccountButton" } .padding(horizontal = 16.dp), ) }