BIT-1992: Add test tags to the folders UI (#1130)

This commit is contained in:
David Perez 2024-03-12 17:01:32 -05:00 committed by Álison Fernandes
parent c9de5b919c
commit 3f19401c6d
4 changed files with 12 additions and 0 deletions

View file

@ -154,6 +154,7 @@ private fun FoldersContent(
textAlign = TextAlign.Center, textAlign = TextAlign.Center,
style = MaterialTheme.typography.bodyMedium, style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurface, color = MaterialTheme.colorScheme.onSurface,
modifier = Modifier.semantics { testTag = "NoFoldersLabel" },
) )
} }
} else { } else {
@ -163,6 +164,7 @@ private fun FoldersContent(
items(foldersList) { items(foldersList) {
Row( Row(
modifier = Modifier modifier = Modifier
.semantics { testTag = "FolderCell" }
.clickable( .clickable(
interactionSource = remember { MutableInteractionSource() }, interactionSource = remember { MutableInteractionSource() },
indication = rememberRipple(color = MaterialTheme.colorScheme.primary), indication = rememberRipple(color = MaterialTheme.colorScheme.primary),
@ -176,6 +178,7 @@ private fun FoldersContent(
) { ) {
Text( Text(
modifier = Modifier modifier = Modifier
.semantics { testTag = "FolderName" }
.padding(start = 16.dp) .padding(start = 16.dp)
.weight(1f), .weight(1f),
text = it.name, text = it.name,

View file

@ -19,6 +19,8 @@ import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource 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.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.x8bit.bitwarden.R import com.x8bit.bitwarden.R
@ -144,6 +146,7 @@ fun AddSendScreen(
onClick = remember(viewModel) { onClick = remember(viewModel) {
{ viewModel.trySendAction(AddSendAction.SaveClick) } { viewModel.trySendAction(AddSendAction.SaveClick) }
}, },
modifier = Modifier.semantics { testTag = "SaveButton" },
) )
if (!state.isAddMode) { if (!state.isAddMode) {
BitwardenOverflowActionItem( BitwardenOverflowActionItem(

View file

@ -18,6 +18,8 @@ import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.testTag
import androidx.core.net.toUri import androidx.core.net.toUri
import androidx.hilt.navigation.compose.hiltViewModel import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.compose.collectAsStateWithLifecycle
@ -180,6 +182,7 @@ fun VaultAddEditScreen(
onClick = remember(viewModel) { onClick = remember(viewModel) {
{ viewModel.trySendAction(VaultAddEditAction.Common.SaveClick) } { viewModel.trySendAction(VaultAddEditAction.Common.SaveClick) }
}, },
modifier = Modifier.semantics { testTag = "SaveButton" },
) )
BitwardenOverflowActionItem( BitwardenOverflowActionItem(
menuItemDataList = persistentListOfNotNull( menuItemDataList = persistentListOfNotNull(

View file

@ -14,6 +14,8 @@ import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource 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.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.x8bit.bitwarden.R import com.x8bit.bitwarden.R
@ -92,6 +94,7 @@ fun AttachmentsScreen(
BitwardenTextButton( BitwardenTextButton(
label = stringResource(id = R.string.save), label = stringResource(id = R.string.save),
onClick = attachmentsHandlers.onSaveClick, onClick = attachmentsHandlers.onSaveClick,
modifier = Modifier.semantics { testTag = "SaveButton" },
) )
}, },
) )