[PM-37804] fix: Drop redundant Stripe checkout confirmation on Upgrade Now (#6980)

This commit is contained in:
Patrick Honkonen
2026-05-28 15:08:00 -04:00
committed by GitHub
parent 0f4b3fb9f0
commit 40604d0ec0
2 changed files with 5 additions and 76 deletions

View File

@@ -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

View File

@@ -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(
"Youll go to Stripes 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