Skip to content

Fix flake in default PMs integration tests #11399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.stripe.android.paymentsheet

import androidx.test.espresso.intent.Intents
import androidx.test.espresso.intent.rule.IntentsRule
import com.google.testing.junit.testparameterinjector.TestParameter
import com.google.testing.junit.testparameterinjector.TestParameterInjector
Expand All @@ -18,6 +19,8 @@ import com.stripe.android.paymentsheet.utils.runProductIntegrationTest
import com.stripe.android.testing.PaymentMethodFactory
import com.stripe.paymentelementtestpages.FormPage
import com.stripe.paymentelementtestpages.VerticalModePage
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
Expand Down Expand Up @@ -45,6 +48,16 @@ internal class DefaultPaymentMethodsConfirmationTest {
// Confirmation behavior between horizontal and vertical doesn't differ, so we're testing with vertical mode only.
private val layoutType: PaymentSheetLayoutType = PaymentSheetLayoutType.Vertical()

@Before
fun initIntents() {
Intents.init()
}

@After
fun releaseIntents() {
Intents.release()
}

@Test
fun setNewPMAsDefault_withSavedPaymentMethods_sendsSetAsDefaultParamInConfirmCall() = runProductIntegrationTest(
networkRule = networkRule,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.stripe.android.paymentsheet

import androidx.compose.ui.test.hasTestTag
import androidx.test.espresso.intent.Intents
import androidx.test.espresso.intent.rule.IntentsRule
import com.google.testing.junit.testparameterinjector.TestParameter
import com.google.testing.junit.testparameterinjector.TestParameterInjector
Expand All @@ -18,6 +19,8 @@ import com.stripe.android.paymentsheet.utils.TestRules
import com.stripe.android.paymentsheet.utils.assertCompleted
import com.stripe.android.paymentsheet.utils.runFlowControllerTest
import com.stripe.android.testing.PaymentMethodFactory
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
Expand All @@ -41,6 +44,16 @@ internal class DefaultPaymentMethodsFlowControllerConfirmationTest {
// Confirmation behavior between horizontal and vertical doesn't differ, so we're testing with vertical mode only.
private val layoutType: PaymentSheetLayoutType = PaymentSheetLayoutType.Vertical()

@Before
fun initIntents() {
Intents.init()
}

@After
fun releaseIntents() {
Intents.release()
}

@Test
fun relaunchesIntoFormPageWithSaveForFutureUseChecked() = relaunchIntoFormPage(
expectedSetAsDefault = false,
Expand Down
Loading