Skip to content
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

Bail to web-based Link when needed #4435

Draft
wants to merge 15 commits into
base: davidme/fix-concurrent-assertions
Choose a base branch
from
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
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class ExampleCheckoutViewController: UIViewController {
configuration.returnURL = "payments-example://stripe-redirect"
// Set allowsDelayedPaymentMethods to true if your business can handle payment methods that complete payment after a delay, like SEPA Debit and Sofort.
configuration.allowsDelayedPaymentMethods = true
configuration.paymentMethodLayout = .horizontal
self.paymentSheet = PaymentSheet(
paymentIntentClientSecret: paymentIntentClientSecret,
configuration: configuration)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class ExampleCustomCheckoutViewController: UIViewController {
configuration.customer = .init(
id: customerId, ephemeralKeySecret: customerEphemeralKeySecret)
configuration.returnURL = "payments-example://stripe-redirect"
configuration.paymentMethodLayout = .horizontal
// Set allowsDelayedPaymentMethods to true if your business can handle payment methods that complete payment after a delay, like SEPA Debit and Sofort.
configuration.allowsDelayedPaymentMethods = true
PaymentSheet.FlowController.create(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ class ExampleCustomDeferredCheckoutViewController: UIViewController {
configuration.returnURL = "payments-example://stripe-redirect"
// Set allowsDelayedPaymentMethods to true if your business can handle payment methods that complete payment after a delay, like SEPA Debit and Sofort.
configuration.allowsDelayedPaymentMethods = true
configuration.paymentMethodLayout = .horizontal
DispatchQueue.main.async {
PaymentSheet.FlowController.create(
intentConfiguration: self.intentConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ class MyCustomBackendModel: ObservableObject {
configuration.returnURL = "payments-example://stripe-redirect"
// Set allowsDelayedPaymentMethods to true if your business can handle payment methods that complete payment after a delay, like SEPA Debit and Sofort.
configuration.allowsDelayedPaymentMethods = true
configuration.paymentMethodLayout = .horizontal
PaymentSheet.FlowController.create(
paymentIntentClientSecret: paymentIntentClientSecret,
configuration: configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ class MyBackendModel: ObservableObject {
configuration.returnURL = "payments-example://stripe-redirect"
// Set allowsDelayedPaymentMethods to true if your business can handle payment methods that complete payment after a delay, like SEPA Debit and Sofort.
configuration.allowsDelayedPaymentMethods = true
configuration.paymentMethodLayout = .horizontal
DispatchQueue.main.async {
self.paymentSheet = PaymentSheet(
paymentIntentClientSecret: paymentIntentClientSecret,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ struct PaymentSheetTestPlaygroundSettings: Codable, Equatable {
static func defaultValues() -> PaymentSheetTestPlaygroundSettings {
return PaymentSheetTestPlaygroundSettings(
uiStyle: .paymentSheet,
layout: .horizontal,
layout: .automatic,
mode: .payment,
customerKeyType: .legacy,
integrationType: .normal,
Expand Down Expand Up @@ -542,7 +542,7 @@ struct PaymentSheetTestPlaygroundSettings: Codable, Equatable {
collectEmail: .automatic,
collectPhone: .automatic,
collectAddress: .automatic,
formSheetAction: .confirm,
formSheetAction: .continue,
embeddedViewDisplaysMandateText: .on,
cardBrandAcceptance: .all,
allowsSetAsDefaultPM: .off)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class PaymentSheetLocalizationScreenshotGenerator: XCTestCase {
func testAllStrings() {
var settings = PaymentSheetTestPlaygroundSettings.defaultValues()
settings.customerMode = .new
settings.layout = .horizontal
settings.applePayEnabled = .off
settings.currency = .eur
settings.mode = .payment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ class CustomerSheetUITest: XCTestCase {

presentCSAndAddSepaFrom(buttonLabel: "None")

app.staticTexts["•••• 3000"].waitForExistenceAndTap(timeout: timeout)
app.staticTexts["••••3000"].waitForExistenceAndTap(timeout: timeout)

let editButton = app.staticTexts["Edit"]
XCTAssertTrue(editButton.waitForExistence(timeout: timeout))
Expand All @@ -273,7 +273,7 @@ class CustomerSheetUITest: XCTestCase {
app.buttons["Reload"].tap()
XCTAssertTrue(app.staticTexts["None"].waitForExistenceAndTap(timeout: 5))
XCTAssertTrue(app.staticTexts["Manage your payment methods"].waitForExistence(timeout: 5))
XCTAssertFalse(app.staticTexts["•••• 3000"].waitForExistence(timeout: 5))
XCTAssertFalse(app.staticTexts["••••3000"].waitForExistence(timeout: 5))
}

func testPrevPM_AddPM_canceled() throws {
Expand Down Expand Up @@ -350,7 +350,7 @@ class CustomerSheetUITest: XCTestCase {
XCTAssertTrue(confirmButton.waitForExistence(timeout: timeout))
confirmButton.tap()

dismissAlertView(alertBody: "Success: •••• 6789, selected", alertTitle: "Complete", buttonToTap: "OK")
dismissAlertView(alertBody: "Success: ••••6789, selected", alertTitle: "Complete", buttonToTap: "OK")
}

func testCustomerSheet_addUSBankAccount_MicroDeposit() throws {
Expand Down Expand Up @@ -783,7 +783,7 @@ class CustomerSheetUITest: XCTestCase {
let confirmButton = app.buttons["Confirm"]
XCTAssertTrue(confirmButton.waitForExistence(timeout: timeout))
confirmButton.tap()
dismissAlertView(alertBody: "Success: •••• 3000, selected", alertTitle: "Complete", buttonToTap: "OK")
dismissAlertView(alertBody: "Success: ••••3000, selected", alertTitle: "Complete", buttonToTap: "OK")
}

func removeFirstPaymentMethodInList(alertBody: String = "Visa •••• 4242", alertTitle: String = "Remove card?") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ class EmbeddedUITests: PaymentSheetUITestCase {
settings.mode = .paymentWithSetup
settings.uiStyle = .embedded
settings.integrationType = .deferred_csc
settings.formSheetAction = .confirm
settings.customerKeyType = .legacy
settings.customerMode = .new
settings.merchantCountryCode = .FR
Expand Down Expand Up @@ -340,10 +341,10 @@ class EmbeddedUITests: PaymentSheetUITestCase {

loadPlayground(app, settings)
app.buttons["Present embedded payment element"].waitForExistenceAndTap()
ensureSPMSelection("•••• 6789", insteadOf: "•••• 4242")
ensureSPMSelection("••••6789", insteadOf: "•••• 4242")

let card4242Button = app.buttons["•••• 4242"]
let bank6789Button = app.buttons["•••• 6789"]
let bank6789Button = app.buttons["••••6789"]

// Switch from 6789 (Bank account) to 4242
app.buttons["View more"].waitForExistenceAndTap()
Expand Down Expand Up @@ -401,9 +402,9 @@ class EmbeddedUITests: PaymentSheetUITestCase {

loadPlayground(app, settings)
app.buttons["Present embedded payment element"].waitForExistenceAndTap()
ensureSPMSelection("•••• 6789", insteadOf: "•••• 4242")
ensureSPMSelection("••••6789", insteadOf: "•••• 4242")

let bank6789Button = app.buttons["•••• 6789"]
let bank6789Button = app.buttons["••••6789"]
let applePayButton = app.buttons["Apple Pay"]

// Ensure card bank acct. is selected, and apple pay is not.
Expand Down Expand Up @@ -491,7 +492,7 @@ class EmbeddedUITests: PaymentSheetUITestCase {

// Verify we show the bank account in the saved PM row
XCTAssertTrue(app.buttons["Edit"].waitForExistence(timeout: 10))
XCTAssertFalse(app.buttons["•••• 6789"].isSelected)
XCTAssertFalse(app.buttons["••••6789"].isSelected)
XCTAssertTrue(app.buttons["Cash App Pay"].isSelected)
XCTAssertTrue(app.staticTexts["Cash App Pay"].waitForExistence(timeout: 10))
}
Expand All @@ -508,10 +509,10 @@ class EmbeddedUITests: PaymentSheetUITestCase {
loadPlayground(app, settings)

app.buttons["Present embedded payment element"].waitForExistenceAndTap()
ensureSPMSelection("•••• 6789", insteadOf: "•••• 4242")
ensureSPMSelection("••••6789", insteadOf: "•••• 4242")

XCTAssertTrue(app.staticTexts["•••• 6789"].waitForExistence(timeout: 10))
XCTAssertTrue(app.buttons["•••• 6789"].isSelected)
XCTAssertTrue(app.staticTexts["••••6789"].waitForExistence(timeout: 10))
XCTAssertTrue(app.buttons["••••6789"].isSelected)
XCTAssertTrue(app.buttons["Checkout"].waitForExistenceAndTap())
XCTAssertTrue(app.staticTexts["Success!"].waitForExistence(timeout: 10))

Expand All @@ -528,6 +529,7 @@ class EmbeddedUITests: PaymentSheetUITestCase {
var settings = PaymentSheetTestPlaygroundSettings.defaultValues()
settings.mode = .paymentWithSetup
settings.uiStyle = .paymentSheet
settings.layout = .horizontal
settings.customerKeyType = .legacy
settings.formSheetAction = .continue
settings.customerMode = .new
Expand Down Expand Up @@ -639,7 +641,7 @@ class EmbeddedUITests: PaymentSheetUITestCase {
XCTAssertTrue(app.staticTexts["Add US bank account"].waitForExistence(timeout: 10))
app.buttons["Continue"].waitForExistenceAndTap()
XCTAssertTrue(app.staticTexts["Payment method"].waitForExistence(timeout: 10))
XCTAssertEqual(app.staticTexts["Payment method"].label, "•••• 6789")
XCTAssertEqual(app.staticTexts["Payment method"].label, "••••6789")
XCTAssertTrue(app.buttons["US bank account"].isSelected)
XCTAssertTrue(app.buttons["Checkout"].isEnabled)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class PaymentSheet_AddressTests: XCTestCase {

func testManualAddressEntry() throws {
var settings = PaymentSheetTestPlaygroundSettings.defaultValues()
settings.layout = .horizontal
settings.uiStyle = .flowController
settings.shippingInfo = .on

Expand Down Expand Up @@ -96,6 +97,7 @@ US

func testAddressWithDefaults() throws {
var settings = PaymentSheetTestPlaygroundSettings.defaultValues()
settings.layout = .horizontal
settings.shippingInfo = .onWithDefaults
settings.uiStyle = .flowController

Expand Down Expand Up @@ -132,6 +134,7 @@ US

func testAddressAutoComplete_UnitedStates() throws {
var settings = PaymentSheetTestPlaygroundSettings.defaultValues()
settings.layout = .horizontal
settings.uiStyle = .flowController
loadPlayground(
app,
Expand Down Expand Up @@ -187,6 +190,7 @@ US
/// This test ensures we don't show auto complete for an unsupported country
func testAddressAutoComplete_NewZeland() throws {
var settings = PaymentSheetTestPlaygroundSettings.defaultValues()
settings.layout = .horizontal
settings.uiStyle = .flowController
loadPlayground(
app,
Expand Down Expand Up @@ -251,6 +255,7 @@ NZ
func testPaymentSheetFlowControllerUpdatesShipping() {

var settings = PaymentSheetTestPlaygroundSettings.defaultValues()
settings.layout = .horizontal
settings.applePayEnabled = .off
settings.apmsEnabled = .off
settings.linkPassthroughMode = .passthrough
Expand Down Expand Up @@ -340,6 +345,7 @@ NZ
func testManualAddressEntry_phoneCountryDoesPersist() throws {

var settings = PaymentSheetTestPlaygroundSettings.defaultValues()
settings.layout = .horizontal
settings.uiStyle = .flowController
loadPlayground(
app,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class PaymentSheetBillingCollectionUICardTests: PaymentSheetBillingCollectionUIT
func testCard_AllFields_flowController_WithDefaults() throws {

var settings = PaymentSheetTestPlaygroundSettings.defaultValues()
settings.layout = .horizontal
settings.customerMode = .guest
settings.uiStyle = .flowController
settings.currency = .usd
Expand Down Expand Up @@ -111,6 +112,7 @@ class PaymentSheetBillingCollectionLPMUITests: PaymentSheetBillingCollectionUITe
func testLpm_Afterpay_AutomaticFields_WithDefaultAddress() throws {

var settings = PaymentSheetTestPlaygroundSettings.defaultValues()
settings.layout = .horizontal
settings.customerMode = .guest
settings.merchantCountryCode = .US
settings.currency = .usd
Expand Down Expand Up @@ -175,6 +177,7 @@ class PaymentSheetBillingCollectionLPMUITests: PaymentSheetBillingCollectionUITe

func testLpm_Afterpay_AllFields_WithDefaults() throws {
var settings = PaymentSheetTestPlaygroundSettings.defaultValues()
settings.layout = .horizontal
settings.customerMode = .guest
settings.currency = .usd
settings.merchantCountryCode = .US
Expand Down Expand Up @@ -230,6 +233,7 @@ class PaymentSheetBillingCollectionLPMUITests: PaymentSheetBillingCollectionUITe

func testLpm_Afterpay_MinimalFields_WithDefaults() throws {
var settings = PaymentSheetTestPlaygroundSettings.defaultValues()
settings.layout = .horizontal
settings.customerMode = .guest
settings.currency = .usd
settings.merchantCountryCode = .US
Expand Down
Loading
Loading