mirror of
https://github.com/bitwarden/android.git
synced 2026-06-10 00:28:29 -05:00
[PM-37804] fix: Drop redundant Stripe checkout confirmation on Upgrade Now (#6980)
This commit is contained in:
@@ -280,7 +280,6 @@ private fun FreeCloudContent(
|
||||
handlers: PlanHandlers,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
var shouldShowUpgradeDialog by rememberSaveable { mutableStateOf(false) }
|
||||
Column(
|
||||
modifier = modifier
|
||||
.fillMaxSize()
|
||||
@@ -300,29 +299,11 @@ private fun FreeCloudContent(
|
||||
// user to Premium.
|
||||
if (!viewState.isPremiumUpgradePending) {
|
||||
UpgradeNowCallToAction(
|
||||
onUpgradeNowClick = { shouldShowUpgradeDialog = true },
|
||||
onUpgradeNowClick = handlers.onUpgradeNowClick,
|
||||
)
|
||||
}
|
||||
Spacer(modifier = Modifier.navigationBarsPadding())
|
||||
}
|
||||
|
||||
if (shouldShowUpgradeDialog) {
|
||||
BitwardenTwoButtonDialog(
|
||||
title = stringResource(id = BitwardenString.continue_to_stripe),
|
||||
message = stringResource(
|
||||
id = BitwardenString
|
||||
.youll_go_to_stripes_secure_checkout_to_complete_your_purchase,
|
||||
),
|
||||
confirmButtonText = stringResource(id = BitwardenString.continue_text),
|
||||
dismissButtonText = stringResource(id = BitwardenString.cancel),
|
||||
onConfirmClick = {
|
||||
shouldShowUpgradeDialog = false
|
||||
handlers.onUpgradeNowClick()
|
||||
},
|
||||
onDismissClick = { shouldShowUpgradeDialog = false },
|
||||
onDismissRequest = { shouldShowUpgradeDialog = false },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
||||
@@ -137,66 +137,14 @@ class PlanScreenTest : BitwardenComposeTest() {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `upgrade now button click should show continue to Stripe confirmation dialog`() {
|
||||
composeTestRule
|
||||
.onAllNodesWithText("Continue to Stripe?")
|
||||
.filterToOne(hasAnyAncestor(isDialog()))
|
||||
.assertDoesNotExist()
|
||||
|
||||
fun `upgrade now button click should send UpgradeNowClick action`() {
|
||||
composeTestRule
|
||||
.onNodeWithTag("UpgradeNowButton")
|
||||
.performScrollTo()
|
||||
.performClick()
|
||||
|
||||
composeTestRule
|
||||
.onAllNodesWithText("Continue to Stripe?")
|
||||
.filterToOne(hasAnyAncestor(isDialog()))
|
||||
.assertExists()
|
||||
composeTestRule
|
||||
.onAllNodesWithText(
|
||||
"You’ll go to Stripe’s secure checkout to complete your purchase.",
|
||||
)
|
||||
.filterToOne(hasAnyAncestor(isDialog()))
|
||||
.assertExists()
|
||||
verify(exactly = 0) { viewModel.trySendAction(PlanAction.UpgradeNowClick) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `upgrade now dialog continue click should send UpgradeNowClick action and dismiss`() {
|
||||
composeTestRule
|
||||
.onNodeWithTag("UpgradeNowButton")
|
||||
.performScrollTo()
|
||||
.performClick()
|
||||
|
||||
composeTestRule
|
||||
.onAllNodesWithText("Continue")
|
||||
.filterToOne(hasAnyAncestor(isDialog()))
|
||||
.performClick()
|
||||
|
||||
verify { viewModel.trySendAction(PlanAction.UpgradeNowClick) }
|
||||
composeTestRule
|
||||
.onAllNodesWithText("Continue to Stripe?")
|
||||
.filterToOne(hasAnyAncestor(isDialog()))
|
||||
.assertDoesNotExist()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `upgrade now dialog cancel click should dismiss without sending action`() {
|
||||
composeTestRule
|
||||
.onNodeWithTag("UpgradeNowButton")
|
||||
.performScrollTo()
|
||||
.performClick()
|
||||
|
||||
composeTestRule
|
||||
.onAllNodesWithText("Cancel")
|
||||
.filterToOne(hasAnyAncestor(isDialog()))
|
||||
.performClick()
|
||||
|
||||
verify(exactly = 0) { viewModel.trySendAction(PlanAction.UpgradeNowClick) }
|
||||
composeTestRule
|
||||
.onAllNodesWithText("Continue to Stripe?")
|
||||
.filterToOne(hasAnyAncestor(isDialog()))
|
||||
.assertDoesNotExist()
|
||||
verify {
|
||||
viewModel.trySendAction(PlanAction.UpgradeNowClick)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user