diff --git a/paymentsheet-example/src/androidTest/java/com/stripe/android/lpm/TestInstantDebits.kt b/paymentsheet-example/src/androidTest/java/com/stripe/android/lpm/TestInstantDebits.kt index 52a8f9d97a6..b1e30870cf8 100644 --- a/paymentsheet-example/src/androidTest/java/com/stripe/android/lpm/TestInstantDebits.kt +++ b/paymentsheet-example/src/androidTest/java/com/stripe/android/lpm/TestInstantDebits.kt @@ -2,7 +2,7 @@ package com.stripe.android.lpm import androidx.compose.ui.test.hasTestTag import androidx.compose.ui.test.isEnabled -import androidx.compose.ui.test.onAllNodesWithText +import androidx.compose.ui.test.onAllNodesWithTag import androidx.test.ext.junit.runners.AndroidJUnit4 import com.stripe.android.BasePlaygroundTest import com.stripe.android.model.PaymentMethod @@ -15,6 +15,7 @@ import com.stripe.android.paymentsheet.example.playground.settings.DefaultBillin import com.stripe.android.paymentsheet.example.playground.settings.DefaultBillingAddressSettingsDefinition import com.stripe.android.paymentsheet.example.playground.settings.LinkSettingsDefinition import com.stripe.android.paymentsheet.example.playground.settings.SupportedPaymentMethodsSettingsDefinition +import com.stripe.android.paymentsheet.paymentdatacollection.ach.TEST_TAG_ACCOUNT_DETAILS import com.stripe.android.paymentsheet.ui.PAYMENT_SHEET_PRIMARY_BUTTON_TEST_TAG import com.stripe.android.test.core.AuthorizeAction import com.stripe.android.test.core.DEFAULT_UI_TIMEOUT @@ -51,7 +52,7 @@ internal class TestInstantDebits : BasePlaygroundTest() { afterAuthorization = { rules.compose.waitUntil(DEFAULT_UI_TIMEOUT.inWholeMilliseconds) { rules.compose - .onAllNodesWithText("STRIPE TEST BANK •••• 6789") + .onAllNodesWithTag(TEST_TAG_ACCOUNT_DETAILS) .fetchSemanticsNodes(atLeastOneRootRequired = false) .isNotEmpty() } diff --git a/paymentsheet-example/src/androidTest/java/com/stripe/android/lpm/TestLinkCardBrand.kt b/paymentsheet-example/src/androidTest/java/com/stripe/android/lpm/TestLinkCardBrand.kt index 4060ccb25c6..e7535a0084f 100644 --- a/paymentsheet-example/src/androidTest/java/com/stripe/android/lpm/TestLinkCardBrand.kt +++ b/paymentsheet-example/src/androidTest/java/com/stripe/android/lpm/TestLinkCardBrand.kt @@ -2,7 +2,7 @@ package com.stripe.android.lpm import androidx.compose.ui.test.hasTestTag import androidx.compose.ui.test.isEnabled -import androidx.compose.ui.test.onAllNodesWithText +import androidx.compose.ui.test.onAllNodesWithTag import androidx.test.ext.junit.runners.AndroidJUnit4 import com.stripe.android.BasePlaygroundTest import com.stripe.android.paymentsheet.example.playground.settings.AutomaticPaymentMethodsSettingsDefinition @@ -14,6 +14,7 @@ import com.stripe.android.paymentsheet.example.playground.settings.DefaultBillin import com.stripe.android.paymentsheet.example.playground.settings.DefaultBillingAddressSettingsDefinition import com.stripe.android.paymentsheet.example.playground.settings.LinkSettingsDefinition import com.stripe.android.paymentsheet.example.playground.settings.SupportedPaymentMethodsSettingsDefinition +import com.stripe.android.paymentsheet.paymentdatacollection.ach.TEST_TAG_ACCOUNT_DETAILS import com.stripe.android.paymentsheet.ui.PAYMENT_SHEET_PRIMARY_BUTTON_TEST_TAG import com.stripe.android.test.core.AuthorizeAction import com.stripe.android.test.core.DEFAULT_UI_TIMEOUT @@ -47,7 +48,7 @@ internal class TestLinkCardBrand : BasePlaygroundTest() { afterAuthorization = { rules.compose.waitUntil(DEFAULT_UI_TIMEOUT.inWholeMilliseconds) { rules.compose - .onAllNodesWithText("STRIPE TEST BANK •••• 6789") + .onAllNodesWithTag(TEST_TAG_ACCOUNT_DETAILS) .fetchSemanticsNodes(atLeastOneRootRequired = false) .isNotEmpty() } diff --git a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/paymentdatacollection/ach/USBankAccountForm.kt b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/paymentdatacollection/ach/USBankAccountForm.kt index d3a175f1a3e..b4b70241dc5 100644 --- a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/paymentdatacollection/ach/USBankAccountForm.kt +++ b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/paymentdatacollection/ach/USBankAccountForm.kt @@ -1,5 +1,6 @@ package com.stripe.android.paymentsheet.paymentdatacollection.ach +import androidx.annotation.RestrictTo import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box @@ -22,6 +23,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.alpha +import androidx.compose.ui.platform.testTag import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.ImeAction @@ -52,6 +54,9 @@ import com.stripe.android.uicore.utils.collectAsState import com.stripe.android.R as StripeR import com.stripe.android.ui.core.R as PaymentsUiCoreR +@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) +const val TEST_TAG_ACCOUNT_DETAILS = "TEST_TAG_ACCOUNT_DETAILS" + @Composable internal fun USBankAccountForm( formArgs: FormArguments, @@ -408,6 +413,7 @@ private fun AccountDetailsForm( Modifier .fillMaxWidth() .padding(bottom = 8.dp) + .testTag(TEST_TAG_ACCOUNT_DETAILS) ) { H6Text( text = stringResource(StripeR.string.stripe_title_bank_account),