BIT-1962: Add Direct Link to Privacy Policy in About Screen (#1084)

This commit is contained in:
Patrick Honkonen
2024-06-20 17:08:07 +01:00
committed by Álison Fernandes
parent fc17370223
commit bd84a8649d
4 changed files with 70 additions and 2 deletions
@@ -88,6 +88,22 @@ class AboutScreenTest : BaseComposeTest() {
}
}
@Suppress("MaxLineLength")
@Test
fun `on privacy policy click should display confirmation dialog and confirm click should emit PrivacyPolicyClick`() {
composeTestRule.onNode(isDialog()).assertDoesNotExist()
composeTestRule.onNodeWithText("Privacy Policy").performClick()
composeTestRule.onNode(isDialog()).assertExists()
composeTestRule
.onAllNodesWithText("Continue")
.filterToOne(hasAnyAncestor(isDialog()))
.performClick()
composeTestRule.onNode(isDialog()).assertDoesNotExist()
verify {
viewModel.trySendAction(AboutAction.PrivacyPolicyClick)
}
}
@Suppress("MaxLineLength")
@Test
fun `on bitwarden web vault click should display confirmation dialog and confirm click should emit WebVaultClick`() {
@@ -134,6 +150,14 @@ class AboutScreenTest : BaseComposeTest() {
}
}
@Test
fun `on NavigateToPrivacyPolicy should call launchUri on IntentManager`() {
mutableEventFlow.tryEmit(AboutEvent.NavigateToPrivacyPolicy)
verify {
intentManager.launchUri("https://bitwarden.com/privacy".toUri())
}
}
@Test
fun `on NavigateToLearnAboutOrganizations should call launchUri on IntentManager`() {
mutableEventFlow.tryEmit(AboutEvent.NavigateToLearnAboutOrganizations)
@@ -209,7 +233,9 @@ class AboutScreenTest : BaseComposeTest() {
@Test
fun `on version info click should send VersionClick`() {
composeTestRule.onNodeWithText("Version: 1.0.0 (1)").performClick()
composeTestRule.onNodeWithText("Version: 1.0.0 (1)")
.performScrollTo()
.performClick()
verify {
viewModel.trySendAction(AboutAction.VersionClick)
}
@@ -217,7 +243,9 @@ class AboutScreenTest : BaseComposeTest() {
@Test
fun `version should update according to the state`() = runTest {
composeTestRule.onNodeWithText("Version: 1.0.0 (1)").assertIsDisplayed()
composeTestRule.onNodeWithText("Version: 1.0.0 (1)")
.performScrollTo()
.assertIsDisplayed()
mutableStateFlow.update { it.copy(version = "Version: 1.1.0 (2)".asText()) }
@@ -53,6 +53,15 @@ class AboutViewModelTest : BaseViewModelTest() {
}
}
@Test
fun `on PrivacyPolicyClick should emit NavigateToPrivacyPolicy`() = runTest {
val viewModel = createViewModel(DEFAULT_ABOUT_STATE)
viewModel.eventFlow.test {
viewModel.trySendAction(AboutAction.PrivacyPolicyClick)
assertEquals(AboutEvent.NavigateToPrivacyPolicy, awaitItem())
}
}
@Test
fun `on LearnAboutOrganizationsClick should emit NavigateToLearnAboutOrganizations`() =
runTest {