mirror of
https://github.com/bitwarden/android.git
synced 2025-02-16 20:09:59 +03:00
BIT-1971: Add test tags to all app bar elements (#1125)
This commit is contained in:
parent
a8670965f9
commit
4f89c697f9
19 changed files with 48 additions and 12 deletions
|
@ -184,6 +184,7 @@ fun CreateAccountScreen(
|
|||
onClick = remember(viewModel) {
|
||||
{ viewModel.trySendAction(SubmitClick) }
|
||||
},
|
||||
modifier = Modifier.semantics { testTag = "SubmitButton" },
|
||||
)
|
||||
},
|
||||
)
|
||||
|
|
|
@ -22,6 +22,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.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
|
@ -115,6 +117,7 @@ fun EnterpriseSignOnScreen(
|
|||
onClick = remember(viewModel) {
|
||||
{ viewModel.trySendAction(EnterpriseSignOnAction.LogInClick) }
|
||||
},
|
||||
modifier = Modifier.semantics { testTag = "LoginButton" },
|
||||
)
|
||||
},
|
||||
)
|
||||
|
|
|
@ -94,6 +94,7 @@ fun EnvironmentScreen(
|
|||
onClick = remember(viewModel) {
|
||||
{ viewModel.trySendAction(EnvironmentAction.SaveClick) }
|
||||
},
|
||||
modifier = Modifier.semantics { testTag = "SaveButton" },
|
||||
)
|
||||
},
|
||||
)
|
||||
|
|
|
@ -16,6 +16,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.text.input.KeyboardType
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
|
@ -105,6 +107,7 @@ fun MasterPasswordHintScreen(
|
|||
onClick = remember(viewModel) {
|
||||
{ viewModel.trySendAction(MasterPasswordHintAction.SubmitClick) }
|
||||
},
|
||||
modifier = Modifier.semantics { testTag = "SubmitButton" },
|
||||
)
|
||||
},
|
||||
)
|
||||
|
|
|
@ -111,12 +111,14 @@ fun ResetPasswordScreen(
|
|||
BitwardenTextButton(
|
||||
label = stringResource(id = R.string.log_out),
|
||||
onClick = { shouldShowLogoutConfirmationDialog = true },
|
||||
modifier = Modifier.semantics { testTag = "LogoutButton" },
|
||||
)
|
||||
BitwardenTextButton(
|
||||
label = stringResource(id = R.string.submit),
|
||||
onClick = remember(viewModel) {
|
||||
{ viewModel.trySendAction(ResetPasswordAction.SubmitClick) }
|
||||
},
|
||||
modifier = Modifier.semantics { testTag = "SubmitButton" },
|
||||
)
|
||||
},
|
||||
)
|
||||
|
|
|
@ -142,7 +142,6 @@ fun VaultUnlockScreen(
|
|||
initials = state.initials,
|
||||
color = state.avatarColor,
|
||||
onClick = { accountMenuVisible = !accountMenuVisible },
|
||||
actionTestTag = "AccountIconButton",
|
||||
)
|
||||
BitwardenOverflowActionItem(
|
||||
menuItemDataList = persistentListOf(
|
||||
|
|
|
@ -34,18 +34,13 @@ fun BitwardenAccountActionItem(
|
|||
initials: String,
|
||||
color: Color,
|
||||
onClick: () -> Unit,
|
||||
actionTestTag: String? = null,
|
||||
) {
|
||||
val iconPainter = painterResource(id = R.drawable.ic_account_initials_container)
|
||||
val contentDescription = stringResource(id = R.string.account)
|
||||
|
||||
IconButton(
|
||||
onClick = onClick,
|
||||
modifier = Modifier.semantics {
|
||||
if (actionTestTag != null) {
|
||||
testTag = actionTestTag
|
||||
}
|
||||
},
|
||||
modifier = Modifier.semantics { testTag = "CurrentActiveAccount" },
|
||||
) {
|
||||
Icon(
|
||||
painter = iconPainter,
|
||||
|
|
|
@ -8,6 +8,7 @@ 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.tooling.preview.Preview
|
||||
import com.x8bit.bitwarden.R
|
||||
import com.x8bit.bitwarden.ui.platform.feature.settings.appearance.model.AppTheme
|
||||
|
@ -25,7 +26,7 @@ fun BitwardenPlaceholderAccountActionItem(
|
|||
IconButton(
|
||||
onClick = onClick,
|
||||
modifier = Modifier
|
||||
.semantics(mergeDescendants = true) {},
|
||||
.semantics(mergeDescendants = true) { testTag = "CurrentActiveAccount" },
|
||||
) {
|
||||
Icon(
|
||||
painter = painterResource(id = R.drawable.ic_account_initials_container),
|
||||
|
|
|
@ -11,7 +11,10 @@ import androidx.compose.material3.TopAppBarDefaults
|
|||
import androidx.compose.material3.TopAppBarScrollBehavior
|
||||
import androidx.compose.material3.rememberTopAppBarState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTag
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.x8bit.bitwarden.R
|
||||
|
||||
|
@ -35,6 +38,7 @@ import com.x8bit.bitwarden.R
|
|||
fun BitwardenMediumTopAppBar(
|
||||
title: String,
|
||||
scrollBehavior: TopAppBarScrollBehavior,
|
||||
modifier: Modifier = Modifier,
|
||||
actions: @Composable RowScope.() -> Unit = {},
|
||||
) {
|
||||
MediumTopAppBar(
|
||||
|
@ -50,8 +54,10 @@ fun BitwardenMediumTopAppBar(
|
|||
Text(
|
||||
text = title,
|
||||
style = MaterialTheme.typography.titleLarge,
|
||||
modifier = Modifier.semantics { testTag = "PageTitleLabel" },
|
||||
)
|
||||
},
|
||||
modifier = modifier.semantics { testTag = "HeaderBarComponent" },
|
||||
actions = actions,
|
||||
)
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@ import androidx.compose.ui.focus.focusRequester
|
|||
import androidx.compose.ui.graphics.Color
|
||||
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.ImeAction
|
||||
import com.x8bit.bitwarden.R
|
||||
import com.x8bit.bitwarden.ui.platform.base.util.mirrorIfRtl
|
||||
|
@ -44,7 +46,7 @@ fun BitwardenSearchTopAppBar(
|
|||
) {
|
||||
val focusRequester = remember { FocusRequester() }
|
||||
TopAppBar(
|
||||
modifier = modifier,
|
||||
modifier = modifier.semantics { testTag = "HeaderBarComponent" },
|
||||
colors = TopAppBarDefaults.topAppBarColors(
|
||||
containerColor = MaterialTheme.colorScheme.surface,
|
||||
scrolledContainerColor = MaterialTheme.colorScheme.surfaceContainer,
|
||||
|
@ -57,6 +59,7 @@ fun BitwardenSearchTopAppBar(
|
|||
navigationIcon?.let {
|
||||
IconButton(
|
||||
onClick = it.onNavigationIconClick,
|
||||
modifier = Modifier.semantics { testTag = "CloseButton" },
|
||||
) {
|
||||
Icon(
|
||||
modifier = Modifier.mirrorIfRtl(),
|
||||
|
|
|
@ -15,6 +15,8 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.graphics.painter.Painter
|
||||
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 com.x8bit.bitwarden.R
|
||||
|
@ -39,6 +41,7 @@ fun BitwardenTopAppBar(
|
|||
navigationIcon: Painter,
|
||||
navigationIconContentDescription: String,
|
||||
onNavigationIconClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
actions: @Composable RowScope.() -> Unit = { },
|
||||
) {
|
||||
BitwardenTopAppBar(
|
||||
|
@ -49,6 +52,7 @@ fun BitwardenTopAppBar(
|
|||
navigationIconContentDescription = navigationIconContentDescription,
|
||||
onNavigationIconClick = onNavigationIconClick,
|
||||
),
|
||||
modifier = modifier,
|
||||
actions = actions,
|
||||
)
|
||||
}
|
||||
|
@ -68,6 +72,7 @@ fun BitwardenTopAppBar(
|
|||
title: String,
|
||||
scrollBehavior: TopAppBarScrollBehavior,
|
||||
navigationIcon: NavigationIcon?,
|
||||
modifier: Modifier = Modifier,
|
||||
actions: @Composable RowScope.() -> Unit = {},
|
||||
) {
|
||||
TopAppBar(
|
||||
|
@ -83,6 +88,7 @@ fun BitwardenTopAppBar(
|
|||
navigationIcon?.let {
|
||||
IconButton(
|
||||
onClick = it.onNavigationIconClick,
|
||||
modifier = Modifier.semantics { testTag = "CloseButton" },
|
||||
) {
|
||||
Icon(
|
||||
modifier = Modifier.mirrorIfRtl(),
|
||||
|
@ -101,6 +107,7 @@ fun BitwardenTopAppBar(
|
|||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
},
|
||||
modifier = modifier.semantics { testTag = "HeaderBarComponent" },
|
||||
actions = actions,
|
||||
)
|
||||
}
|
||||
|
|
|
@ -49,7 +49,10 @@ fun BitwardenOverflowActionItem(
|
|||
contentAlignment = Alignment.Center,
|
||||
modifier = modifier,
|
||||
) {
|
||||
IconButton(onClick = { isOverflowMenuVisible = !isOverflowMenuVisible }) {
|
||||
IconButton(
|
||||
onClick = { isOverflowMenuVisible = !isOverflowMenuVisible },
|
||||
modifier = Modifier.semantics { testTag = "HeaderBarOptionsButton" },
|
||||
) {
|
||||
Icon(
|
||||
painter = painterResource(id = R.drawable.ic_more),
|
||||
contentDescription = stringResource(id = R.string.more),
|
||||
|
|
|
@ -3,7 +3,10 @@ package com.x8bit.bitwarden.ui.platform.components.appbar.action
|
|||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTag
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.x8bit.bitwarden.R
|
||||
|
||||
|
@ -24,6 +27,7 @@ fun BitwardenSearchActionItem(
|
|||
) {
|
||||
IconButton(
|
||||
onClick = onClick,
|
||||
modifier = Modifier.semantics { testTag = "SearchButton" },
|
||||
) {
|
||||
Icon(
|
||||
painter = painterResource(id = R.drawable.ic_search),
|
||||
|
|
|
@ -20,6 +20,8 @@ import androidx.compose.ui.input.nestedscroll.nestedScroll
|
|||
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.unit.dp
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
|
@ -108,6 +110,7 @@ fun FolderAddEditScreen(
|
|||
onClick = remember(viewModel) {
|
||||
{ viewModel.trySendAction(FolderAddEditAction.SaveClick) }
|
||||
},
|
||||
modifier = Modifier.semantics { testTag = "SaveButton" },
|
||||
)
|
||||
if (state.shouldShowOverflowMenu) {
|
||||
BitwardenOverflowActionItem(
|
||||
|
|
|
@ -279,6 +279,7 @@ private fun ModalAppBar(
|
|||
BitwardenTextButton(
|
||||
label = stringResource(id = R.string.select),
|
||||
onClick = onSelectClick,
|
||||
modifier = Modifier.semantics { testTag = "SelectButton" },
|
||||
)
|
||||
},
|
||||
)
|
||||
|
|
|
@ -94,7 +94,6 @@ fun PasswordHistoryScreen(
|
|||
},
|
||||
),
|
||||
),
|
||||
modifier = Modifier.semantics { testTag = "Options" },
|
||||
)
|
||||
}
|
||||
},
|
||||
|
|
|
@ -24,6 +24,8 @@ import androidx.compose.ui.input.nestedscroll.nestedScroll
|
|||
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.unit.dp
|
||||
import androidx.core.net.toUri
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
|
@ -182,6 +184,7 @@ fun VaultItemScreen(
|
|||
BitwardenTextButton(
|
||||
label = stringResource(id = R.string.restore),
|
||||
onClick = { pendingRestoreCipher = true },
|
||||
modifier = Modifier.semantics { testTag = "RestoreButton" },
|
||||
)
|
||||
}
|
||||
BitwardenOverflowActionItem(
|
||||
|
|
|
@ -15,6 +15,8 @@ import androidx.compose.ui.input.nestedscroll.nestedScroll
|
|||
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.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.x8bit.bitwarden.R
|
||||
|
@ -120,6 +122,7 @@ private fun VaultMoveToOrganizationScaffold(
|
|||
onClick = moveClick,
|
||||
isEnabled = state.viewState is
|
||||
VaultMoveToOrganizationState.ViewState.Content,
|
||||
modifier = Modifier.semantics { testTag = "MoveButton" },
|
||||
)
|
||||
},
|
||||
)
|
||||
|
|
|
@ -219,7 +219,6 @@ private fun VaultScreenScaffold(
|
|||
onClick = {
|
||||
updateAccountMenuVisibility(!accountMenuVisible)
|
||||
},
|
||||
actionTestTag = "AccountIconButton",
|
||||
)
|
||||
BitwardenSearchActionItem(
|
||||
contentDescription = stringResource(id = R.string.search_vault),
|
||||
|
|
Loading…
Add table
Reference in a new issue