Ensure FAB is hidden for some Vault Screen states (#401)

This commit is contained in:
Brian Yencho
2024-06-20 17:08:07 +01:00
committed by Álison Fernandes
parent 1b7e01ea89
commit 5235310de5
3 changed files with 38 additions and 5 deletions
@@ -283,6 +283,25 @@ class VaultScreenTest : BaseComposeTest() {
verify { viewModel.trySendAction(VaultAction.ExitConfirmationClick) }
}
@Test
fun `floating action button should be shown or hidden according to the state`() {
val fabDescription = "Add item"
mutableStateFlow.update { it.copy(viewState = VaultState.ViewState.Loading) }
composeTestRule.onNodeWithContentDescription(fabDescription).assertDoesNotExist()
mutableStateFlow.update {
it.copy(viewState = VaultState.ViewState.Error("Error".asText()))
}
composeTestRule.onNodeWithContentDescription(fabDescription).assertDoesNotExist()
mutableStateFlow.update { it.copy(viewState = VaultState.ViewState.NoItems) }
composeTestRule.onNodeWithContentDescription(fabDescription).assertIsDisplayed()
mutableStateFlow.update { it.copy(viewState = DEFAULT_CONTENT_VIEW_STATE) }
composeTestRule.onNodeWithContentDescription(fabDescription).assertIsDisplayed()
}
@Test
fun `error dialog should be shown or hidden according to the state`() {
val errorTitle = "Error title"