From b002ba468854d5ebbc2f1faab0c9d6850b4002b2 Mon Sep 17 00:00:00 2001 From: Charles Cruzan Date: Thu, 28 Apr 2022 13:42:37 -0700 Subject: [PATCH 1/9] upgrade stripe-ios --- example/ios/Podfile.lock | 54 +++++++++---------- .../project.pbxproj | 4 +- stripe-react-native.podspec | 4 +- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 3f9d93e54..beaf2e089 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -287,27 +287,27 @@ PODS: - RNScreens (3.10.2): - React-Core - React-RCTImage - - Stripe (22.0.0): - - Stripe/Stripe3DS2 (= 22.0.0) - - StripeApplePay (= 22.0.0) - - StripeCore (= 22.0.0) - - StripeUICore (= 22.0.0) - - stripe-react-native (0.7.0): + - Stripe (22.2.0): + - Stripe/Stripe3DS2 (= 22.2.0) + - StripeApplePay (= 22.2.0) + - StripeCore (= 22.2.0) + - StripeUICore (= 22.2.0) + - stripe-react-native (0.8.0): - React-Core - - Stripe (~> 22.0.0) - - StripeConnections (~> 22.0.0) - - Stripe/Stripe3DS2 (22.0.0): - - StripeApplePay (= 22.0.0) - - StripeCore (= 22.0.0) - - StripeUICore (= 22.0.0) - - StripeApplePay (22.0.0): - - StripeCore (= 22.0.0) - - StripeConnections (22.0.0): - - StripeCore (= 22.0.0) - - StripeUICore (= 22.0.0) - - StripeCore (22.0.0) - - StripeUICore (22.0.0): - - StripeCore (= 22.0.0) + - Stripe (~> 22.2.0) + - StripeFinancialConnections (~> 22.2.0) + - Stripe/Stripe3DS2 (22.2.0): + - StripeApplePay (= 22.2.0) + - StripeCore (= 22.2.0) + - StripeUICore (= 22.2.0) + - StripeApplePay (22.2.0): + - StripeCore (= 22.2.0) + - StripeCore (22.2.0) + - StripeFinancialConnections (22.2.0): + - StripeCore (= 22.2.0) + - StripeUICore (= 22.2.0) + - StripeUICore (22.2.0): + - StripeCore (= 22.2.0) - Yoga (1.14.0) DEPENDENCIES: @@ -355,8 +355,8 @@ SPEC REPOS: - fmt - Stripe - StripeApplePay - - StripeConnections - StripeCore + - StripeFinancialConnections - StripeUICore EXTERNAL SOURCES: @@ -469,12 +469,12 @@ SPEC CHECKSUMS: RNCMaskedView: c298b644a10c0c142055b3ae24d83879ecb13ccd RNCPicker: cb57c823d5ce8d2d0b5dfb45ad97b737260dc59e RNScreens: d6da2b9e29cf523832c2542f47bf1287318b1868 - Stripe: ee32e594fa4dee4bdf2a8a3039f7fb07a21075dc - stripe-react-native: 165df7efcedb14f15b8e2ddff20cedd6e6c42fca - StripeApplePay: e09964f3e2c6b318e53a05c12f3cb7efc592484d - StripeConnections: d3068bf688679a51932abb94d956d8a73c213bd7 - StripeCore: 689b9605ccb78e507f59ddc5e677615e0af16583 - StripeUICore: f5fe5ad283e132b40077b5eb85b625ebf7de034a + Stripe: 33cb13d41868ad64a6eabda23c920c5ffa724fa6 + stripe-react-native: bff4d8028167e1cbf67cc870bc2075f2db7ed315 + StripeApplePay: 77bbdb76f77e5e387c393e1512d111ee4818e384 + StripeCore: 5703818b3a9949d8fce1a1b09e51fbe8953eb0ed + StripeFinancialConnections: 115d05b11a627e64d2402065b816e1aebae10951 + StripeUICore: e1829301ad5de8831bc269a8ce8f73c31c26ce42 Yoga: e7dc4e71caba6472ff48ad7d234389b91dadc280 PODFILE CHECKSUM: 72bfeab5bf84b6ab4999227a1d3e012ee6b3f46e diff --git a/example/ios/StripeSdkExample.xcodeproj/project.pbxproj b/example/ios/StripeSdkExample.xcodeproj/project.pbxproj index 559237a85..82294bf42 100644 --- a/example/ios/StripeSdkExample.xcodeproj/project.pbxproj +++ b/example/ios/StripeSdkExample.xcodeproj/project.pbxproj @@ -228,8 +228,8 @@ "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/Stripe/Stripe.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/Stripe/Stripe3DS2.bundle", - "${PODS_CONFIGURATION_BUILD_DIR}/StripeConnections/StripeConnections.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/StripeCore/StripeCore.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/StripeFinancialConnections/StripeFinancialConnections.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/StripeUICore/StripeUICore.bundle", ); name = "[CP] Copy Pods Resources"; @@ -237,8 +237,8 @@ "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Stripe.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Stripe3DS2.bundle", - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/StripeConnections.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/StripeCore.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/StripeFinancialConnections.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/StripeUICore.bundle", ); runOnlyForDeploymentPostprocessing = 0; diff --git a/stripe-react-native.podspec b/stripe-react-native.podspec index 729f9665c..4e588f61e 100644 --- a/stripe-react-native.podspec +++ b/stripe-react-native.podspec @@ -16,6 +16,6 @@ Pod::Spec.new do |s| s.source_files = 'ios/**/*.{h,m,mm,swift}' s.dependency 'React-Core' - s.dependency 'Stripe', '~> 22.0.0' - s.dependency 'StripeConnections', '~> 22.0.0' + s.dependency 'Stripe', '~> 22.2.0' + s.dependency 'StripeFinancialConnections', '~> 22.2.0' end From 6241a41d523fdc76c5d8393c1b016f07953bc638 Mon Sep 17 00:00:00 2001 From: Charles Cruzan Date: Thu, 28 Apr 2022 13:43:35 -0700 Subject: [PATCH 2/9] use a cardDetails prop for AddToWalletButton prop --- .../AddToWalletButtonManager.kt | 11 ++----- .../pushprovisioning/AddToWalletButtonView.kt | 16 ++++------ .../AddToWalletButtonManager.m | 5 +--- .../AddToWalletButtonView.swift | 26 ++++++++--------- src/components/AddToWalletButton.tsx | 29 ++++++++++++------- 5 files changed, 40 insertions(+), 47 deletions(-) diff --git a/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonManager.kt b/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonManager.kt index 7c6bb14bf..304468c8f 100644 --- a/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonManager.kt +++ b/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonManager.kt @@ -38,14 +38,9 @@ class AddToWalletButtonManager(applicationContext: ReactApplicationContext) : Si view.setSourceMap(source) } - @ReactProp(name = "cardDescription") - fun cardDescription(view: AddToWalletButtonView, cardDescription: String) { - view.setCardDescription(cardDescription) - } - - @ReactProp(name = "cardLastFour") - fun cardLastFour(view: AddToWalletButtonView, last4: String) { - view.setCardLastFour(last4) + @ReactProp(name = "cardDetails") + fun cardDetails(view: AddToWalletButtonView, cardDetails: ReadableMap) { + view.setCardDetails(cardDetails) } @ReactProp(name = "ephemeralKey") diff --git a/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonView.kt b/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonView.kt index c048a4475..b8bf5cb5f 100644 --- a/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonView.kt +++ b/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonView.kt @@ -22,8 +22,7 @@ import com.reactnativestripesdk.createError class AddToWalletButtonView(private val context: ThemedReactContext, private val requestManager: RequestManager) : AppCompatImageView(context) { - private var cardDescription: String? = null - private var cardLastFour: String? = null + private var cardDetails: ReadableMap? = null private var ephemeralKey: String? = null private var sourceMap: ReadableMap? = null private var token: ReadableMap? = null @@ -35,7 +34,8 @@ class AddToWalletButtonView(private val context: ThemedReactContext, private val override fun performClick(): Boolean { super.performClick() - cardDescription?.let { cardDescription -> + + cardDetails?.getString("description")?.let { cardDescription -> ephemeralKey?.let { ephemeralKey -> PushProvisioningProxy.invoke( context.reactApplicationContext, @@ -50,7 +50,7 @@ class AddToWalletButtonView(private val context: ThemedReactContext, private val } } ?: run { dispatchEvent( - createError("Failed", "Missing parameters. `cardDescription` must be supplied in the props to ") + createError("Failed", "Missing parameters. `cardDetails.cardDescription` must be supplied in the props to ") ) } return true @@ -125,12 +125,8 @@ class AddToWalletButtonView(private val context: ThemedReactContext, private val sourceMap = map } - fun setCardDescription(description: String) { - cardDescription = description - } - - fun setCardLastFour(last4: String) { - cardLastFour = last4 + fun setCardDetails(detailsMap: ReadableMap) { + cardDetails = detailsMap } fun setEphemeralKey(map: ReadableMap) { diff --git a/ios/pushprovisioning/AddToWalletButtonManager.m b/ios/pushprovisioning/AddToWalletButtonManager.m index c6cbf91c0..acb3fe1b5 100644 --- a/ios/pushprovisioning/AddToWalletButtonManager.m +++ b/ios/pushprovisioning/AddToWalletButtonManager.m @@ -12,10 +12,7 @@ @interface RCT_EXTERN_MODULE(AddToWalletButtonManager, RCTViewManager) RCT_EXPORT_VIEW_PROPERTY(testEnv, BOOL) RCT_EXPORT_VIEW_PROPERTY(iOSButtonStyle, NSString) -RCT_EXPORT_VIEW_PROPERTY(cardHolderName, NSString) -RCT_EXPORT_VIEW_PROPERTY(cardDescription, NSString) -RCT_EXPORT_VIEW_PROPERTY(cardLastFour, NSString) -RCT_EXPORT_VIEW_PROPERTY(cardBrand, NSString) +RCT_EXPORT_VIEW_PROPERTY(cardDetails, NSDictionary) RCT_EXPORT_VIEW_PROPERTY(ephemeralKey, NSDictionary) RCT_EXPORT_VIEW_PROPERTY(onCompleteAction, RCTDirectEventBlock) @end diff --git a/ios/pushprovisioning/AddToWalletButtonView.swift b/ios/pushprovisioning/AddToWalletButtonView.swift index 68671d146..1fb8470d4 100644 --- a/ios/pushprovisioning/AddToWalletButtonView.swift +++ b/ios/pushprovisioning/AddToWalletButtonView.swift @@ -15,10 +15,7 @@ class AddToWalletButtonView: UIView { @objc var testEnv: Bool = false @objc var iOSButtonStyle: NSString? - @objc var cardHolderName: NSString? - @objc var cardDescription: NSString? - @objc var cardLastFour: NSString? - @objc var cardBrand: NSString? + @objc var cardDetails: NSDictionary? @objc var ephemeralKey: NSDictionary? @objc var onCompleteAction: RCTDirectEventBlock? @@ -65,22 +62,22 @@ class AddToWalletButtonView: UIView { ) return } - - guard let cardHolderName = cardHolderName as String? else { + + guard let cardHolderName = cardDetails?["name"] as? String else { onCompleteAction!( Errors.createError( ErrorType.Failed, - "Missing parameters. `cardHolderName` must be supplied in the props to " + "Missing parameters. `cardDetails.name` must be supplied in the props to " ) as? [AnyHashable : Any] ) return } - + if (cardHolderName.isEmpty) { onCompleteAction!( Errors.createError( ErrorType.Failed, - "`cardHolderName` is required, but the passed string was empty" + "`cardDetails.name` is required, but the passed string was empty" ) as? [AnyHashable : Any] ) return @@ -88,17 +85,18 @@ class AddToWalletButtonView: UIView { let config = STPPushProvisioningContext.requestConfiguration( withName: cardHolderName, - description: cardDescription as String?, - last4: cardLastFour as String?, - brand: Mappers.mapToCardBrand(cardBrand as String?) + description: cardDetails?["description"] as? String, + last4: cardDetails?["lastFour"] as? String, + brand: Mappers.mapToCardBrand(cardDetails?["brand"] as? String), + primaryAccountIdentifier: cardDetails?["primaryAccountIdentifier"] as? String ) - + // We can use STPFakeAddPaymentPassViewController ONLY IN TEST MODE. If STPFakeAddPaymentPassViewController is // used with a live mode card, the flow will fail and show a 'Signing certificate was invalid' error. let controller = { return self.testEnv ? STPFakeAddPaymentPassViewController(requestConfiguration: config, delegate: self) : PKAddPaymentPassViewController(requestConfiguration: config, delegate: self) }() - + let vc = findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController()) vc.present(controller!, animated: true, completion: nil) } diff --git a/src/components/AddToWalletButton.tsx b/src/components/AddToWalletButton.tsx index 22895abd0..95dbb8dc2 100644 --- a/src/components/AddToWalletButton.tsx +++ b/src/components/AddToWalletButton.tsx @@ -29,14 +29,19 @@ export interface Props extends AccessibilityProps { testID?: string; /** Only set to `false` when shipping through TestFlight || App Store */ testEnv?: boolean; - /** Sets the card holder name (used only on iOS) */ - cardHolderName: string; - /** Last 4 digits of the card. Required on Android. */ - cardLastFour: string; - /** Sets the card holder name (used only on iOS) */ - cardDescription?: string; - /** Optional, only used on iOS */ - cardBrand?: Token.CardBrand; + /** Details of the Issued Card you'd like added to the device's wallet */ + cardDetails: { + /** The `primary_account_identifier` value from the issued card. */ + primaryAccountIdentifier: string; + /** The card holder name (used only on iOS) */ + name: string; + /** A user-facing description of the card. Required on Android.*/ + description: string; + /** Last 4 digits of the card, only used on iOS */ + lastFour?: string; + /** Optional, only used on iOS */ + brand?: Token.CardBrand; + }; // Optional, only for Android and only for cards that are in the "yellow path" (as defined by Google- https://developers.google.com/pay/issuers/apis/push-provisioning/android/wallet-operations#resolving_yellow_path). Obtain this value via the `isCardInWallet` method. token?: GooglePayCardToken | null; /** Used by stripe to securely obtain card info of the card being provisioned. */ @@ -54,9 +59,11 @@ export interface Props extends AccessibilityProps { * testEnv={true} * style={styles.myButtonStyle} * iOSButtonStyle="onLightBackground" - * cardHolderName="David Wallace" - * cardLastFour="4242" - * cardBrand="Visa" + * cardDetails={{ + * primaryAccountIdentifier: "V-123", + * name: "David Wallace", + * lastFour: "4242", + * }} * ephemeralKey={myEphemeralKey} // This object is retrieved from your server. See https://stripe.com/docs/issuing/cards/digital-wallets?platform=react-native#update-your-backend * onComplete={(error) => { * Alert.alert( From 9fc713206d41303d81cca8d1a1c4dd67fad0fb6a Mon Sep 17 00:00:00 2001 From: Charles Cruzan Date: Thu, 28 Apr 2022 13:49:46 -0700 Subject: [PATCH 3/9] [skip actions] update example app and changelog --- CHANGELOG.md | 10 ++++++++++ example/src/screens/ApplePayScreen.tsx | 10 +++++++--- example/src/screens/GooglePayScreen.tsx | 10 +++++++--- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d58edeb60..9b3153d49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # CHANGELOG +## Unreleased + +- [#913](https://github.com/stripe/stripe-react-native/pull/913) chore: Updated `stripe-ios` from 22.0.0 to 22.2.0. +- [#913](https://github.com/stripe/stripe-react-native/pull/913) BREAKING CHANGE: Changed props for the `AddToWalletButton` component. Instead of passing `cardHolderName`, `cardLastFour`, `cardDescription`, and `cardBrand` directly as props, you will instead pass a `cardDetails` prop, which is an object containing the following fields: + - `primaryAccountIdentifier`: The `wallet.primary_account_identifier` value from the issued card. + - `name`: The card holder name (previously `cardHolderName`). + - `description`: A user-facing description of the card (previously `cardDescription`). + - `lastFour`: Last 4 digits of the card, optional (previously `cardLastFour`). + - `brand`: The card brand, optional (previously `cardBrand`). + ## 0.8.0 - [#902](https://github.com/stripe/stripe-react-native/pull/902) fix: create custom babel plugin for package.json imports in src/ diff --git a/example/src/screens/ApplePayScreen.tsx b/example/src/screens/ApplePayScreen.tsx index 9bacd2230..152e6077e 100644 --- a/example/src/screens/ApplePayScreen.tsx +++ b/example/src/screens/ApplePayScreen.tsx @@ -187,9 +187,13 @@ export default function ApplePayScreen() { testEnv={true} style={styles.payButton} iOSButtonStyle="onLightBackground" - cardHolderName={cardDetails?.cardholder?.name} - cardDescription={'Added by Stripe'} - cardLastFour={cardDetails?.last4} + cardDetails={{ + name: cardDetails?.cardholder?.name, + primaryAccountIdentifier: + cardDetails?.wallet?.primary_account_identifier, + lastFour: cardDetails?.last4, + description: 'Added by Stripe', + }} ephemeralKey={ephemeralKey} onComplete={({ error }) => { Alert.alert( diff --git a/example/src/screens/GooglePayScreen.tsx b/example/src/screens/GooglePayScreen.tsx index b73daed23..3d9a0b048 100644 --- a/example/src/screens/GooglePayScreen.tsx +++ b/example/src/screens/GooglePayScreen.tsx @@ -183,9 +183,13 @@ export default function GooglePayScreen() { { From f6c5a1058e791fd5e9370d4a06d56ad8e36235af Mon Sep 17 00:00:00 2001 From: Charles Cruzan Date: Thu, 28 Apr 2022 13:51:47 -0700 Subject: [PATCH 4/9] trigger CI --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b3153d49..1e96ad181 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,13 +2,13 @@ ## Unreleased -- [#913](https://github.com/stripe/stripe-react-native/pull/913) chore: Updated `stripe-ios` from 22.0.0 to 22.2.0. -- [#913](https://github.com/stripe/stripe-react-native/pull/913) BREAKING CHANGE: Changed props for the `AddToWalletButton` component. Instead of passing `cardHolderName`, `cardLastFour`, `cardDescription`, and `cardBrand` directly as props, you will instead pass a `cardDetails` prop, which is an object containing the following fields: +- [#913](https://github.com/stripe/stripe-react-native/pull/913) BREAKING CHANGE: Changed props for the `` component. Instead of passing `cardHolderName`, `cardLastFour`, `cardDescription`, and `cardBrand` directly as props, you will instead pass a `cardDetails` prop, which is an object containing the following fields: - `primaryAccountIdentifier`: The `wallet.primary_account_identifier` value from the issued card. - `name`: The card holder name (previously `cardHolderName`). - `description`: A user-facing description of the card (previously `cardDescription`). - `lastFour`: Last 4 digits of the card, optional (previously `cardLastFour`). - `brand`: The card brand, optional (previously `cardBrand`). +- [#913](https://github.com/stripe/stripe-react-native/pull/913) chore: Updated `stripe-ios` from 22.0.0 to 22.2.0. ## 0.8.0 From ae8f988db169a5e5483765fb8dad05992da56a09 Mon Sep 17 00:00:00 2001 From: Charles Cruzan Date: Thu, 28 Apr 2022 14:13:09 -0700 Subject: [PATCH 5/9] make primaryAccountIdentifier nullable --- src/components/AddToWalletButton.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/AddToWalletButton.tsx b/src/components/AddToWalletButton.tsx index 95dbb8dc2..4b0affb9f 100644 --- a/src/components/AddToWalletButton.tsx +++ b/src/components/AddToWalletButton.tsx @@ -32,7 +32,7 @@ export interface Props extends AccessibilityProps { /** Details of the Issued Card you'd like added to the device's wallet */ cardDetails: { /** The `primary_account_identifier` value from the issued card. */ - primaryAccountIdentifier: string; + primaryAccountIdentifier: string | null; /** The card holder name (used only on iOS) */ name: string; /** A user-facing description of the card. Required on Android.*/ From b0fa45f78913c8473d73a6c4edb7c8b3bfb509dd Mon Sep 17 00:00:00 2001 From: Charles Cruzan Date: Thu, 28 Apr 2022 14:23:10 -0700 Subject: [PATCH 6/9] typo in example --- example/src/screens/ApplePayScreen.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/src/screens/ApplePayScreen.tsx b/example/src/screens/ApplePayScreen.tsx index 152e6077e..17a6a587e 100644 --- a/example/src/screens/ApplePayScreen.tsx +++ b/example/src/screens/ApplePayScreen.tsx @@ -190,7 +190,7 @@ export default function ApplePayScreen() { cardDetails={{ name: cardDetails?.cardholder?.name, primaryAccountIdentifier: - cardDetails?.wallet?.primary_account_identifier, + cardDetails?.wallets?.primary_account_identifier, lastFour: cardDetails?.last4, description: 'Added by Stripe', }} From 5ca56601112da0d700055b86471768395e062075 Mon Sep 17 00:00:00 2001 From: Charles Cruzan Date: Thu, 28 Apr 2022 15:09:15 -0700 Subject: [PATCH 7/9] fix ach payment tests --- e2e/payments.test.ts | 40 +++++++++++++++++++------- e2e/screenObject/BasicPaymentScreen.ts | 2 +- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/e2e/payments.test.ts b/e2e/payments.test.ts index 1f9a46103..059ecae80 100644 --- a/e2e/payments.test.ts +++ b/e2e/payments.test.ts @@ -232,19 +232,29 @@ describe('Common payment scenarios', () => { BasicPaymentScreen.authorizeACH(); driver.pause(3000); - expect(driver.getAlertText()).toContain('RequiresConfirmation'); - driver.dismissAlert(); + let alert = getElementByText('RequiresConfirmation'); + alert.waitForDisplayed({ + timeout: 20000, + }); + alert.dismissAlert(); clickButtonContainingText('Confirm'); driver.pause(3000); - expect(driver.getAlertText()).toContain('Awaiting verification'); - driver.dismissAlert(); + alert = getElementByText('Awaiting verification'); + alert.waitForDisplayed({ + timeout: 20000, + }); + alert.dismissAlert(); getElementByText('Verify microdeposit').click(); driver.pause(3000); - expect(driver.getAlertText()).toContain('Processing'); + alert = getElementByText('Processing'); + alert.waitForDisplayed({ + timeout: 20000, + }); + alert.dismissAlert(); }); it('ACH Setup', function () { @@ -259,18 +269,28 @@ describe('Common payment scenarios', () => { BasicPaymentScreen.authorizeACH(); driver.pause(3000); - expect(driver.getAlertText()).toContain('RequiresConfirmation'); - driver.dismissAlert(); + let alert = getElementByText('RequiresConfirmation'); + alert.waitForDisplayed({ + timeout: 20000, + }); + alert.dismissAlert(); clickButtonContainingText('Confirm'); driver.pause(3000); - expect(driver.getAlertText()).toContain('Awaiting verification'); - driver.dismissAlert(); + alert = getElementByText('Awaiting verification'); + alert.waitForDisplayed({ + timeout: 20000, + }); + alert.dismissAlert(); getElementByText('Verify microdeposit').click(); driver.pause(3000); - expect(driver.getAlertText()).toContain('Succeeded'); + alert = getElementByText('Succeeded'); + alert.waitForDisplayed({ + timeout: 20000, + }); + alert.dismissAlert(); }); }); diff --git a/e2e/screenObject/BasicPaymentScreen.ts b/e2e/screenObject/BasicPaymentScreen.ts index e606d759b..464ab645c 100644 --- a/e2e/screenObject/BasicPaymentScreen.ts +++ b/e2e/screenObject/BasicPaymentScreen.ts @@ -104,7 +104,6 @@ class BasicPaymentScreen { button = $(`button*=Done`); button.click(); - driver.pause(5000); break; } } catch (e) { @@ -114,6 +113,7 @@ class BasicPaymentScreen { } } driver.switchContext(getNativeContext()); + driver.pause(5000); } } From d0abacd1b84e2c000b6fed4d4cd5f4fc1329e05f Mon Sep 17 00:00:00 2001 From: Charles Cruzan Date: Fri, 29 Apr 2022 08:51:41 -0700 Subject: [PATCH 8/9] adjust timeouts --- e2e/payments.test.ts | 6 ++---- e2e/screenObject/BasicPaymentScreen.ts | 5 ++++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/e2e/payments.test.ts b/e2e/payments.test.ts index 059ecae80..8a0157dbc 100644 --- a/e2e/payments.test.ts +++ b/e2e/payments.test.ts @@ -221,7 +221,7 @@ describe('Common payment scenarios', () => { }); it('ACH Payment', function () { - this.retries(3); + this.retries(2); homeScreen.goTo('Bank Debits'); homeScreen.goTo('ACH payment'); @@ -230,7 +230,6 @@ describe('Common payment scenarios', () => { clickButtonContainingText('Collect bank account'); BasicPaymentScreen.authorizeACH(); - driver.pause(3000); let alert = getElementByText('RequiresConfirmation'); alert.waitForDisplayed({ @@ -258,7 +257,7 @@ describe('Common payment scenarios', () => { }); it('ACH Setup', function () { - this.retries(3); + this.retries(2); homeScreen.goTo('Bank Debits'); homeScreen.goTo('ACH setup'); @@ -267,7 +266,6 @@ describe('Common payment scenarios', () => { clickButtonContainingText('Collect bank account'); BasicPaymentScreen.authorizeACH(); - driver.pause(3000); let alert = getElementByText('RequiresConfirmation'); alert.waitForDisplayed({ diff --git a/e2e/screenObject/BasicPaymentScreen.ts b/e2e/screenObject/BasicPaymentScreen.ts index 464ab645c..fdfd50c0b 100644 --- a/e2e/screenObject/BasicPaymentScreen.ts +++ b/e2e/screenObject/BasicPaymentScreen.ts @@ -81,21 +81,24 @@ class BasicPaymentScreen { let button = $(`button*=Manually verify instead`); if (button.isDisplayed()) { button.click(); - driver.pause(5000); + driver.pause(2000); button = $(`//input[@name='confirmAccountNumber']`); button.click(); button.sendKeys(['000123456789\n']); + driver.pause(2000); button = $(`//input[@name='routingNumber']`); button.click(); button.click(); button.sendKeys(['110000000\n']); + driver.pause(2000); button = $(`//input[@name='accountNumber']`); button.click(); button.click(); button.sendKeys(['000123456789\n']); + driver.pause(2000); button = $(`button*=Continue`); button.click(); From 6f455a825f90290cf92dadd6468907b4920429a2 Mon Sep 17 00:00:00 2001 From: Charles Cruzan Date: Wed, 4 May 2022 11:15:31 -0400 Subject: [PATCH 9/9] typos in test --- e2e/payments.test.ts | 4 ++-- example/src/screens/ACHPaymentScreen.tsx | 6 +++--- example/src/screens/ACHSetupScreen.tsx | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/e2e/payments.test.ts b/e2e/payments.test.ts index 8a0157dbc..f584c1f13 100644 --- a/e2e/payments.test.ts +++ b/e2e/payments.test.ts @@ -231,7 +231,7 @@ describe('Common payment scenarios', () => { BasicPaymentScreen.authorizeACH(); - let alert = getElementByText('RequiresConfirmation'); + let alert = getElementByText('Requires Confirmation'); alert.waitForDisplayed({ timeout: 20000, }); @@ -267,7 +267,7 @@ describe('Common payment scenarios', () => { BasicPaymentScreen.authorizeACH(); - let alert = getElementByText('RequiresConfirmation'); + let alert = getElementByText('Requires Confirmation'); alert.waitForDisplayed({ timeout: 20000, }); diff --git a/example/src/screens/ACHPaymentScreen.tsx b/example/src/screens/ACHPaymentScreen.tsx index 7f3457465..5d37e5683 100644 --- a/example/src/screens/ACHPaymentScreen.tsx +++ b/example/src/screens/ACHPaymentScreen.tsx @@ -65,7 +65,7 @@ export default function ACHPaymentScreen() { ) { setAwaitingVerification(true); Alert.alert( - 'Awaiting verification:', + 'Awaiting verification', 'The payment must be verified. Please provide the verification input values below.' ); } else { @@ -116,7 +116,7 @@ export default function ACHPaymentScreen() { ) { setAwaitingVerification(true); Alert.alert( - 'Awaiting verification:', + 'Awaiting verification', 'The payment must be verified. Please provide the verification input values below.' ); } else { @@ -155,7 +155,7 @@ export default function ACHPaymentScreen() { } else if (paymentIntent) { if (paymentIntent.status === PaymentIntent.Status.RequiresConfirmation) { Alert.alert( - 'Payment status: RequiresConfirmation', + 'Requires Confirmation', "You may now press the first 'Confirm' button." ); } else { diff --git a/example/src/screens/ACHSetupScreen.tsx b/example/src/screens/ACHSetupScreen.tsx index c88f5520e..813e6ed81 100644 --- a/example/src/screens/ACHSetupScreen.tsx +++ b/example/src/screens/ACHSetupScreen.tsx @@ -60,7 +60,7 @@ export default function ACHSetupScreen() { ) { setAwaitingVerification(true); Alert.alert( - 'Awaiting verification:', + 'Awaiting verification', 'The setup must be verified. Please provide the verification input values below.' ); } else { @@ -108,7 +108,7 @@ export default function ACHSetupScreen() { ) { setAwaitingVerification(true); Alert.alert( - 'Awaiting verification:', + 'Awaiting verification', 'The setup must be verified. Please provide the verification input values below.' ); } else { @@ -147,7 +147,7 @@ export default function ACHSetupScreen() { } else if (setupIntent) { if (setupIntent.status === SetupIntent.Status.RequiresConfirmation) { Alert.alert( - 'Setup status: RequiresConfirmation', + 'Requires Confirmation', "You may now press the first 'Confirm' button." ); } else {