Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
23 changes: 23 additions & 0 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ stages:
- test: { }
- run-instrumentation-tests: { }
- run-paymentsheet-instrumentation-tests: { }
- run-paymentsheet-instrumentation-tests-with-google-account: { }
- run-example-instrumentation-tests: { }
- run-financial-connections-instrumentation-tests: { }
- run-connections-e2e-payments-tests-on-push: { }
Expand Down Expand Up @@ -273,6 +274,28 @@ workflows:
bitrise.io:
stack: linux-docker-android-22.04
machine_type_id: g2.linux.x-large
run-paymentsheet-instrumentation-tests-with-google-account:
before_run:
- prepare_all
after_run:
- conclude_all
steps:
- android-build-for-ui-testing@0:
inputs:
- module: paymentsheet
- variant: debug
- arguments: ":paymentsheet-example:assembleDebug"
- virtual-device-testing-for-android@1:
inputs:
- app_path: $BITRISE_TEST_APK_PATH
- auto_google_login: true
- inst_test_targets: class com.stripe.android.paymentsheet.PaymentSheetAnalyticsTest
- test_type: instrumentation
- test_devices: MediumPhone.arm,34,en_US,portrait
meta:
bitrise.io:
stack: linux-docker-android-22.04
machine_type_id: g2.linux.x-large
run-example-instrumentation-tests:
before_run:
- start_emulator
Expand Down
18 changes: 17 additions & 1 deletion paymentsheet/build.gradle
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An alternative is to update the config in build-configuration/android-library.gradle instead

Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,23 @@ dependencies {

android {
defaultConfig {
testApplicationId "com.stripe.android.paymentsheet.test"
testApplicationId "com.stripe.android.paymentsheet.example"
}

signingConfigs {
config {
keyAlias 'example'
keyPassword 'Stripe12345'
// Generated with: `echo y | keytool -genkeypair -dname "cn=Stripe Developer, ou=Stripe, o=Stripe, c=US" -alias example -keypass Stripe12345 -keystore stripe-example.keystore -storepass Stripe12345 -keyalg RSA -keysize 2048 -validity 20000`
storeFile rootProject.file('stripe-example.keystore')
storePassword 'Stripe12345'
}
}

buildTypes {
debug {
signingConfig signingConfigs.config
}
}

buildFeatures {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ internal class EmbeddedPaymentElementAnalyticsTest {
validateAnalyticsRequest(eventName = "mc_embedded_sheet_newpm_show")
validateAnalyticsRequest(eventName = "mc_carousel_payment_method_tapped")
validateAnalyticsRequest(eventName = "mc_form_shown")
// cardscan is not available in test mode
validateAnalyticsRequest(eventName = "mc_cardscan_api_check_failed")
validateAnalyticsRequest(eventName = "mc_cardscan_api_check_succeeded")
validateAnalyticsRequest(
eventName = "mc_initial_displayed_payment_methods",
query("hidden_payment_methods", ""),
Expand Down Expand Up @@ -192,8 +191,7 @@ internal class EmbeddedPaymentElementAnalyticsTest {
validateAnalyticsRequest(eventName = "mc_embedded_sheet_newpm_show")
validateAnalyticsRequest(eventName = "mc_carousel_payment_method_tapped")
validateAnalyticsRequest(eventName = "mc_form_shown")
// cardscan is not available in test mode
validateAnalyticsRequest(eventName = "mc_cardscan_api_check_failed")
validateAnalyticsRequest(eventName = "mc_cardscan_api_check_succeeded")
validateAnalyticsRequest(eventName = "mc_initial_displayed_payment_methods")

validateAnalyticsRequest(eventName = "stripe_android.card_metadata_pk_available")
Expand Down Expand Up @@ -234,7 +232,7 @@ internal class EmbeddedPaymentElementAnalyticsTest {
method("POST"),
path("/v1/payment_intents/pi_example/confirm"),
bodyPart("confirmation_token", "ctoken_example"),
bodyPart("return_url", urlEncode("stripesdk://payment_return_url/com.stripe.android.paymentsheet.test")),
bodyPart("return_url", urlEncode("stripesdk://payment_return_url/com.stripe.android.paymentsheet.example")),
) { response ->
response.testBodyFromFile("payment-intent-confirm.json")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ internal class PaymentSheetAnalyticsTest {
validateAnalyticsRequest(eventName = "mc_load_succeeded")
validateAnalyticsRequest(eventName = "mc_complete_sheet_newpm_show")
validateAnalyticsRequest(eventName = "mc_form_shown")
// cardscan is not available in test mode
validateAnalyticsRequest(eventName = "mc_cardscan_api_check_failed")
validateAnalyticsRequest(eventName = "mc_cardscan_api_check_succeeded")
validateAnalyticsRequest(
eventName = "mc_initial_displayed_payment_methods",
query("hidden_payment_methods", Uri.encode("cashapp,affirm,alipay")),
Expand Down Expand Up @@ -169,7 +168,7 @@ internal class PaymentSheetAnalyticsTest {
validateAnalyticsRequest(eventName = "mc_carousel_payment_method_tapped")
validateAnalyticsRequest(eventName = "mc_form_shown")
// cardscan is not available in test mode
validateAnalyticsRequest(eventName = "mc_cardscan_api_check_failed")
validateAnalyticsRequest(eventName = "mc_cardscan_api_check_succeeded")
validateAnalyticsRequest(eventName = "stripe_android.card_metadata_pk_available")
validateAnalyticsRequest(
eventName = "mc_initial_displayed_payment_methods",
Expand Down Expand Up @@ -255,8 +254,7 @@ internal class PaymentSheetAnalyticsTest {
validateAnalyticsRequest(eventName = "stripe_android.card_metadata_pk_available")
validateAnalyticsRequest(eventName = "mc_complete_sheet_newpm_show")
validateAnalyticsRequest(eventName = "mc_form_shown")
// cardscan is not available in test mode
validateAnalyticsRequest(eventName = "mc_cardscan_api_check_failed")
validateAnalyticsRequest(eventName = "mc_cardscan_api_check_succeeded")
validateAnalyticsRequest(eventName = "mc_initial_displayed_payment_methods")

testContext.presentPaymentSheet {
Expand Down Expand Up @@ -297,7 +295,7 @@ internal class PaymentSheetAnalyticsTest {
method("POST"),
path("/v1/payment_intents/pi_example/confirm"),
bodyPart("confirmation_token", "ctoken_example"),
bodyPart("return_url", urlEncode("stripesdk://payment_return_url/com.stripe.android.paymentsheet.test")),
bodyPart("return_url", urlEncode("stripesdk://payment_return_url/com.stripe.android.paymentsheet.example")),
) { response ->
response.testBodyFromFile("payment-intent-confirm.json")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,15 +446,15 @@ internal class DefaultFlowControllerTest {
val expectedArgs = PaymentOptionContract.Args(
state = PaymentSheetState.Full(
customer = PaymentSheetFixtures.EMPTY_CUSTOMER_STATE,
config = PaymentSheet.Configuration("com.stripe.android.paymentsheet.test").asCommonConfiguration(),
config = PaymentSheet.Configuration("com.stripe.android.paymentsheet.example").asCommonConfiguration(),
paymentSelection = null,
validationError = null,
paymentMethodMetadata = PaymentMethodMetadataFactory.create(
hasCustomerConfiguration = true,
allowsDelayedPaymentMethods = false
),
),
configuration = PaymentSheet.Configuration("com.stripe.android.paymentsheet.test"),
configuration = PaymentSheet.Configuration("com.stripe.android.paymentsheet.example"),
enableLogging = ENABLE_LOGGING,
productUsage = PRODUCT_USAGE,
linkAccountInfo = LinkAccountUpdate.Value(null),
Expand Down
Loading