Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tjclawson-stripe committed Feb 18, 2025
1 parent 7cef837 commit 41c38f5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ internal class CustomerSheetPage(
.performTextReplacement(text)
}

private fun fillExpirationDate(text: String) {
composeTestRule.onNode(hasContentDescription(value = "Expiration date", substring = true))
.performTextReplacement(text)
}

private fun clickDropdownMenu() {
waitForIdle()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ internal class PaymentSheetBillingConfigurationTest {
}

page.replaceText("123 Main Street", "123 Main Road")
page.replaceText("MM / YY", "12/34")
page.fillExpirationDate("12/34")

// Check that line 1 was not reset to default value
page.waitForText("123 Main Road")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.widget.Button
import androidx.compose.ui.test.ExperimentalTestApi
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.assertIsEnabled
import androidx.compose.ui.test.hasContentDescription
import androidx.compose.ui.test.hasTestTag
import androidx.compose.ui.test.hasText
import androidx.compose.ui.test.isEnabled
Expand Down Expand Up @@ -38,7 +39,7 @@ internal class PaymentSheetPage(
waitForText("Card number")

replaceText("Card number", "4242424242424242")
replaceText("MM / YY", "12/34")
fillExpirationDate("12/34")
replaceText("CVC", "123")

if (fillOutZipCode) {
Expand Down Expand Up @@ -106,7 +107,7 @@ internal class PaymentSheetPage(
waitForText("Card number")

replaceText("Card number", "4000002500001001")
replaceText("MM / YY", "12/34")
fillExpirationDate("12/34")
replaceText("CVC", "123")

clickDropdownMenu()
Expand Down Expand Up @@ -201,6 +202,11 @@ internal class PaymentSheetPage(
.performTextReplacement(text)
}

fun fillExpirationDate(text: String) {
composeTestRule.onNode(hasContentDescription(value = "Expiration date", substring = true))
.performTextReplacement(text)
}

private fun clickDropdownMenu() {
composeTestRule.onNode(hasTestTag(DROPDOWN_MENU_CLICKABLE_TEST_TAG))
.performScrollTo()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.compose.ui.test.assert
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.assertIsEnabled
import androidx.compose.ui.test.assertIsNotDisplayed
import androidx.compose.ui.test.hasContentDescription
import androidx.compose.ui.test.hasText
import androidx.compose.ui.test.junit4.createAndroidComposeRule
import androidx.compose.ui.test.onChild
Expand Down Expand Up @@ -189,7 +190,9 @@ internal class PaymentMethodScreenTest {

private fun onCvc() = composeTestRule.onNode(hasText("CVC"))

private fun onExpiryDate() = composeTestRule.onNode(hasText("MM / YY"))
private fun onExpiryDate() = composeTestRule.onNode(
hasContentDescription(value = "Expiration date", substring = true)
)

private fun onZipCode() = composeTestRule.onNode(hasText("ZIP Code"))

Expand Down

0 comments on commit 41c38f5

Please sign in to comment.