Skip to content

Commit

Permalink
All integration methods
Browse files Browse the repository at this point in the history
  • Loading branch information
davidme-stripe committed Jan 15, 2025
1 parent 0db16a9 commit f1127ec
Showing 1 changed file with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,25 @@ class IntegrationTesterUICardEntryTests: IntegrationTesterUITests {
}

class IntegrationTesterUICardTests: IntegrationTesterUITests {

func testStandardCustomCard3DS2() throws {
testOOBAuthentication(cardNumber: "4000000000003220")
}

let alwaysOobCard = "4000582600000094"
func testOOB3DS2() throws {
testOOBAuthentication(cardNumber: alwaysOobCard)
}

func testDeclinedCard() throws {
testAuthentication(cardNumber: "4000000000000002", expectedResult: "declined")
}

let alwaysOtpCard = "4000582600000045"
func testOtp3DS2() throws {
testOtpAuthentication(cardNumber: alwaysOtpCard)
}

let alwaysSingleSelectCard = "4000582600000102"
func testSingleSelect3DS2() throws {
testSingleSelectAuthentication(cardNumber: alwaysSingleSelectCard)
Expand Down Expand Up @@ -132,12 +132,12 @@ class IntegrationTesterUIPMTests: IntegrationTesterUITests {
func testASWebAuthUsingPaypal() throws {
testNoInputIntegrationMethod(.paypal, shouldConfirm: true)
}

// Exercise the app to app redirect flow, including Safari
func testAppToAppRedirectUsingAlipay() throws {
testAppToAppRedirect(.alipay)
}

// Test a standard payment method using SFSafariViewController
func testSFSafariViewControllerUsingBancontact() throws {
testNoInputIntegrationMethod(.bancontact, shouldConfirm: true)
Expand Down Expand Up @@ -278,7 +278,7 @@ class IntegrationTesterUITests: XCTestCase {
let postalField = app.textFields["ZIP"]
postalField.typeText("12345")
}

func testAuthentication(cardNumber: String, expectedResult: String = "Payment complete!", confirmationBehavior: ConfirmationBehavior = .none) {
print("Testing \(cardNumber)")
self.popToMainMenu()
Expand Down Expand Up @@ -309,7 +309,7 @@ class IntegrationTesterUITests: XCTestCase {
XCTAssertTrue(statusView.waitForExistence(timeout: 10.0))
XCTAssertNotNil(statusView.label.range(of: expectedResult))
}

func testOOBAuthentication(cardNumber: String) {
print("Testing \(cardNumber)")
self.popToMainMenu()
Expand All @@ -326,7 +326,7 @@ class IntegrationTesterUITests: XCTestCase {
let oobChallengeScreenPredicate = NSPredicate(format: "label CONTAINS[c] 'This is a test 3D Secure 2 authentication for a transaction, showing an out-of-band (OOB) flow. In live mode, customers may be asked to open their banking app installed on their phone to complete authentication.'")
let challengeText = app.staticTexts.matching(oobChallengeScreenPredicate).element
XCTAssertTrue(challengeText.waitForExistence(timeout: 10))

let completeAuth = app.scrollViews.otherElements.staticTexts["Complete Authentication"]
XCTAssertTrue(completeAuth.waitForExistence(timeout: 60.0))
completeAuth.tap()
Expand All @@ -335,7 +335,7 @@ class IntegrationTesterUITests: XCTestCase {
XCTAssertTrue(statusView.waitForExistence(timeout: 10.0))
XCTAssertNotNil(statusView.label.range(of: "Payment complete!"))
}

func testOtpAuthentication(cardNumber: String) {
print("Testing \(cardNumber)")
self.popToMainMenu()
Expand All @@ -357,7 +357,7 @@ class IntegrationTesterUITests: XCTestCase {
XCTAssertTrue(verificationOTPTextView.waitForExistence(timeout: 10.0))
verificationOTPTextView.tap()
verificationOTPTextView.typeText("424242")

let completeAuth = app.scrollViews.otherElements.staticTexts["Submit"]
XCTAssertTrue(completeAuth.waitForExistence(timeout: 60.0))
completeAuth.tap()
Expand All @@ -366,7 +366,7 @@ class IntegrationTesterUITests: XCTestCase {
XCTAssertTrue(statusView.waitForExistence(timeout: 10.0))
XCTAssertNotNil(statusView.label.range(of: "Payment complete!"))
}

func testSingleSelectAuthentication(cardNumber: String) {
print("Testing \(cardNumber)")
self.popToMainMenu()
Expand All @@ -383,7 +383,7 @@ class IntegrationTesterUITests: XCTestCase {
let challengeScreenPredicate = NSPredicate(format: "label CONTAINS[c] 'This is a test 3D Secure 2 authentication for a transaction, showing a sample single-select flow. In live mode, customers may be asked to select a phone number to receive a one-time password.'")
let challengeText = app.staticTexts.matching(challengeScreenPredicate).element
XCTAssertTrue(challengeText.waitForExistence(timeout: 10))

let completeAuth = app.scrollViews.otherElements.staticTexts["Submit"]
XCTAssertTrue(completeAuth.waitForExistence(timeout: 60.0))
completeAuth.tap()
Expand Down

0 comments on commit f1127ec

Please sign in to comment.