Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

ci(cypress): Fix the redirection flow and ideal test for trustpay (#11759)

Gnanasundari2426e22c887dc6
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Trustpay.js b/cypress-tests/cypress/e2e/configs/Payment/Trustpay.js
index f677d4826b..0c6a8efa70 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Trustpay.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Trustpay.js
@@ -443,6 +443,23 @@ export const connectorDetails = {
},
},
},
+ SaveCardUse3DSAutoCaptureOffSession: {
+ Request: {
+ payment_method: "card",
+ payment_method_type: "debit",
+ payment_method_data: {
+ card: successfulThreeDSTestCardDetails,
+ },
+ setup_future_usage: "off_session",
+ customer_acceptance: customerAcceptance,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ },
PaymentMethodIdMandateNo3DSAutoCapture: {
Configs: {
TRIGGER_SKIP: true,
diff --git a/cypress-tests/cypress/support/redirectionHandler.js b/cypress-tests/cypress/support/redirectionHandler.js
index e5ebc2e2d1..69657ab7b3 100644
--- a/cypress-tests/cypress/support/redirectionHandler.js
+++ b/cypress-tests/cypress/support/redirectionHandler.js
@@ -385,6 +385,40 @@ function bankRedirectRedirection(
);
}
);
+ verifyUrl = false;
+ } else if (connectorId === "trustpay" && paymentMethodType === "ideal") {
+ // TrustPay iDEAL: aapi.finby.eu JS auto-redirects to pay.ideal.nl with no user interaction.
+ // Cypress does not support nested cy.origin, so we handle origins sequentially.
+ // ref: https://github.com/cypress-io/cypress/issues/20718
+ const trustpayIdealOrigin2 = "https://pay.ideal.nl";
+
+ // aapi.finby.eu redirects automatically — just wait for pay.ideal.nl to load
+ cy.log(`Waiting for redirection to ${trustpayIdealOrigin2}`);
+ cy.location("origin", { timeout: CONSTANTS.TIMEOUT }).should(
+ "eq",
+ trustpayIdealOrigin2
+ );
+
+ cy.origin(
+ trustpayIdealOrigin2,
+ { args: { constants: CONSTANTS } },
+ ({ constants }) => {
+ cy.log("Executing on TrustPay iDEAL Origin (pay.ideal.nl)");
+ cy.wait(constants.TIMEOUT / 10); // 2 seconds for page load
+ cy.get("button[data-testid=payment-action-button]", {
+ timeout: constants.TIMEOUT,
+ })
+ .should("be.visible")
+ .click();
+ cy.wait(constants.TIMEOUT / 10); // 2 seconds for bank list to render
+ cy.get('button[id="bank-item-INGBNL2A"]', {
+ timeout: constants.TIMEOUT,
+ })
+ .should("be.visible")
+ .click();
+ }
+ );
+
verifyUrl = false;
} else {
handleFlow(
@@ -486,12 +520,6 @@ function bankRedirectRedirection(
);
cy.get("#selectionSubmit").click();
break;
- case "ideal":
- cy.contains("button", "Select your bank").click();
- cy.get(
- 'button[data-testid="bank-item"][id="bank-item-INGBNL2A"]'
- ).click();
- break;
case "giropay":
cy.get("._transactionId__header__iXVd_").should(
"contain.text",
@@ -1366,15 +1394,15 @@ function threeDsRedirection(redirectionUrl, expectedUrl, connectorId) {
break;
case "trustpay":
- cy.get('form[name="challengeForm"]', {
+ cy.get('form[name="simulationForm"]', {
timeout: constants.WAIT_TIME,
})
.should("exist")
.then(() => {
- cy.get("#outcomeSelect")
- .select("Approve")
- .should("have.value", "Y");
- cy.get('button[type="submit"]').click();
+ cy.get("#challengeResult")
+ .select("Successful")
+ .should("have.value", "Success");
+ cy.get('input[type="submit"]').click();
});
break;