From 89415067e26618cbdd77d910ad46913d8676b9fe Mon Sep 17 00:00:00 2001 From: scannillo <35243507+scannillo@users.noreply.github.com> Date: Thu, 21 Nov 2024 09:59:59 -0600 Subject: [PATCH] Streamline 3DS UI Tests (#1466) --- .../ThreeDSecure_UITests_Extensions.swift | 22 +----- .../ThreeDSecure_V2_UITests.swift | 67 +------------------ 2 files changed, 2 insertions(+), 87 deletions(-) diff --git a/Demo/UI Tests/ThreeDSecure UI Tests/ThreeDSecure_UITests_Extensions.swift b/Demo/UI Tests/ThreeDSecure UI Tests/ThreeDSecure_UITests_Extensions.swift index e641822bf..27e454da7 100644 --- a/Demo/UI Tests/ThreeDSecure UI Tests/ThreeDSecure_UITests_Extensions.swift +++ b/Demo/UI Tests/ThreeDSecure UI Tests/ThreeDSecure_UITests_Extensions.swift @@ -22,14 +22,6 @@ internal extension XCUIApplication { return buttons["Tokenize and Verify New Card"] } - var webViewPasswordTextField: XCUIElement { - return webViews.element.otherElements.children(matching: .other).children(matching: .secureTextField).element - } - - var webViewSubmitButton: XCUIElement { - return webViews.element.otherElements.children(matching: .other).children(matching: .other).buttons["Submit"] - } - var cardinalSubmitButton: XCUIElement { return buttons["SUBMIT"] } @@ -37,23 +29,11 @@ internal extension XCUIApplication { var liabilityShiftedMessage: XCUIElement { return buttons["Liability shift possible and liability shifted"] } - - var authenticationFailedMessage: XCUIElement { - return buttons["Failed to authenticate, please try a different form of payment."] - } - + var liabilityCouldNotBeShiftedMessage: XCUIElement { return buttons["3D Secure authentication was attempted but liability shift is not possible"] } - var unexpectedErrorMessage: XCUIElement { - return buttons["An unexpected error occurred"] - } - - var internalErrorMessage: XCUIElement { - return buttons["Internal Error."] - } - func enterCardDetailsWith(cardNumber: String, expirationDate: String = UITestDateGenerator.sharedInstance.futureDate()) { cardNumberTextField.tap() cardNumberTextField.typeText(cardNumber) diff --git a/Demo/UI Tests/ThreeDSecure UI Tests/ThreeDSecure_V2_UITests.swift b/Demo/UI Tests/ThreeDSecure UI Tests/ThreeDSecure_V2_UITests.swift index 78a8eff2a..33fcc5205 100644 --- a/Demo/UI Tests/ThreeDSecure UI Tests/ThreeDSecure_V2_UITests.swift +++ b/Demo/UI Tests/ThreeDSecure UI Tests/ThreeDSecure_V2_UITests.swift @@ -16,15 +16,6 @@ class ThreeDSecure_V2_UITests: XCTestCase { app.launch() } - func testThreeDSecurePaymentFlowV2_frictionlessFlow_andTransacts() { - waitForElementToAppear(app.cardNumberTextField) - app.enterCardDetailsWith(cardNumber: "4000000000001000", expirationDate: expirationDate) - app.tokenizeButton.tap() - sleep(2) - - waitForElementToAppear(app.liabilityShiftedMessage) - } - func testThreeDSecurePaymentFlowV2_challengeFlow_andTransacts() { waitForElementToAppear(app.cardNumberTextField) app.enterCardDetailsWith(cardNumber: "4000000000001091", expirationDate: expirationDate) @@ -44,16 +35,7 @@ class ThreeDSecure_V2_UITests: XCTestCase { waitForElementToAppear(app.liabilityShiftedMessage) } - - func testThreeDSecurePaymentFlowV2_noChallenge_andFails() { - waitForElementToAppear(app.cardNumberTextField) - app.enterCardDetailsWith(cardNumber: "5200000000001013", expirationDate: expirationDate) - app.tokenizeButton.tap() - sleep(2) - - waitForElementToAppear(app.liabilityCouldNotBeShiftedMessage) - } - + func testThreeDSecurePaymentFlowV2_challengeFlow_andFails() { waitForElementToAppear(app.cardNumberTextField) app.enterCardDetailsWith(cardNumber: "4000000000001109", expirationDate: expirationDate) @@ -74,26 +56,6 @@ class ThreeDSecure_V2_UITests: XCTestCase { waitForElementToAppear(app.liabilityCouldNotBeShiftedMessage, timeout: 30) } - func testThreeDSecurePaymentFlowV2_acceptsPassword_failsToAuthenticateNonce_dueToCardinalError() { - waitForElementToAppear(app.cardNumberTextField) - app.enterCardDetailsWith(cardNumber: "4000000000001125") - app.tokenizeButton.tap() - sleep(2) - - waitForElementToAppear(app.staticTexts["Purchase Authentication"], timeout: .threeDSecureTimeout) - - let textField = app.textFields.element(boundBy: 0) - waitForElementToBeHittable(textField) - textField.forceTapElement() - sleep(2) - textField.typeText("1234") - - app.cardinalSubmitButton.forceTapElement() - sleep(2) - - waitForElementToAppear(app.internalErrorMessage, timeout: 30) - } - func testThreeDSecurePaymentFlowV2_returnsToApp_whenCancelTapped() { waitForElementToAppear(app.cardNumberTextField) app.enterCardDetailsWith(cardNumber: "4000000000001091") @@ -106,31 +68,4 @@ class ThreeDSecure_V2_UITests: XCTestCase { waitForElementToAppear(app.buttons["Canceled 🎲"]) } - - func testThreeDSecurePaymentFlowV2_bypassedAuthentication() { - waitForElementToAppear(app.cardNumberTextField) - app.enterCardDetailsWith(cardNumber: "4000000000001083") - app.tokenizeButton.tap() - sleep(2) - - waitForElementToAppear(app.liabilityCouldNotBeShiftedMessage) - } - - func testThreeDSecurePaymentFlowV2_lookupError() { - waitForElementToAppear(app.cardNumberTextField) - app.enterCardDetailsWith(cardNumber: "4000000000001034") - app.tokenizeButton.tap() - sleep(2) - - waitForElementToAppear(app.liabilityCouldNotBeShiftedMessage) - } - - func testThreeDSecurePaymentFlowV2_timeout() { - waitForElementToAppear(app.cardNumberTextField) - app.enterCardDetailsWith(cardNumber: "4000000000001075") - app.tokenizeButton.tap() - sleep(2) - - waitForElementToAppear(app.liabilityCouldNotBeShiftedMessage, timeout: 45) - } }