-
Notifications
You must be signed in to change notification settings - Fork 664
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add end-to-end tests for
Embedded
(#10114)
- Loading branch information
1 parent
2fc6c36
commit 222b4f6
Showing
6 changed files
with
157 additions
and
2 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
paymentsheet-example/src/androidTest/java/com/stripe/android/lpm/TestEmbedded.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.stripe.android.lpm | ||
|
||
import com.stripe.android.BasePlaygroundTest | ||
import com.stripe.android.model.PaymentMethod | ||
import com.stripe.android.paymentsheet.example.playground.settings.Country | ||
import com.stripe.android.paymentsheet.example.playground.settings.CountrySettingsDefinition | ||
import com.stripe.android.paymentsheet.example.playground.settings.Currency | ||
import com.stripe.android.paymentsheet.example.playground.settings.CurrencySettingsDefinition | ||
import com.stripe.android.paymentsheet.example.playground.settings.SupportedPaymentMethodsSettingsDefinition | ||
import com.stripe.android.test.core.TestParameters | ||
import org.junit.Test | ||
|
||
internal class TestEmbedded : BasePlaygroundTest() { | ||
@Test | ||
fun testCard() { | ||
testDriver.confirmEmbedded( | ||
testParameters = TestParameters.create( | ||
paymentMethodCode = "card", | ||
authorizationAction = null, | ||
executeInNightlyRun = true, | ||
).copy( | ||
saveForFutureUseCheckboxVisible = true, | ||
), | ||
populateCustomLpmFields = { | ||
populateCardDetails() | ||
}, | ||
) | ||
} | ||
|
||
@Test | ||
fun testCashAppPay() { | ||
testDriver.confirmEmbedded( | ||
testParameters = TestParameters.create( | ||
paymentMethodCode = "cashapp", | ||
executeInNightlyRun = true, | ||
) { settings -> | ||
settings[CountrySettingsDefinition] = Country.US | ||
settings[CurrencySettingsDefinition] = Currency.USD | ||
settings[SupportedPaymentMethodsSettingsDefinition] = listOf( | ||
PaymentMethod.Type.Card, | ||
PaymentMethod.Type.CashAppPay | ||
).joinToString(",") | ||
}, | ||
values = null, // We don't show the form for cash app. | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters