mirror of
https://github.com/bitwarden/android.git
synced 2024-11-23 09:56:11 +03:00
PM-14200: Update the eyebrows throughout the app (#4181)
This commit is contained in:
parent
150c8e0312
commit
a1108889cb
11 changed files with 79 additions and 164 deletions
|
@ -1,5 +1,6 @@
|
|||
package com.x8bit.bitwarden.ui.platform.components.header
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
|
@ -12,16 +13,19 @@ import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme
|
|||
* Represents a Bitwarden-styled label text.
|
||||
*
|
||||
* @param label The text content for the label.
|
||||
* @param supportingLabel The optional text for the supporting label.
|
||||
* @param modifier The [Modifier] to be applied to the label.
|
||||
*/
|
||||
@Composable
|
||||
fun BitwardenListHeaderText(
|
||||
label: String,
|
||||
supportingLabel: String? = null,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val supportLabel = supportingLabel?.let { " ($it)" }.orEmpty()
|
||||
Text(
|
||||
text = label,
|
||||
style = BitwardenTheme.typography.labelMedium,
|
||||
text = "${label.uppercase()}$supportLabel",
|
||||
style = BitwardenTheme.typography.eyebrowMedium,
|
||||
color = BitwardenTheme.colorScheme.text.secondary,
|
||||
modifier = modifier.padding(
|
||||
top = 12.dp,
|
||||
|
@ -34,9 +38,16 @@ fun BitwardenListHeaderText(
|
|||
@Composable
|
||||
private fun BitwardenListHeaderText_preview() {
|
||||
BitwardenTheme {
|
||||
BitwardenListHeaderText(
|
||||
label = "Sample Label",
|
||||
modifier = Modifier,
|
||||
)
|
||||
Column {
|
||||
BitwardenListHeaderText(
|
||||
label = "Sample Label",
|
||||
modifier = Modifier,
|
||||
)
|
||||
BitwardenListHeaderText(
|
||||
label = "Sample Label",
|
||||
supportingLabel = "4",
|
||||
modifier = Modifier,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
package com.x8bit.bitwarden.ui.platform.components.header
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme
|
||||
|
||||
/**
|
||||
* Represents a Bitwarden-styled label text.
|
||||
*
|
||||
* @param label The text content for the label.
|
||||
* @param supportingLabel The text for the supporting label.
|
||||
* @param modifier The [Modifier] to be applied to the label.
|
||||
*/
|
||||
@Composable
|
||||
fun BitwardenListHeaderTextWithSupportLabel(
|
||||
label: String,
|
||||
supportingLabel: String,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Row(
|
||||
modifier = modifier
|
||||
.padding(
|
||||
top = 12.dp,
|
||||
bottom = 4.dp,
|
||||
end = 8.dp,
|
||||
)
|
||||
.semantics(mergeDescendants = true) { },
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
) {
|
||||
Text(
|
||||
text = label,
|
||||
style = BitwardenTheme.typography.labelMedium,
|
||||
color = BitwardenTheme.colorScheme.text.secondary,
|
||||
)
|
||||
|
||||
Text(
|
||||
text = supportingLabel,
|
||||
style = BitwardenTheme.typography.labelSmall,
|
||||
color = BitwardenTheme.colorScheme.text.secondary,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun BitwardenListHeaderTextWithSupportLabel_preview() {
|
||||
BitwardenTheme {
|
||||
BitwardenListHeaderTextWithSupportLabel(
|
||||
label = "Sample Label",
|
||||
supportingLabel = "0",
|
||||
modifier = Modifier,
|
||||
)
|
||||
}
|
||||
}
|
|
@ -234,7 +234,7 @@ val bitwardenTypography: BitwardenTypography = BitwardenTypography(
|
|||
lineHeight = 18.sp,
|
||||
fontFamily = FontFamily(Font(R.font.dm_sans_bold)),
|
||||
fontWeight = FontWeight.W700,
|
||||
letterSpacing = 0.5.sp,
|
||||
letterSpacing = 0.6.sp,
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
trim = LineHeightStyle.Trim.None,
|
||||
|
|
|
@ -15,7 +15,6 @@ import androidx.compose.ui.unit.dp
|
|||
import com.x8bit.bitwarden.R
|
||||
import com.x8bit.bitwarden.ui.platform.components.card.BitwardenInfoCalloutCard
|
||||
import com.x8bit.bitwarden.ui.platform.components.header.BitwardenListHeaderText
|
||||
import com.x8bit.bitwarden.ui.platform.components.header.BitwardenListHeaderTextWithSupportLabel
|
||||
import com.x8bit.bitwarden.ui.platform.components.listitem.BitwardenGroupItem
|
||||
import com.x8bit.bitwarden.ui.platform.components.model.IconData
|
||||
import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter
|
||||
|
@ -83,7 +82,7 @@ fun SendContent(
|
|||
|
||||
item {
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
BitwardenListHeaderTextWithSupportLabel(
|
||||
BitwardenListHeaderText(
|
||||
label = stringResource(id = R.string.all_sends),
|
||||
supportingLabel = state.sendItems.size.toString(),
|
||||
modifier = Modifier
|
||||
|
|
|
@ -21,7 +21,7 @@ import com.x8bit.bitwarden.ui.platform.components.card.BitwardenInfoCalloutCard
|
|||
import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenMasterPasswordDialog
|
||||
import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenTwoButtonDialog
|
||||
import com.x8bit.bitwarden.ui.platform.components.divider.BitwardenHorizontalDivider
|
||||
import com.x8bit.bitwarden.ui.platform.components.header.BitwardenListHeaderTextWithSupportLabel
|
||||
import com.x8bit.bitwarden.ui.platform.components.header.BitwardenListHeaderText
|
||||
import com.x8bit.bitwarden.ui.platform.components.listitem.BitwardenGroupItem
|
||||
import com.x8bit.bitwarden.ui.platform.components.listitem.BitwardenListItem
|
||||
import com.x8bit.bitwarden.ui.platform.components.listitem.SelectionItemData
|
||||
|
@ -127,7 +127,7 @@ fun VaultItemListingContent(
|
|||
|
||||
if (state.displayCollectionList.isNotEmpty()) {
|
||||
item {
|
||||
BitwardenListHeaderTextWithSupportLabel(
|
||||
BitwardenListHeaderText(
|
||||
label = stringResource(id = R.string.collections),
|
||||
supportingLabel = state.displayCollectionList.count().toString(),
|
||||
modifier = Modifier
|
||||
|
@ -156,7 +156,7 @@ fun VaultItemListingContent(
|
|||
|
||||
if (state.displayFolderList.isNotEmpty()) {
|
||||
item {
|
||||
BitwardenListHeaderTextWithSupportLabel(
|
||||
BitwardenListHeaderText(
|
||||
label = stringResource(id = R.string.folders),
|
||||
supportingLabel = state.displayFolderList.count().toString(),
|
||||
modifier = Modifier
|
||||
|
@ -195,7 +195,7 @@ fun VaultItemListingContent(
|
|||
|
||||
if (state.displayItemList.isNotEmpty()) {
|
||||
item {
|
||||
BitwardenListHeaderTextWithSupportLabel(
|
||||
BitwardenListHeaderText(
|
||||
label = stringResource(id = R.string.items),
|
||||
supportingLabel = state.displayItemList.size.toString(),
|
||||
modifier = Modifier
|
||||
|
|
|
@ -13,7 +13,7 @@ import androidx.compose.ui.res.stringResource
|
|||
import androidx.compose.ui.unit.dp
|
||||
import com.x8bit.bitwarden.R
|
||||
import com.x8bit.bitwarden.ui.platform.components.divider.BitwardenHorizontalDivider
|
||||
import com.x8bit.bitwarden.ui.platform.components.header.BitwardenListHeaderTextWithSupportLabel
|
||||
import com.x8bit.bitwarden.ui.platform.components.header.BitwardenListHeaderText
|
||||
import com.x8bit.bitwarden.ui.platform.components.listitem.BitwardenGroupItem
|
||||
import com.x8bit.bitwarden.ui.platform.components.model.toIconResources
|
||||
import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter
|
||||
|
@ -38,7 +38,7 @@ fun VaultContent(
|
|||
) {
|
||||
if (state.totpItemsCount > 0) {
|
||||
item {
|
||||
BitwardenListHeaderTextWithSupportLabel(
|
||||
BitwardenListHeaderText(
|
||||
label = stringResource(id = R.string.totp),
|
||||
supportingLabel = "1",
|
||||
modifier = Modifier
|
||||
|
@ -64,7 +64,7 @@ fun VaultContent(
|
|||
|
||||
if (state.favoriteItems.isNotEmpty()) {
|
||||
item {
|
||||
BitwardenListHeaderTextWithSupportLabel(
|
||||
BitwardenListHeaderText(
|
||||
label = stringResource(id = R.string.favorites),
|
||||
supportingLabel = state.favoriteItems.count().toString(),
|
||||
modifier = Modifier
|
||||
|
@ -120,7 +120,7 @@ fun VaultContent(
|
|||
}
|
||||
|
||||
item {
|
||||
BitwardenListHeaderTextWithSupportLabel(
|
||||
BitwardenListHeaderText(
|
||||
label = stringResource(id = R.string.types),
|
||||
supportingLabel = "4",
|
||||
modifier = Modifier
|
||||
|
@ -203,7 +203,7 @@ fun VaultContent(
|
|||
}
|
||||
|
||||
item {
|
||||
BitwardenListHeaderTextWithSupportLabel(
|
||||
BitwardenListHeaderText(
|
||||
label = stringResource(id = R.string.folders),
|
||||
supportingLabel = state.folderItems.count().toString(),
|
||||
modifier = Modifier
|
||||
|
@ -241,7 +241,7 @@ fun VaultContent(
|
|||
}
|
||||
|
||||
item {
|
||||
BitwardenListHeaderTextWithSupportLabel(
|
||||
BitwardenListHeaderText(
|
||||
label = stringResource(id = R.string.folder_none),
|
||||
supportingLabel = state.noFolderItems.count().toString(),
|
||||
modifier = Modifier
|
||||
|
@ -288,7 +288,7 @@ fun VaultContent(
|
|||
}
|
||||
|
||||
item {
|
||||
BitwardenListHeaderTextWithSupportLabel(
|
||||
BitwardenListHeaderText(
|
||||
label = stringResource(id = R.string.collections),
|
||||
supportingLabel = state.collectionItems.count().toString(),
|
||||
modifier = Modifier
|
||||
|
@ -321,7 +321,7 @@ fun VaultContent(
|
|||
}
|
||||
|
||||
item {
|
||||
BitwardenListHeaderTextWithSupportLabel(
|
||||
BitwardenListHeaderText(
|
||||
label = stringResource(id = R.string.trash),
|
||||
supportingLabel = "1",
|
||||
modifier = Modifier
|
||||
|
|
|
@ -27,7 +27,7 @@ import com.x8bit.bitwarden.ui.platform.components.content.BitwardenErrorContent
|
|||
import com.x8bit.bitwarden.ui.platform.components.content.BitwardenLoadingContent
|
||||
import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLoadingDialog
|
||||
import com.x8bit.bitwarden.ui.platform.components.dialog.LoadingDialogState
|
||||
import com.x8bit.bitwarden.ui.platform.components.header.BitwardenListHeaderTextWithSupportLabel
|
||||
import com.x8bit.bitwarden.ui.platform.components.header.BitwardenListHeaderText
|
||||
import com.x8bit.bitwarden.ui.platform.components.scaffold.BitwardenScaffold
|
||||
import com.x8bit.bitwarden.ui.platform.components.scaffold.rememberBitwardenPullToRefreshState
|
||||
import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter
|
||||
|
@ -160,7 +160,7 @@ private fun VerificationCodeContent(
|
|||
modifier = modifier,
|
||||
) {
|
||||
item {
|
||||
BitwardenListHeaderTextWithSupportLabel(
|
||||
BitwardenListHeaderText(
|
||||
label = stringResource(id = R.string.items),
|
||||
supportingLabel = items.size.toString(),
|
||||
modifier = Modifier
|
||||
|
|
|
@ -311,7 +311,7 @@ class VaultItemScreenTest : BaseComposeTest() {
|
|||
DEFAULT_VIEW_STATES
|
||||
.forEach { typeState ->
|
||||
mutableStateFlow.update { it.copy(viewState = typeState) }
|
||||
composeTestRule.onNodeWithTextAfterScroll("Custom fields").assertIsDisplayed()
|
||||
composeTestRule.onNodeWithTextAfterScroll("CUSTOM FIELDS").assertIsDisplayed()
|
||||
composeTestRule.onNodeWithTextAfterScroll("text").assertIsDisplayed()
|
||||
composeTestRule.onNodeWithTextAfterScroll("value").assertIsDisplayed()
|
||||
composeTestRule.onNodeWithTextAfterScroll("hidden").assertIsDisplayed()
|
||||
|
@ -321,7 +321,7 @@ class VaultItemScreenTest : BaseComposeTest() {
|
|||
updateCommonContent(currentState) { copy(customFields = emptyList()) }
|
||||
}
|
||||
|
||||
composeTestRule.assertScrollableNodeDoesNotExist("Custom fields")
|
||||
composeTestRule.assertScrollableNodeDoesNotExist("CUSTOM FIELDS")
|
||||
composeTestRule.assertScrollableNodeDoesNotExist("text")
|
||||
composeTestRule.assertScrollableNodeDoesNotExist("value")
|
||||
composeTestRule.assertScrollableNodeDoesNotExist("hidden")
|
||||
|
@ -334,7 +334,7 @@ class VaultItemScreenTest : BaseComposeTest() {
|
|||
DEFAULT_VIEW_STATES
|
||||
.forEach { typeState ->
|
||||
mutableStateFlow.update { it.copy(viewState = typeState) }
|
||||
composeTestRule.onNodeWithTextAfterScroll("Attachments").assertIsDisplayed()
|
||||
composeTestRule.onNodeWithTextAfterScroll("ATTACHMENTS").assertIsDisplayed()
|
||||
composeTestRule.onNodeWithTextAfterScroll("test.mp4").assertIsDisplayed()
|
||||
composeTestRule.onNodeWithTextAfterScroll("11 MB").assertIsDisplayed()
|
||||
|
||||
|
@ -342,7 +342,7 @@ class VaultItemScreenTest : BaseComposeTest() {
|
|||
updateCommonContent(currentState) { copy(attachments = emptyList()) }
|
||||
}
|
||||
|
||||
composeTestRule.assertScrollableNodeDoesNotExist("Attachments")
|
||||
composeTestRule.assertScrollableNodeDoesNotExist("ATTACHMENTS")
|
||||
composeTestRule.assertScrollableNodeDoesNotExist("test.mp4")
|
||||
composeTestRule.assertScrollableNodeDoesNotExist("11 MB")
|
||||
}
|
||||
|
@ -1706,7 +1706,7 @@ class VaultItemScreenTest : BaseComposeTest() {
|
|||
@Test
|
||||
fun `in login state, uris should be displayed according to state`() {
|
||||
mutableStateFlow.update { it.copy(viewState = DEFAULT_LOGIN_VIEW_STATE) }
|
||||
composeTestRule.onNodeWithTextAfterScroll("URIs").assertIsDisplayed()
|
||||
composeTestRule.onNodeWithTextAfterScroll("URIS").assertIsDisplayed()
|
||||
composeTestRule.onNodeWithTextAfterScroll("URI").assertIsDisplayed()
|
||||
composeTestRule.onNodeWithTextAfterScroll("www.example.com").assertIsDisplayed()
|
||||
|
||||
|
@ -1714,7 +1714,7 @@ class VaultItemScreenTest : BaseComposeTest() {
|
|||
updateLoginType(currentState) { copy(uris = emptyList()) }
|
||||
}
|
||||
|
||||
composeTestRule.assertScrollableNodeDoesNotExist("URIs")
|
||||
composeTestRule.assertScrollableNodeDoesNotExist("URIS")
|
||||
composeTestRule.assertScrollableNodeDoesNotExist("URI")
|
||||
composeTestRule.assertScrollableNodeDoesNotExist("www.example.com")
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import androidx.compose.ui.test.assert
|
|||
import androidx.compose.ui.test.assertCountEquals
|
||||
import androidx.compose.ui.test.assertIsDisplayed
|
||||
import androidx.compose.ui.test.assertIsNotDisplayed
|
||||
import androidx.compose.ui.test.assertTextEquals
|
||||
import androidx.compose.ui.test.filterToOne
|
||||
import androidx.compose.ui.test.hasAnyAncestor
|
||||
import androidx.compose.ui.test.isDialog
|
||||
|
@ -654,7 +653,7 @@ class VaultItemListingScreenTest : BaseComposeTest() {
|
|||
|
||||
@Test
|
||||
fun `Folders text should be displayed according to state`() {
|
||||
val folders = "Folders"
|
||||
val folders = "FOLDERS (1)"
|
||||
mutableStateFlow.update { DEFAULT_STATE }
|
||||
composeTestRule
|
||||
.onNodeWithText(text = folders)
|
||||
|
@ -666,7 +665,9 @@ class VaultItemListingScreenTest : BaseComposeTest() {
|
|||
displayItemList = emptyList(),
|
||||
displayFolderList = listOf(
|
||||
VaultItemListingState.FolderDisplayItem(
|
||||
name = "test", id = "1", count = 0,
|
||||
name = "test",
|
||||
id = "1",
|
||||
count = 0,
|
||||
),
|
||||
),
|
||||
displayCollectionList = emptyList(),
|
||||
|
@ -680,10 +681,9 @@ class VaultItemListingScreenTest : BaseComposeTest() {
|
|||
|
||||
@Test
|
||||
fun `Folders text count should be displayed according to state`() {
|
||||
val folders = "Folders"
|
||||
mutableStateFlow.update { DEFAULT_STATE }
|
||||
composeTestRule
|
||||
.onNodeWithText(text = folders)
|
||||
.onNodeWithText(text = "FOLDERS (1)")
|
||||
.assertDoesNotExist()
|
||||
|
||||
mutableStateFlow.update {
|
||||
|
@ -698,9 +698,8 @@ class VaultItemListingScreenTest : BaseComposeTest() {
|
|||
)
|
||||
}
|
||||
composeTestRule
|
||||
.onNodeWithTextAfterScroll(text = folders)
|
||||
.onNodeWithTextAfterScroll(text = "FOLDERS (1)")
|
||||
.assertIsDisplayed()
|
||||
.assertTextEquals(folders, 1.toString())
|
||||
|
||||
mutableStateFlow.update {
|
||||
it.copy(
|
||||
|
@ -729,9 +728,8 @@ class VaultItemListingScreenTest : BaseComposeTest() {
|
|||
}
|
||||
|
||||
composeTestRule
|
||||
.onNodeWithTextAfterScroll(text = folders)
|
||||
.onNodeWithTextAfterScroll(text = "FOLDERS (3)")
|
||||
.assertIsDisplayed()
|
||||
.assertTextEquals(folders, 3.toString())
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -778,7 +776,7 @@ class VaultItemListingScreenTest : BaseComposeTest() {
|
|||
displayFolderList = emptyList(),
|
||||
displayCollectionList = listOf(
|
||||
VaultItemListingState.CollectionDisplayItem(
|
||||
name = "Collection",
|
||||
name = collectionName,
|
||||
id = "1",
|
||||
count = 0,
|
||||
),
|
||||
|
@ -793,10 +791,9 @@ class VaultItemListingScreenTest : BaseComposeTest() {
|
|||
|
||||
@Test
|
||||
fun `Collection text count should be displayed according to state`() {
|
||||
val collections = "Collections"
|
||||
mutableStateFlow.update { DEFAULT_STATE }
|
||||
composeTestRule
|
||||
.onNodeWithText(text = collections)
|
||||
.onNodeWithText(text = "COLLECTIONS (3)")
|
||||
.assertDoesNotExist()
|
||||
|
||||
mutableStateFlow.update {
|
||||
|
@ -825,9 +822,8 @@ class VaultItemListingScreenTest : BaseComposeTest() {
|
|||
)
|
||||
}
|
||||
composeTestRule
|
||||
.onNodeWithTextAfterScroll(text = collections)
|
||||
.onNodeWithTextAfterScroll(text = "COLLECTIONS (3)")
|
||||
.assertIsDisplayed()
|
||||
.assertTextEquals(collections, 3.toString())
|
||||
|
||||
mutableStateFlow.update {
|
||||
it.copy(
|
||||
|
@ -846,9 +842,8 @@ class VaultItemListingScreenTest : BaseComposeTest() {
|
|||
}
|
||||
|
||||
composeTestRule
|
||||
.onNodeWithTextAfterScroll(text = collections)
|
||||
.onNodeWithTextAfterScroll(text = "COLLECTIONS (1)")
|
||||
.assertIsDisplayed()
|
||||
.assertTextEquals(collections, 1.toString())
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -882,7 +877,7 @@ class VaultItemListingScreenTest : BaseComposeTest() {
|
|||
|
||||
@Test
|
||||
fun `Items text should be displayed according to state`() {
|
||||
val items = "Items"
|
||||
val items = "ITEMS (1)"
|
||||
mutableStateFlow.update { DEFAULT_STATE }
|
||||
composeTestRule
|
||||
.onNodeWithText(text = items)
|
||||
|
@ -906,10 +901,9 @@ class VaultItemListingScreenTest : BaseComposeTest() {
|
|||
|
||||
@Test
|
||||
fun `Items text count should be displayed according to state`() {
|
||||
val items = "Items"
|
||||
mutableStateFlow.update { DEFAULT_STATE }
|
||||
composeTestRule
|
||||
.onNodeWithText(text = items)
|
||||
.onNodeWithText(text = "ITEMS (1)")
|
||||
.assertDoesNotExist()
|
||||
|
||||
mutableStateFlow.update {
|
||||
|
@ -924,9 +918,8 @@ class VaultItemListingScreenTest : BaseComposeTest() {
|
|||
)
|
||||
}
|
||||
composeTestRule
|
||||
.onNodeWithTextAfterScroll(text = items)
|
||||
.onNodeWithTextAfterScroll(text = "ITEMS (1)")
|
||||
.assertIsDisplayed()
|
||||
.assertTextEquals(items, 1.toString())
|
||||
|
||||
mutableStateFlow.update {
|
||||
it.copy(
|
||||
|
@ -944,9 +937,8 @@ class VaultItemListingScreenTest : BaseComposeTest() {
|
|||
}
|
||||
|
||||
composeTestRule
|
||||
.onNodeWithTextAfterScroll(text = items)
|
||||
.onNodeWithTextAfterScroll(text = "ITEMS (4)")
|
||||
.assertIsDisplayed()
|
||||
.assertTextEquals(items, 4.toString())
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -742,8 +742,8 @@ class VaultScreenTest : BaseComposeTest() {
|
|||
}
|
||||
|
||||
composeTestRule
|
||||
.onNodeWithText("TOTP")
|
||||
.assertTextEquals("TOTP", "1")
|
||||
.onNodeWithText("TOTP (1)")
|
||||
.performScrollTo()
|
||||
.assertIsDisplayed()
|
||||
|
||||
composeTestRule
|
||||
|
@ -760,7 +760,7 @@ class VaultScreenTest : BaseComposeTest() {
|
|||
}
|
||||
|
||||
composeTestRule
|
||||
.onNodeWithText("TOTP")
|
||||
.onNodeWithText("TOTP (1)")
|
||||
.assertIsNotDisplayed()
|
||||
|
||||
composeTestRule
|
||||
|
@ -805,14 +805,15 @@ class VaultScreenTest : BaseComposeTest() {
|
|||
)
|
||||
}
|
||||
|
||||
composeTestRule.onNode(hasScrollToNodeAction()).performScrollToNode(hasText(itemText))
|
||||
// Header
|
||||
composeTestRule
|
||||
.onNodeWithText("Favorites")
|
||||
.assertTextEquals("Favorites", 1.toString())
|
||||
.onNodeWithText("FAVORITES (1)")
|
||||
.performScrollTo()
|
||||
.assertIsDisplayed()
|
||||
// Item
|
||||
composeTestRule
|
||||
.onNodeWithText(itemText)
|
||||
.performScrollTo()
|
||||
.assertTextEquals(itemText, username)
|
||||
.performClick()
|
||||
verify {
|
||||
|
@ -850,8 +851,7 @@ class VaultScreenTest : BaseComposeTest() {
|
|||
|
||||
@Test
|
||||
fun `collection data should update according to the state`() {
|
||||
val collectionsHeader = "Collections"
|
||||
val collectionsCount = 1
|
||||
val collectionsHeader = "COLLECTIONS (1)"
|
||||
val collectionName = "Test Collection"
|
||||
val collectionCount = 3
|
||||
val collectionItem = VaultState.ViewState.CollectionItem(
|
||||
|
@ -873,7 +873,7 @@ class VaultScreenTest : BaseComposeTest() {
|
|||
|
||||
composeTestRule
|
||||
.onNodeWithTextAfterScroll(collectionsHeader, substring = true)
|
||||
.assertTextEquals(collectionsHeader, collectionsCount.toString())
|
||||
.assertTextEquals(collectionsHeader)
|
||||
.assertIsDisplayed()
|
||||
composeTestRule
|
||||
.onNodeWithText(collectionName)
|
||||
|
@ -1087,37 +1087,31 @@ class VaultScreenTest : BaseComposeTest() {
|
|||
mutableStateFlow.update {
|
||||
it.copy(viewState = DEFAULT_CONTENT_VIEW_STATE)
|
||||
}
|
||||
composeTestRule.onNode(hasScrollToNodeAction()).performScrollToNode(hasText(rowText))
|
||||
// Header
|
||||
composeTestRule
|
||||
.onAllNodes(hasText(rowText))
|
||||
.filterToOne(!hasClickAction())
|
||||
.assertTextEquals(rowText, 1.toString())
|
||||
.onNodeWithTextAfterScroll(text = "TRASH (1)")
|
||||
.assertIsDisplayed()
|
||||
// Item
|
||||
composeTestRule
|
||||
.onAllNodes(hasText(rowText))
|
||||
.filterToOne(hasClickAction())
|
||||
.onNodeWithTextAfterScroll(rowText)
|
||||
.assertTextEquals(rowText, 0.toString())
|
||||
|
||||
val trashCount = 5
|
||||
mutableStateFlow.update {
|
||||
it.copy(
|
||||
viewState = DEFAULT_CONTENT_VIEW_STATE.copy(
|
||||
trashItemsCount = 5,
|
||||
trashItemsCount = trashCount,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
composeTestRule.onNode(hasScrollToNodeAction()).performScrollToNode(hasText(rowText))
|
||||
// Header
|
||||
composeTestRule
|
||||
.onAllNodes(hasText(rowText))
|
||||
.filterToOne(!hasClickAction())
|
||||
.assertTextEquals(rowText, 1.toString())
|
||||
.onNodeWithTextAfterScroll(text = "TRASH (1)")
|
||||
.assertIsDisplayed()
|
||||
// Item
|
||||
composeTestRule
|
||||
.onAllNodes(hasText(rowText))
|
||||
.filterToOne(hasClickAction())
|
||||
.onNodeWithTextAfterScroll(rowText)
|
||||
.assertTextEquals(rowText, trashCount.toString())
|
||||
}
|
||||
|
||||
|
|
|
@ -3,11 +3,8 @@ package com.x8bit.bitwarden.ui.vault.feature.verificationcode
|
|||
import androidx.compose.ui.test.assert
|
||||
import androidx.compose.ui.test.assertIsDisplayed
|
||||
import androidx.compose.ui.test.assertIsNotDisplayed
|
||||
import androidx.compose.ui.test.assertTextEquals
|
||||
import androidx.compose.ui.test.filterToOne
|
||||
import androidx.compose.ui.test.hasAnyAncestor
|
||||
import androidx.compose.ui.test.hasScrollToNodeAction
|
||||
import androidx.compose.ui.test.hasText
|
||||
import androidx.compose.ui.test.isDialog
|
||||
import androidx.compose.ui.test.isDisplayed
|
||||
import androidx.compose.ui.test.isPopup
|
||||
|
@ -15,7 +12,7 @@ import androidx.compose.ui.test.onAllNodesWithText
|
|||
import androidx.compose.ui.test.onNodeWithContentDescription
|
||||
import androidx.compose.ui.test.onNodeWithText
|
||||
import androidx.compose.ui.test.performClick
|
||||
import androidx.compose.ui.test.performScrollToNode
|
||||
import androidx.compose.ui.test.performScrollTo
|
||||
import com.x8bit.bitwarden.data.platform.repository.model.Environment
|
||||
import com.x8bit.bitwarden.data.platform.repository.util.baseIconUrl
|
||||
import com.x8bit.bitwarden.data.platform.repository.util.bufferedMutableSharedFlow
|
||||
|
@ -174,11 +171,10 @@ class VerificationCodeScreenTest : BaseComposeTest() {
|
|||
|
||||
@Test
|
||||
fun `Items text should be displayed according to state`() {
|
||||
val items = "Items"
|
||||
mutableStateFlow.update { DEFAULT_STATE }
|
||||
|
||||
composeTestRule
|
||||
.onNodeWithText(text = items)
|
||||
.onNodeWithText(text = "ITEMS (2)")
|
||||
.assertDoesNotExist()
|
||||
|
||||
mutableStateFlow.update {
|
||||
|
@ -193,20 +189,16 @@ class VerificationCodeScreenTest : BaseComposeTest() {
|
|||
}
|
||||
|
||||
composeTestRule
|
||||
.onNode(hasScrollToNodeAction())
|
||||
.performScrollToNode(hasText(items))
|
||||
|
||||
composeTestRule
|
||||
.onNodeWithText(text = items)
|
||||
.onNodeWithText(text = "ITEMS (2)")
|
||||
.performScrollTo()
|
||||
.assertIsDisplayed()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Items text count should be displayed according to state`() {
|
||||
val items = "Items"
|
||||
mutableStateFlow.update { DEFAULT_STATE }
|
||||
composeTestRule
|
||||
.onNodeWithText(text = items)
|
||||
.onNodeWithText(text = "ITEMS (1)")
|
||||
.assertDoesNotExist()
|
||||
|
||||
mutableStateFlow.update {
|
||||
|
@ -220,13 +212,9 @@ class VerificationCodeScreenTest : BaseComposeTest() {
|
|||
}
|
||||
|
||||
composeTestRule
|
||||
.onNode(hasScrollToNodeAction())
|
||||
.performScrollToNode(hasText(items))
|
||||
|
||||
composeTestRule
|
||||
.onNodeWithText(text = items)
|
||||
.onNodeWithText(text = "ITEMS (1)")
|
||||
.performScrollTo()
|
||||
.assertIsDisplayed()
|
||||
.assertTextEquals(items, "1")
|
||||
|
||||
mutableStateFlow.update {
|
||||
it.copy(
|
||||
|
@ -242,13 +230,9 @@ class VerificationCodeScreenTest : BaseComposeTest() {
|
|||
}
|
||||
|
||||
composeTestRule
|
||||
.onNode(hasScrollToNodeAction())
|
||||
.performScrollToNode(hasText(items))
|
||||
|
||||
composeTestRule
|
||||
.onNodeWithText(text = items)
|
||||
.onNodeWithText(text = "ITEMS (4)")
|
||||
.performScrollTo()
|
||||
.assertIsDisplayed()
|
||||
.assertTextEquals(items, "4")
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -263,10 +247,6 @@ class VerificationCodeScreenTest : BaseComposeTest() {
|
|||
)
|
||||
}
|
||||
|
||||
composeTestRule
|
||||
.onNodeWithText(text = "1")
|
||||
.assertIsDisplayed()
|
||||
|
||||
composeTestRule
|
||||
.onNodeWithText(text = "Label 1")
|
||||
.assertIsDisplayed()
|
||||
|
|
Loading…
Reference in a new issue