Fix instrumentation tests for message backups checkout flow.

This commit is contained in:
Alex Hart
2025-06-04 09:36:08 -03:00
committed by Cody Henthorne
parent a85b8c49d9
commit 5e07e428c0
2 changed files with 6 additions and 5 deletions

View File

@@ -82,8 +82,8 @@ class MessageBackupsCheckoutActivityTest {
composeTestRule.onNodeWithTag("message-backups-type-selection-screen-lazy-column") composeTestRule.onNodeWithTag("message-backups-type-selection-screen-lazy-column")
.performScrollToNode(hasText(context.getString(R.string.MessageBackupsTypeSelectionScreen__text_plus_all_your_media))) .performScrollToNode(hasText(context.getString(R.string.MessageBackupsTypeSelectionScreen__text_plus_all_your_media)))
composeTestRule.onNodeWithText(context.getString(R.string.MessageBackupsTypeSelectionScreen__text_plus_all_your_media)).performClick() composeTestRule.onNodeWithText(context.getString(R.string.MessageBackupsTypeSelectionScreen__text_plus_all_your_media)).performClick()
composeTestRule.onNodeWithText(context.getString(R.string.MessageBackupsTypeSelectionScreen__next)).assertIsEnabled() composeTestRule.onNodeWithTag("subscribe-button").assertIsEnabled()
composeTestRule.onNodeWithText(context.getString(R.string.MessageBackupsTypeSelectionScreen__next)).performClick() composeTestRule.onNodeWithTag("subscribe-button").performClick()
composeTestRule.waitForIdle() composeTestRule.waitForIdle()
testDispatcher.scheduler.advanceUntilIdle() testDispatcher.scheduler.advanceUntilIdle()
@@ -125,8 +125,8 @@ class MessageBackupsCheckoutActivityTest {
composeTestRule.onNodeWithTag("message-backups-type-selection-screen-lazy-column") composeTestRule.onNodeWithTag("message-backups-type-selection-screen-lazy-column")
.performScrollToNode(hasText(context.getString(R.string.MessageBackupsTypeSelectionScreen__free))) .performScrollToNode(hasText(context.getString(R.string.MessageBackupsTypeSelectionScreen__free)))
composeTestRule.onNodeWithText(context.getString(R.string.MessageBackupsTypeSelectionScreen__free)).performClick() composeTestRule.onNodeWithText(context.getString(R.string.MessageBackupsTypeSelectionScreen__free)).performClick()
composeTestRule.onNodeWithText(context.getString(R.string.MessageBackupsTypeSelectionScreen__next)).assertIsEnabled() composeTestRule.onNodeWithTag("subscribe-button").assertIsEnabled()
composeTestRule.onNodeWithText(context.getString(R.string.MessageBackupsTypeSelectionScreen__next)).performClick() composeTestRule.onNodeWithTag("subscribe-button").performClick()
composeTestRule.waitForIdle() composeTestRule.waitForIdle()
assertThat(SignalStore.backup.backupTier).isEqualTo(MessageBackupTier.FREE) assertThat(SignalStore.backup.backupTier).isEqualTo(MessageBackupTier.FREE)
@@ -175,7 +175,7 @@ class MessageBackupsCheckoutActivityTest {
// Type selection screen // Type selection screen
composeTestRule.onNodeWithText(context.getString(R.string.MessagesBackupsTypeSelectionScreen__choose_your_backup_plan)).assertIsDisplayed() composeTestRule.onNodeWithText(context.getString(R.string.MessagesBackupsTypeSelectionScreen__choose_your_backup_plan)).assertIsDisplayed()
composeTestRule.onNodeWithText(context.getString(R.string.MessageBackupsTypeSelectionScreen__next)).assertIsNotEnabled() composeTestRule.onNodeWithTag("subscribe-button").assertIsNotEnabled()
} }
private fun launchCheckoutFlow(tier: MessageBackupTier? = null): ActivityScenario<MessageBackupsCheckoutActivity> { private fun launchCheckoutFlow(tier: MessageBackupTier? = null): ActivityScenario<MessageBackupsCheckoutActivity> {

View File

@@ -163,6 +163,7 @@ fun MessageBackupsTypeSelectionScreen(
onClick = onNextClicked, onClick = onNextClicked,
enabled = isNextEnabled, enabled = isNextEnabled,
modifier = Modifier modifier = Modifier
.testTag("subscribe-button")
.fillMaxWidth() .fillMaxWidth()
.padding(vertical = if (hasCurrentBackupTier) 10.dp else 16.dp) .padding(vertical = if (hasCurrentBackupTier) 10.dp else 16.dp)
) { ) {