mirror of
https://github.com/bitwarden/android.git
synced 2026-11-19 17:40:12 -06:00
BIT-1575: Collection Screen (#878)
This commit is contained in:
committed by
Álison Fernandes
parent
96401aba79
commit
034284fad4
+1
-1
@@ -89,7 +89,7 @@ class VaultAddEditScreenTest : BaseComposeTest() {
|
||||
},
|
||||
onNavigateToGeneratorModal = { onNavigateToGeneratorModalType = it },
|
||||
onNavigateToAttachments = { onNavigateToAttachmentsId = it },
|
||||
onNavigateToMoveToOrganization = { onNavigateToMoveToOrganizationId = it },
|
||||
onNavigateToMoveToOrganization = { id, _ -> onNavigateToMoveToOrganizationId = id },
|
||||
viewModel = viewModel,
|
||||
permissionsManager = fakePermissionManager,
|
||||
)
|
||||
|
||||
@@ -76,7 +76,9 @@ class VaultItemScreenTest : BaseComposeTest() {
|
||||
viewModel = viewModel,
|
||||
onNavigateBack = { onNavigateBackCalled = true },
|
||||
onNavigateToVaultAddEditItem = { id, _ -> onNavigateToVaultEditItemId = id },
|
||||
onNavigateToMoveToOrganization = { onNavigateToMoveToOrganizationItemId = it },
|
||||
onNavigateToMoveToOrganization = { id, _ ->
|
||||
onNavigateToMoveToOrganizationItemId = id
|
||||
},
|
||||
onNavigateToAttachments = { onNavigateToAttachmentsId = it },
|
||||
intentManager = intentManager,
|
||||
)
|
||||
|
||||
+82
@@ -50,6 +50,87 @@ class VaultMoveToOrganizationScreenTest : BaseComposeTest() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `the app bar title should display according to state`() {
|
||||
mutableStateFlow.update { currentState ->
|
||||
currentState.copy(viewState = VaultMoveToOrganizationState.ViewState.Loading)
|
||||
}
|
||||
|
||||
composeTestRule
|
||||
.onNodeWithText(text = "Collections")
|
||||
.assertIsNotDisplayed()
|
||||
composeTestRule
|
||||
.onNodeWithText(text = "Move to Organization")
|
||||
.assertIsDisplayed()
|
||||
|
||||
mutableStateFlow.update { currentState ->
|
||||
currentState.copy(onlyShowCollections = true)
|
||||
}
|
||||
|
||||
composeTestRule
|
||||
.onNodeWithText(text = "Move to Organization")
|
||||
.assertIsNotDisplayed()
|
||||
composeTestRule
|
||||
.onNodeWithText(text = "Collections")
|
||||
.assertIsDisplayed()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `the app bar button text should display according to state`() {
|
||||
mutableStateFlow.update { currentState ->
|
||||
currentState.copy(viewState = VaultMoveToOrganizationState.ViewState.Loading)
|
||||
}
|
||||
|
||||
composeTestRule
|
||||
.onNodeWithText(text = "Save")
|
||||
.assertIsNotDisplayed()
|
||||
composeTestRule
|
||||
.onNodeWithText(text = "Move")
|
||||
.assertIsDisplayed()
|
||||
|
||||
mutableStateFlow.update { currentState ->
|
||||
currentState.copy(onlyShowCollections = true)
|
||||
}
|
||||
|
||||
composeTestRule
|
||||
.onNodeWithText(text = "Move")
|
||||
.assertIsNotDisplayed()
|
||||
composeTestRule
|
||||
.onNodeWithText(text = "Save")
|
||||
.assertIsDisplayed()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `the organization option field should update according to state`() {
|
||||
composeTestRule
|
||||
.onNodeWithContentDescription(label = "Organization, mockOrganizationName-1")
|
||||
.assertIsDisplayed()
|
||||
|
||||
mutableStateFlow.update { currentState ->
|
||||
currentState.copy(onlyShowCollections = true)
|
||||
}
|
||||
|
||||
composeTestRule
|
||||
.onNodeWithContentDescription(label = "Organization, mockOrganizationName-1")
|
||||
.assertIsNotDisplayed()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `the organization option field description should update according to state`() {
|
||||
composeTestRule
|
||||
.onNodeWithText(text = "Choose an organization that", substring = true)
|
||||
.assertIsDisplayed()
|
||||
|
||||
mutableStateFlow.update { currentState ->
|
||||
currentState.copy(onlyShowCollections = true)
|
||||
}
|
||||
|
||||
composeTestRule
|
||||
composeTestRule
|
||||
.onNodeWithText(text = "Choose an organization that", substring = true)
|
||||
.assertIsNotDisplayed()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `on NavigateBack event should invoke onNavigateBack`() {
|
||||
mutableEventFlow.tryEmit(VaultMoveToOrganizationEvent.NavigateBack)
|
||||
@@ -235,4 +316,5 @@ private fun createVaultMoveToOrganizationState(): VaultMoveToOrganizationState =
|
||||
selectedOrganizationId = "mockOrganizationId-1",
|
||||
),
|
||||
dialogState = null,
|
||||
onlyShowCollections = false,
|
||||
)
|
||||
|
||||
+3
@@ -391,9 +391,11 @@ class VaultMoveToOrganizationViewModelTest : BaseViewModelTest() {
|
||||
private fun createSavedStateHandleWithState(
|
||||
state: VaultMoveToOrganizationState? = null,
|
||||
vaultItemId: String = "mockCipherId",
|
||||
showOnlyCollections: Boolean = false,
|
||||
) = SavedStateHandle().apply {
|
||||
set("state", state)
|
||||
set("vault_move_to_organization_id", vaultItemId)
|
||||
set("vault_move_to_organization_only_collections", "$showOnlyCollections")
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@@ -405,6 +407,7 @@ class VaultMoveToOrganizationViewModelTest : BaseViewModelTest() {
|
||||
vaultItemId = vaultItemId,
|
||||
viewState = viewState,
|
||||
dialogState = dialogState,
|
||||
onlyShowCollections = false,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user