diff --git a/paymentsheet/src/test/java/com/stripe/android/common/ui/ClickWorkaround.kt b/paymentsheet/src/test/java/com/stripe/android/common/ui/ClickWorkaround.kt new file mode 100644 index 00000000000..35d54519938 --- /dev/null +++ b/paymentsheet/src/test/java/com/stripe/android/common/ui/ClickWorkaround.kt @@ -0,0 +1,18 @@ +package com.stripe.android.common.ui + +import androidx.compose.ui.input.key.Key +import androidx.compose.ui.test.ExperimentalTestApi +import androidx.compose.ui.test.SemanticsNodeInteraction +import androidx.compose.ui.test.invokeGlobalAssertions +import androidx.compose.ui.test.performKeyInput +import androidx.compose.ui.test.requestFocus + +fun SemanticsNodeInteraction.performClickWithKeyboard(): SemanticsNodeInteraction { + @OptIn(ExperimentalTestApi::class) + return this.invokeGlobalAssertions() + .requestFocus() + .performKeyInput { + keyDown(Key.Enter) + keyUp(Key.Enter) + } +} diff --git a/paymentsheet/src/test/java/com/stripe/android/customersheet/CustomerSessionCustomerSheetActivityTest.kt b/paymentsheet/src/test/java/com/stripe/android/customersheet/CustomerSessionCustomerSheetActivityTest.kt index 5e29a91502f..13c8d943eda 100644 --- a/paymentsheet/src/test/java/com/stripe/android/customersheet/CustomerSessionCustomerSheetActivityTest.kt +++ b/paymentsheet/src/test/java/com/stripe/android/customersheet/CustomerSessionCustomerSheetActivityTest.kt @@ -4,11 +4,11 @@ import android.app.Application import androidx.compose.ui.test.assertIsEnabled import androidx.compose.ui.test.hasTestTag import androidx.compose.ui.test.junit4.createAndroidComposeRule -import androidx.compose.ui.test.performClick import androidx.lifecycle.testing.TestLifecycleOwner import androidx.test.core.app.ActivityScenario import androidx.test.core.app.ApplicationProvider import androidx.test.ext.junit.runners.AndroidJUnit4 +import com.stripe.android.common.ui.performClickWithKeyboard import com.stripe.android.core.utils.urlEncode import com.stripe.android.customersheet.util.CustomerSheetHacks import com.stripe.android.model.CardBrand @@ -74,7 +74,7 @@ class CustomerSessionCustomerSheetActivityTest { isPaymentMethodRemoveEnabled = true, allowsRemovalOfLastSavedPaymentMethod = true, ) { - savedPaymentMethodsPage.onEditButton().performClick() + savedPaymentMethodsPage.onEditButton().performClickWithKeyboard() savedPaymentMethodsPage.onSavedPaymentMethod(last4 = "4242").assertIsEnabled() savedPaymentMethodsPage.onSavedPaymentMethod(last4 = "5544").assertIsEnabled() @@ -89,7 +89,7 @@ class CustomerSessionCustomerSheetActivityTest { isPaymentMethodRemoveEnabled = true, allowsRemovalOfLastSavedPaymentMethod = true, ) { - savedPaymentMethodsPage.onEditButton().performClick() + savedPaymentMethodsPage.onEditButton().performClickWithKeyboard() savedPaymentMethodsPage.onSavedPaymentMethod(last4 = "4242").assertIsEnabled() } @@ -129,7 +129,7 @@ class CustomerSessionCustomerSheetActivityTest { isPaymentMethodRemoveEnabled = false, allowsRemovalOfLastSavedPaymentMethod = true, ) { - savedPaymentMethodsPage.onEditButton().performClick() + savedPaymentMethodsPage.onEditButton().performClickWithKeyboard() val nonCbcCard = savedPaymentMethodsPage.onSavedPaymentMethod(last4 = "5544") nonCbcCard.assertIsEnabled() @@ -151,7 +151,7 @@ class CustomerSessionCustomerSheetActivityTest { isPaymentMethodRemoveEnabled = true, allowsRemovalOfLastSavedPaymentMethod = true, ) { - savedPaymentMethodsPage.onEditButton().performClick() + savedPaymentMethodsPage.onEditButton().performClickWithKeyboard() savedPaymentMethodsPage.onSavedPaymentMethod(last4 = "5544").assertIsEnabled() @@ -160,7 +160,7 @@ class CustomerSessionCustomerSheetActivityTest { cbcCard.assertIsEnabled() cbcCard.assertHasModifyBadge() - savedPaymentMethodsPage.onModifyBadgeFor(last4 = "4242").performClick() + savedPaymentMethodsPage.onModifyBadgeFor(last4 = "4242").performClickWithKeyboard() editPage.onRemoveButton().assertIsEnabled() } @@ -175,14 +175,14 @@ class CustomerSessionCustomerSheetActivityTest { isCanRemoveLastPaymentMethodEnabled = true, allowsRemovalOfLastSavedPaymentMethod = true, ) { - savedPaymentMethodsPage.onEditButton().performClick() + savedPaymentMethodsPage.onEditButton().performClickWithKeyboard() val cbcCard = savedPaymentMethodsPage.onSavedPaymentMethod(last4 = "4242") cbcCard.assertIsEnabled() cbcCard.assertHasModifyBadge() - savedPaymentMethodsPage.onModifyBadgeFor(last4 = "4242").performClick() + savedPaymentMethodsPage.onModifyBadgeFor(last4 = "4242").performClickWithKeyboard() editPage.onRemoveButton().assertIsEnabled() } @@ -197,14 +197,14 @@ class CustomerSessionCustomerSheetActivityTest { isCanRemoveLastPaymentMethodEnabled = true, allowsRemovalOfLastSavedPaymentMethod = true, ) { - savedPaymentMethodsPage.onEditButton().performClick() + savedPaymentMethodsPage.onEditButton().performClickWithKeyboard() val cbcCard = savedPaymentMethodsPage.onSavedPaymentMethod(last4 = "4242") cbcCard.assertIsEnabled() cbcCard.assertHasModifyBadge() - savedPaymentMethodsPage.onModifyBadgeFor(last4 = "4242").performClick() + savedPaymentMethodsPage.onModifyBadgeFor(last4 = "4242").performClickWithKeyboard() editPage.onRemoveButton().assertDoesNotExist() } @@ -219,14 +219,14 @@ class CustomerSessionCustomerSheetActivityTest { isCanRemoveLastPaymentMethodEnabled = true, allowsRemovalOfLastSavedPaymentMethod = false, ) { - savedPaymentMethodsPage.onEditButton().performClick() + savedPaymentMethodsPage.onEditButton().performClickWithKeyboard() val cbcCard = savedPaymentMethodsPage.onSavedPaymentMethod(last4 = "4242") cbcCard.assertIsEnabled() cbcCard.assertHasModifyBadge() - savedPaymentMethodsPage.onModifyBadgeFor(last4 = "4242").performClick() + savedPaymentMethodsPage.onModifyBadgeFor(last4 = "4242").performClickWithKeyboard() editPage.onRemoveButton().assertDoesNotExist() } @@ -241,14 +241,14 @@ class CustomerSessionCustomerSheetActivityTest { isCanRemoveLastPaymentMethodEnabled = false, allowsRemovalOfLastSavedPaymentMethod = true, ) { - savedPaymentMethodsPage.onEditButton().performClick() + savedPaymentMethodsPage.onEditButton().performClickWithKeyboard() val cbcCard = savedPaymentMethodsPage.onSavedPaymentMethod(last4 = "4242") cbcCard.assertIsEnabled() cbcCard.assertHasModifyBadge() - savedPaymentMethodsPage.onModifyBadgeFor(last4 = "4242").performClick() + savedPaymentMethodsPage.onModifyBadgeFor(last4 = "4242").performClickWithKeyboard() editPage.onRemoveButton().assertDoesNotExist() } @@ -262,8 +262,8 @@ class CustomerSessionCustomerSheetActivityTest { isPaymentMethodRemoveEnabled = true, allowsRemovalOfLastSavedPaymentMethod = true, ) { - savedPaymentMethodsPage.onEditButton().performClick() - savedPaymentMethodsPage.onModifyBadgeFor(last4 = "4242").performClick() + savedPaymentMethodsPage.onEditButton().performClickWithKeyboard() + savedPaymentMethodsPage.onModifyBadgeFor(last4 = "4242").performClickWithKeyboard() savedPaymentMethodsPage.clickRemoveButton() enqueuePaymentMethods( @@ -293,8 +293,8 @@ class CustomerSessionCustomerSheetActivityTest { PaymentMethodFactory.card(last4 = "1001"), ), ) { - savedPaymentMethodsPage.onEditButton().performClick() - savedPaymentMethodsPage.onModifyBadgeFor(last4 = "4242").performClick() + savedPaymentMethodsPage.onEditButton().performClickWithKeyboard() + savedPaymentMethodsPage.onModifyBadgeFor(last4 = "4242").performClickWithKeyboard() enqueuePaymentMethods( cards = listOf( @@ -310,7 +310,7 @@ class CustomerSessionCustomerSheetActivityTest { enqueueDetachPaymentMethod(id = "pm_3") enqueueDetachPaymentMethod(id = "pm_4") - editPage.onRemoveButton().performClick() + editPage.onRemoveButton().performClickWithKeyboard() removeDialog.confirm() savedPaymentMethodsPage.waitUntilVisible() @@ -325,8 +325,8 @@ class CustomerSessionCustomerSheetActivityTest { .update(last4 = "1001", addCbcNetworks = true), ), ) { - savedPaymentMethodsPage.onEditButton().performClick() - savedPaymentMethodsPage.onModifyBadgeFor(last4 = "1001").performClick() + savedPaymentMethodsPage.onEditButton().performClickWithKeyboard() + savedPaymentMethodsPage.onModifyBadgeFor(last4 = "1001").performClickWithKeyboard() editPage.setCardBrand("Visa") editPage.update() diff --git a/paymentsheet/src/test/java/com/stripe/android/customersheet/CustomerSheetPage.kt b/paymentsheet/src/test/java/com/stripe/android/customersheet/CustomerSheetPage.kt index 65fb24182c2..cbb9a0b0577 100644 --- a/paymentsheet/src/test/java/com/stripe/android/customersheet/CustomerSheetPage.kt +++ b/paymentsheet/src/test/java/com/stripe/android/customersheet/CustomerSheetPage.kt @@ -4,8 +4,8 @@ import androidx.compose.ui.test.hasText import androidx.compose.ui.test.hasTextExactly import androidx.compose.ui.test.junit4.ComposeTestRule import androidx.compose.ui.test.onNodeWithTag -import androidx.compose.ui.test.performClick import androidx.compose.ui.test.performTextInput +import com.stripe.android.common.ui.performClickWithKeyboard import com.stripe.android.paymentsheet.ui.SAVED_PAYMENT_METHOD_CARD_TEST_TAG internal class CustomerSheetPage( @@ -14,7 +14,7 @@ internal class CustomerSheetPage( fun clickOnText(text: String) { waitForText(text) - composeTestRule.onNode(hasText(text, ignoreCase = true)).performClick() + composeTestRule.onNode(hasText(text, ignoreCase = true)).performClickWithKeyboard() } fun clickPaymentOptionItem(text: String) { @@ -25,7 +25,7 @@ internal class CustomerSheetPage( } composeTestRule.onNodeWithTag("${SAVED_PAYMENT_METHOD_CARD_TEST_TAG}_$text") - .performClick() + .performClickWithKeyboard() composeTestRule.waitForIdle() } diff --git a/paymentsheet/src/test/java/com/stripe/android/paymentsheet/CustomerSessionPaymentSheetActivityTest.kt b/paymentsheet/src/test/java/com/stripe/android/paymentsheet/CustomerSessionPaymentSheetActivityTest.kt index 3ab133d5d77..4a285f97ecb 100644 --- a/paymentsheet/src/test/java/com/stripe/android/paymentsheet/CustomerSessionPaymentSheetActivityTest.kt +++ b/paymentsheet/src/test/java/com/stripe/android/paymentsheet/CustomerSessionPaymentSheetActivityTest.kt @@ -11,9 +11,9 @@ import androidx.compose.ui.test.hasTestTag import androidx.compose.ui.test.hasText import androidx.compose.ui.test.junit4.ComposeTestRule import androidx.compose.ui.test.junit4.createAndroidComposeRule -import androidx.compose.ui.test.performClick import androidx.test.core.app.ActivityScenario import androidx.test.core.app.ApplicationProvider +import com.stripe.android.common.ui.performClickWithKeyboard import com.stripe.android.model.CardBrand import com.stripe.android.model.PaymentMethod import com.stripe.android.networktesting.NetworkRule @@ -60,7 +60,7 @@ internal class CustomerSessionPaymentSheetActivityTest { canRemoveLastPaymentMethodConfig = true, canRemoveLastPaymentMethodServer = true, ) { - composeTestRule.onEditButton().performClick() + composeTestRule.onEditButton().performClickWithKeyboard() composeTestRule.onSavedPaymentMethod(last4 = "4242").assertIsEnabled() composeTestRule.onSavedPaymentMethod(last4 = "5544").assertIsEnabled() @@ -76,7 +76,7 @@ internal class CustomerSessionPaymentSheetActivityTest { canRemoveLastPaymentMethodConfig = true, canRemoveLastPaymentMethodServer = true, ) { - composeTestRule.onEditButton().performClick() + composeTestRule.onEditButton().performClickWithKeyboard() composeTestRule.onSavedPaymentMethod(last4 = "4242").assertIsEnabled() } @@ -145,7 +145,7 @@ internal class CustomerSessionPaymentSheetActivityTest { canRemoveLastPaymentMethodConfig = true, canRemoveLastPaymentMethodServer = false, ) { - composeTestRule.onEditButton().performClick() + composeTestRule.onEditButton().performClickWithKeyboard() val nonCbcCard = composeTestRule.onSavedPaymentMethod(last4 = "5544") nonCbcCard.assertIsEnabled() @@ -168,7 +168,7 @@ internal class CustomerSessionPaymentSheetActivityTest { canRemoveLastPaymentMethodConfig = true, canRemoveLastPaymentMethodServer = false, ) { - composeTestRule.onEditButton().performClick() + composeTestRule.onEditButton().performClickWithKeyboard() composeTestRule.onSavedPaymentMethod(last4 = "5544").assertIsEnabled() @@ -177,7 +177,7 @@ internal class CustomerSessionPaymentSheetActivityTest { cbcCard.assertIsEnabled() cbcCard.assertHasModifyBadge() - composeTestRule.onModifyBadgeFor(last4 = "4242").performClick() + composeTestRule.onModifyBadgeFor(last4 = "4242").performClickWithKeyboard() composeTestRule.onUpdateScreenRemoveButton().assertIsEnabled() } @@ -192,14 +192,14 @@ internal class CustomerSessionPaymentSheetActivityTest { canRemoveLastPaymentMethodConfig = true, canRemoveLastPaymentMethodServer = false, ) { - composeTestRule.onEditButton().performClick() + composeTestRule.onEditButton().performClickWithKeyboard() val cbcCard = composeTestRule.onSavedPaymentMethod(last4 = "4242") cbcCard.assertIsEnabled() cbcCard.assertHasModifyBadge() - composeTestRule.onModifyBadgeFor(last4 = "4242").performClick() + composeTestRule.onModifyBadgeFor(last4 = "4242").performClickWithKeyboard() composeTestRule.onUpdateScreenRemoveButton().assertDoesNotExist() } @@ -214,14 +214,14 @@ internal class CustomerSessionPaymentSheetActivityTest { canRemoveLastPaymentMethodConfig = false, canRemoveLastPaymentMethodServer = true, ) { - composeTestRule.onEditButton().performClick() + composeTestRule.onEditButton().performClickWithKeyboard() val cbcCard = composeTestRule.onSavedPaymentMethod(last4 = "4242") cbcCard.assertIsEnabled() cbcCard.assertHasModifyBadge() - composeTestRule.onModifyBadgeFor(last4 = "4242").performClick() + composeTestRule.onModifyBadgeFor(last4 = "4242").performClickWithKeyboard() composeTestRule.onUpdateScreenRemoveButton().assertDoesNotExist() } @@ -236,14 +236,14 @@ internal class CustomerSessionPaymentSheetActivityTest { canRemoveLastPaymentMethodConfig = true, canRemoveLastPaymentMethodServer = true, ) { - composeTestRule.onEditButton().performClick() + composeTestRule.onEditButton().performClickWithKeyboard() val cbcCard = composeTestRule.onSavedPaymentMethod(last4 = "4242") cbcCard.assertIsEnabled() cbcCard.assertHasModifyBadge() - composeTestRule.onModifyBadgeFor(last4 = "4242").performClick() + composeTestRule.onModifyBadgeFor(last4 = "4242").performClickWithKeyboard() composeTestRule.onUpdateScreenRemoveButton().assertIsEnabled() } @@ -258,14 +258,14 @@ internal class CustomerSessionPaymentSheetActivityTest { canRemoveLastPaymentMethodConfig = true, canRemoveLastPaymentMethodServer = false, ) { - composeTestRule.onEditButton().performClick() + composeTestRule.onEditButton().performClickWithKeyboard() val cbcCard = composeTestRule.onSavedPaymentMethod(last4 = "4242") cbcCard.assertIsEnabled() cbcCard.assertHasModifyBadge() - composeTestRule.onModifyBadgeFor(last4 = "4242").performClick() + composeTestRule.onModifyBadgeFor(last4 = "4242").performClickWithKeyboard() composeTestRule.onUpdateScreenRemoveButton().assertDoesNotExist() } @@ -280,14 +280,14 @@ internal class CustomerSessionPaymentSheetActivityTest { canRemoveLastPaymentMethodConfig = false, canRemoveLastPaymentMethodServer = false, ) { - composeTestRule.onEditButton().performClick() + composeTestRule.onEditButton().performClickWithKeyboard() val cbcCard = composeTestRule.onSavedPaymentMethod(last4 = "4242") cbcCard.assertIsEnabled() cbcCard.assertHasModifyBadge() - composeTestRule.onModifyBadgeFor(last4 = "4242").performClick() + composeTestRule.onModifyBadgeFor(last4 = "4242").performClickWithKeyboard() composeTestRule.onUpdateScreenRemoveButton().assertDoesNotExist() } diff --git a/paymentsheet/src/test/java/com/stripe/android/paymentsheet/EditPage.kt b/paymentsheet/src/test/java/com/stripe/android/paymentsheet/EditPage.kt index 90f37d327e2..0818bcad3ed 100644 --- a/paymentsheet/src/test/java/com/stripe/android/paymentsheet/EditPage.kt +++ b/paymentsheet/src/test/java/com/stripe/android/paymentsheet/EditPage.kt @@ -1,9 +1,12 @@ package com.stripe.android.paymentsheet import androidx.compose.ui.test.SemanticsNodeInteraction +import androidx.compose.ui.test.hasAnyAncestor +import androidx.compose.ui.test.hasTestTag +import androidx.compose.ui.test.isFocusable import androidx.compose.ui.test.junit4.ComposeTestRule import androidx.compose.ui.test.onNodeWithTag -import androidx.compose.ui.test.performClick +import com.stripe.android.common.ui.performClickWithKeyboard import com.stripe.android.paymentsheet.ui.UPDATE_PM_REMOVE_BUTTON_TEST_TAG import com.stripe.android.paymentsheet.ui.UPDATE_PM_SAVE_BUTTON_TEST_TAG import com.stripe.android.paymentsheet.ui.UPDATE_PM_SCREEN_TEST_TAG @@ -22,16 +25,16 @@ internal class EditPage( fun setCardBrand(cardBrand: String) { composeTestRule.onNodeWithTag(DROPDOWN_MENU_CLICKABLE_TEST_TAG) - .performClick() + .performClickWithKeyboard() composeTestRule.onNodeWithTag("${TEST_TAG_DROP_DOWN_CHOICE}_$cardBrand") - .performClick() + .performClickWithKeyboard() } fun assertNotInDropdown(cardBrand: String) { // Click on the dropdown menu to expand it composeTestRule.onNodeWithTag(DROPDOWN_MENU_CLICKABLE_TEST_TAG) - .performClick() + .performClickWithKeyboard() // Attempt to find the node with the specified cardBrand // and assert that it does not exist @@ -40,20 +43,20 @@ internal class EditPage( // Optionally, close the dropdown menu if it's still open composeTestRule.onNodeWithTag(DROPDOWN_MENU_CLICKABLE_TEST_TAG) - .performClick() + .performClickWithKeyboard() } fun update() { - composeTestRule.onNodeWithTag(UPDATE_PM_SAVE_BUTTON_TEST_TAG) - .performClick() + composeTestRule.onNode(hasAnyAncestor(hasTestTag(UPDATE_PM_SAVE_BUTTON_TEST_TAG)).and(isFocusable())) + .performClickWithKeyboard() } fun onRemoveButton(): SemanticsNodeInteraction { - return composeTestRule.onNodeWithTag(UPDATE_PM_REMOVE_BUTTON_TEST_TAG) + return composeTestRule.onNode(hasAnyAncestor(hasTestTag(UPDATE_PM_REMOVE_BUTTON_TEST_TAG)).and(isFocusable())) } fun clickRemove() { - onRemoveButton().performClick() - composeTestRule.onNodeWithTag(TEST_TAG_DIALOG_CONFIRM_BUTTON).performClick() + onRemoveButton().performClickWithKeyboard() + composeTestRule.onNodeWithTag(TEST_TAG_DIALOG_CONFIRM_BUTTON).performClickWithKeyboard() } } diff --git a/paymentsheet/src/test/java/com/stripe/android/paymentsheet/SavedPaymentMethodsPage.kt b/paymentsheet/src/test/java/com/stripe/android/paymentsheet/SavedPaymentMethodsPage.kt index a0e1a95fa60..7e94c844211 100644 --- a/paymentsheet/src/test/java/com/stripe/android/paymentsheet/SavedPaymentMethodsPage.kt +++ b/paymentsheet/src/test/java/com/stripe/android/paymentsheet/SavedPaymentMethodsPage.kt @@ -7,9 +7,10 @@ import androidx.compose.ui.test.hasAnyAncestor import androidx.compose.ui.test.hasAnyDescendant import androidx.compose.ui.test.hasTestTag import androidx.compose.ui.test.hasText +import androidx.compose.ui.test.isFocusable import androidx.compose.ui.test.junit4.ComposeTestRule import androidx.compose.ui.test.onNodeWithTag -import androidx.compose.ui.test.performClick +import com.stripe.android.common.ui.performClickWithKeyboard import com.stripe.android.paymentsheet.ui.PAYMENT_SHEET_EDIT_BUTTON_TEST_TAG import com.stripe.android.paymentsheet.ui.SAVED_PAYMENT_OPTION_TAB_LAYOUT_TEST_TAG import com.stripe.android.paymentsheet.ui.SAVED_PAYMENT_OPTION_TEST_TAG @@ -55,7 +56,9 @@ class SavedPaymentMethodsPage(private val composeTestRule: ComposeTestRule) { } fun clickRemoveButton() { - composeTestRule.onNodeWithTag(UPDATE_PM_REMOVE_BUTTON_TEST_TAG).performClick() + composeTestRule.onNode( + hasAnyAncestor(hasTestTag(UPDATE_PM_REMOVE_BUTTON_TEST_TAG)).and(isFocusable()) + ).performClickWithKeyboard() } private fun savedPaymentMethodMatcher(last4: String): SemanticsMatcher { diff --git a/paymentsheet/src/test/java/com/stripe/android/paymentsheet/paymentdatacollection/polling/PollingActivityTest.kt b/paymentsheet/src/test/java/com/stripe/android/paymentsheet/paymentdatacollection/polling/PollingActivityTest.kt index 6465a7797a4..d6210985c20 100644 --- a/paymentsheet/src/test/java/com/stripe/android/paymentsheet/paymentdatacollection/polling/PollingActivityTest.kt +++ b/paymentsheet/src/test/java/com/stripe/android/paymentsheet/paymentdatacollection/polling/PollingActivityTest.kt @@ -5,7 +5,6 @@ import androidx.compose.ui.test.assertIsDisplayed import androidx.compose.ui.test.junit4.createEmptyComposeRule import androidx.compose.ui.test.onNodeWithContentDescription import androidx.compose.ui.test.onNodeWithText -import androidx.compose.ui.test.performClick import androidx.lifecycle.Lifecycle import androidx.lifecycle.SavedStateHandle import androidx.test.core.app.ApplicationProvider @@ -14,6 +13,7 @@ import androidx.test.espresso.Espresso.pressBack import androidx.test.ext.junit.runners.AndroidJUnit4 import com.google.common.truth.Truth.assertThat import com.stripe.android.StripeIntentResult +import com.stripe.android.common.ui.performClickWithKeyboard import com.stripe.android.model.StripeIntent import com.stripe.android.payments.PaymentFlowResult import com.stripe.android.paymentsheet.R @@ -70,7 +70,7 @@ internal class PollingActivityTest { scenario.onActivity { composeTestRule .onNodeWithText("Cancel and pay another way") - .performClick() + .performClickWithKeyboard() waitForActivityFinish() @@ -93,7 +93,7 @@ internal class PollingActivityTest { composeTestRule .onNodeWithContentDescription("Back") - .performClick() + .performClickWithKeyboard() waitForActivityFinish() diff --git a/paymentsheet/src/test/java/com/stripe/android/paymentsheet/ui/SepaMandateActivityTest.kt b/paymentsheet/src/test/java/com/stripe/android/paymentsheet/ui/SepaMandateActivityTest.kt index 1113d5d35ec..477d9109803 100644 --- a/paymentsheet/src/test/java/com/stripe/android/paymentsheet/ui/SepaMandateActivityTest.kt +++ b/paymentsheet/src/test/java/com/stripe/android/paymentsheet/ui/SepaMandateActivityTest.kt @@ -5,12 +5,12 @@ import android.os.Build import androidx.compose.ui.test.assertIsDisplayed import androidx.compose.ui.test.hasTestTag import androidx.compose.ui.test.junit4.createEmptyComposeRule -import androidx.compose.ui.test.performClick import androidx.lifecycle.Lifecycle import androidx.test.core.app.ActivityScenario import androidx.test.core.app.ApplicationProvider import androidx.test.espresso.Espresso import com.google.common.truth.Truth.assertThat +import com.stripe.android.common.ui.performClickWithKeyboard import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith @@ -58,7 +58,7 @@ internal class SepaMandateActivityTest { val intent = sepaMandateContract.createIntent(context, args) val scenario = ActivityScenario.launchActivityForResult(intent) composeRule.onNode(hasTestTag("SEPA_MANDATE_CONTINUE_BUTTON")).assertIsDisplayed() - composeRule.onNode(hasTestTag("SEPA_MANDATE_CONTINUE_BUTTON")).performClick() + composeRule.onNode(hasTestTag("SEPA_MANDATE_CONTINUE_BUTTON")).performClickWithKeyboard() val result = sepaMandateContract.parseResult( resultCode = scenario.result.resultCode, intent = scenario.result.resultData,