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

test(cypress): add bank redirect payment tests for GlobalPay (#12343)

HS-QUALIBOT6804b1a215a5
diff --git a/cypress-tests/cypress/e2e/spec/Payment/18-BankRedirect.cy.js b/cypress-tests/cypress/e2e/spec/Payment/18-BankRedirect.cy.js
index 940523e4cf..e998976746 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/18-BankRedirect.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/18-BankRedirect.cy.js
@@ -62,7 +62,7 @@ describe("Bank Redirect tests", () => {
});
context("EPS Create and Confirm flow test", () => {
- it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle Bank Redirect Redirection", () => {
+ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle Bank Redirect Redirection -> Retrieve Payment", () => {
let shouldContinue = true;
cy.step("Create Payment Intent", () => {
@@ -121,11 +121,22 @@ describe("Bank Redirect tests", () => {
expected_redirection
);
});
+
+ cy.step("Retrieve Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Retrieve Payment");
+ return;
+ }
+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_redirect_pm"
+ ]["Eps"];
+ cy.retrievePaymentCallTest({ globalState, data: confirmData });
+ });
});
});
context("Giropay Create and Confirm flow test", () => {
- it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle Bank Redirect Redirection", () => {
+ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle Bank Redirect Redirection -> Retrieve Payment", () => {
let shouldContinue = true;
cy.step("Create Payment Intent", () => {
@@ -184,11 +195,22 @@ describe("Bank Redirect tests", () => {
expected_redirection
);
});
+
+ cy.step("Retrieve Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Retrieve Payment");
+ return;
+ }
+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_redirect_pm"
+ ]["Giropay"];
+ cy.retrievePaymentCallTest({ globalState, data: confirmData });
+ });
});
});
context("iDEAL Create and Confirm flow test", () => {
- it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle Bank Redirect Redirection", () => {
+ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle Bank Redirect Redirection -> Retrieve Payment", () => {
let shouldContinue = true;
cy.step("Create Payment Intent", () => {
@@ -247,11 +269,22 @@ describe("Bank Redirect tests", () => {
expected_redirection
);
});
+
+ cy.step("Retrieve Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Retrieve Payment");
+ return;
+ }
+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_redirect_pm"
+ ]["Ideal"];
+ cy.retrievePaymentCallTest({ globalState, data: confirmData });
+ });
});
});
context("Sofort Create and Confirm flow test", () => {
- it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle Bank Redirect Redirection", () => {
+ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle Bank Redirect Redirection -> Retrieve Payment", () => {
let shouldContinue = true;
cy.step("Create Payment Intent", () => {
@@ -310,6 +343,17 @@ describe("Bank Redirect tests", () => {
expected_redirection
);
});
+
+ cy.step("Retrieve Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Retrieve Payment");
+ return;
+ }
+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[
+ "bank_redirect_pm"
+ ]["Sofort"];
+ cy.retrievePaymentCallTest({ globalState, data: confirmData });
+ });
});
});
diff --git a/cypress-tests/cypress/support/redirectionHandler.js b/cypress-tests/cypress/support/redirectionHandler.js
index 8ad8c148f0..7c54759eb7 100644
--- a/cypress-tests/cypress/support/redirectionHandler.js
+++ b/cypress-tests/cypress/support/redirectionHandler.js
@@ -1006,6 +1006,8 @@ function bankRedirectRedirection(
connectorId = normalizeConnectorForRedirect(connectorId);
let verifyUrl = false;
+ cy.on("uncaught:exception", () => false);
+
// Mifinity wallet redirect: visit the redirect URL and verify the redirection
// without waiting for a host change (mifinity redirects to an external wallet
// authentication page that doesn't trigger a secondary redirect)
@@ -1495,21 +1497,50 @@ function bankRedirectRedirection(
case "globalpay":
switch (paymentMethodType) {
case "ideal":
- case "eps":
- cy.get("body", { timeout: 15000 }).then(($body) => {
- const bodyText = $body.text().toLowerCase();
- if (
- bodyText.includes("timeout") ||
- bodyText.includes("error")
+ cy.get("body", { timeout: 20000 }).then(($body) => {
+ const bodyText = $body.text();
+ cy.task(
+ "cli_log",
+ `GlobalPay ${paymentMethodType} page text: ${bodyText.substring(0, 200)}`
+ );
+
+ if ($body.find('button[type="submit"]').length > 0) {
+ cy.get('button[type="submit"]').first().click();
+ } else if ($body.find('input[type="submit"]').length > 0) {
+ cy.get('input[type="submit"]').first().click();
+ } else if (
+ $body.find(
+ '[data-testid*="confirm"], [data-testid*="continue"]'
+ ).length > 0
) {
+ cy.get(
+ '[data-testid*="confirm"], [data-testid*="continue"]'
+ )
+ .first()
+ .click();
+ } else if ($body.find("a.btn, button.btn").length > 0) {
+ cy.get("a.btn, button.btn").first().click();
+ } else {
cy.log(
- `GlobalPay ${paymentMethodType} timeout detected - skipping interaction`
+ `No interactable elements found on GlobalPay ${paymentMethodType} page`
);
- verifyUrl = false;
- return;
}
+ });
+ verifyUrl = false;
+ break;
+ case "eps":
+ cy.on("uncaught:exception", () => false);
+ cy.get("body", { timeout: 20000 }).then(($body) => {
+ const bodyText = $body.text();
+ cy.task(
+ "cli_log",
+ `GlobalPay ${paymentMethodType} page text: ${bodyText.substring(0, 200)}`
+ );
+
if ($body.find('button[type="submit"]').length > 0) {
cy.get('button[type="submit"]').first().click();
+ } else if ($body.find('input[type="submit"]').length > 0) {
+ cy.get('input[type="submit"]').first().click();
} else if (
$body.find(
'[data-testid*="confirm"], [data-testid*="continue"]'
@@ -1520,6 +1551,12 @@ function bankRedirectRedirection(
)
.first()
.click();
+ } else if ($body.find("a.btn, button.btn").length > 0) {
+ cy.get("a.btn, button.btn").first().click();
+ } else {
+ cy.log(
+ `No interactable elements found on GlobalPay ${paymentMethodType} page`
+ );
}
});
verifyUrl = false;