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

Fix(Cypress): Fixing 3DS payment failure in headless mode (#4807)

Gnanasundari24b335867eb92b
diff --git a/cypress-tests/cypress.config.js b/cypress-tests/cypress.config.js
index 2ce0169cf8..7def1f1b9f 100644
--- a/cypress-tests/cypress.config.js
+++ b/cypress-tests/cypress.config.js
@@ -19,5 +19,7 @@ module.exports = {
},
experimentalRunAllSpecs: true
},
- chromeWebSecurity: false
+ chromeWebSecurity: false,
+ defaultCommandTimeout: 10000,
+ pageLoadTimeout: 20000
};
\ No newline at end of file
diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js
index dfdd0df21d..028e48a41d 100644
--- a/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js
+++ b/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js
@@ -17,12 +17,13 @@ describe("Card - Refund flow test", () => {
before("seed global state", () => {
cy.task('getGlobalState').then((state) => {
- globalState = new State(state);
- console.log("seeding globalState -> " + JSON.stringify(globalState));
+ globalState = new State(state);
+ console.log("seeding globalState -> " + JSON.stringify(globalState));
})
- })
-
- after("flush global state", () => {
+
+ })
+
+ afterEach("flush global state", () => {
console.log("flushing globalState -> " + JSON.stringify(globalState));
cy.task('setGlobalState', globalState.data);
})
@@ -528,6 +529,20 @@ describe("Card - Refund flow test", () => {
this.skip();
}
});
+
+ before("seed global state", () => {
+
+ cy.task('getGlobalState').then((state) => {
+ globalState = new State(state);
+ console.log("seeding globalState -> " + JSON.stringify(globalState));
+ })
+
+ })
+
+ afterEach("flush global state", () => {
+ console.log("flushing globalState -> " + JSON.stringify(globalState));
+ cy.task('setGlobalState', globalState.data);
+ })
it("create-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"];
@@ -535,18 +550,16 @@ describe("Card - Refund flow test", () => {
let res_data = data["Response"];
cy.createPaymentIntentTest(createPaymentBody, req_data, res_data, "three_ds", "automatic", globalState);
if(should_continue) should_continue = utils.should_continue_further(res_data);
-
- });
-
- it("payment_methods-call-test", () => {
+ });
+
+ it("payment_methods-call-test", () => {
cy.paymentMethodsCallTest(globalState);
- });
-
- it("Confirm 3DS", () => {
+ });
+
+ it("Confirm 3DS", () => {
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DSAutoCapture"];
let req_data = data["Request"];
let res_data = data["Response"];
- console.log("det -> " + data.card);
cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState);
if(should_continue) should_continue = utils.should_continue_further(res_data);
});
diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00015-ThreeDSManualCapture.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00015-ThreeDSManualCapture.cy.js
index fa6de0092d..4c3d2a1cd0 100644
--- a/cypress-tests/cypress/e2e/ConnectorTest/00015-ThreeDSManualCapture.cy.js
+++ b/cypress-tests/cypress/e2e/ConnectorTest/00015-ThreeDSManualCapture.cy.js
@@ -10,16 +10,19 @@ let globalState;
describe("Card - ThreeDS Manual payment flow test", () => {
+
before("seed global state", () => {
- cy.task('getGlobalState').then((state) => {
- globalState = new State(state);
- console.log("seeding globalState -> " + JSON.stringify(globalState));
- })
+
+ cy.task('getGlobalState').then((state) => {
+ globalState = new State(state);
+ console.log("seeding globalState -> " + JSON.stringify(globalState));
+ })
+
})
- after("flush global state", () => {
- console.log("flushing globalState -> " + JSON.stringify(globalState));
- cy.task('setGlobalState', globalState.data);
+ afterEach("flush global state", () => {
+ console.log("flushing globalState -> " + JSON.stringify(globalState));
+ cy.task('setGlobalState', globalState.data);
})
context("Card - ThreeDS Manual Full Capture payment flow test", () => {
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index b28619d788..e78802e366 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -698,6 +698,7 @@ Cypress.Commands.add("revokeMandateCallTest", (globalState) => {
});
});
+
Cypress.Commands.add("handleRedirection", (globalState, expected_redirection) => {
let connectorId = globalState.get("connectorId");
let expected_url = new URL(expected_redirection);
@@ -713,7 +714,7 @@ Cypress.Commands.add("handleRedirection", (globalState, expected_redirection) =>
})
}
else if (globalState.get("connectorId") === "cybersource" || globalState.get("connectorId") === "bankofamerica") {
- cy.get('iframe')
+ cy.get('iframe', { timeout: 15000 })
.its('0.contentDocument.body')
.within((body) => {
cy.get('input[type="text"]').click().type("1234");
@@ -734,8 +735,9 @@ Cypress.Commands.add("handleRedirection", (globalState, expected_redirection) =>
})
})
}
+
else if (globalState.get("connectorId") === "stripe") {
- cy.get('iframe')
+ cy.get('iframe', { timeout: 30000 })
.its('0.contentDocument.body')
.within((body) => {
cy.get('iframe')
@@ -768,7 +770,6 @@ Cypress.Commands.add("handleRedirection", (globalState, expected_redirection) =>
cy.window().its('location.origin').should('eq', expected_url);
})
}
-
});
Cypress.Commands.add("listCustomerPMCallTest", (globalState) => {