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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
ci(cypress): Add Nuvei connector test in cypress (#8414)
Tushar Shuklaa6f4d7267f9d
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Nuvei.js b/cypress-tests/cypress/e2e/configs/Payment/Nuvei.jsnew file mode 100644index 0000000000..9bec98d6a5--- /dev/null+++ b/cypress-tests/cypress/e2e/configs/Payment/Nuvei.js@@ -0,0 +1,765 @@+import { customerAcceptance } from "./Commons";+import { getCurrency } from "./Modifiers";++const successfulNo3DSCardDetails = {+ card_number: "4111111111111111",+ card_exp_month: "08",+ card_exp_year: "30",+ card_holder_name: "joseph Doe",+ card_cvc: "999",+};+// Test card details based on Nuvei test cards (from Rust tests)+const successfulThreeDSCardDetails = {+ card_number: "4000027891380961",+ card_exp_month: "10",+ card_exp_year: "25",+ card_holder_name: "CL-BRW1",+ card_cvc: "123",+};+// Payment method data objects for responses+const payment_method_data_no3ds = {+ card: {+ last4: "1111",+ card_type: "CREDIT",+ card_network: "Visa",+ card_issuer: "JP Morgan",+ card_issuing_country: "INDIA",+ card_isin: "411111",+ card_extended_bin: null,+ card_exp_month: "08",+ card_exp_year: "30",+ card_holder_name: "joseph Doe",+ payment_checks: null,+ authentication_data: null,+ },+ billing: null,+};++const payment_method_data_3ds = {+ card: {+ last4: "0961",+ card_type: "CREDIT",+ card_network: "Visa",+ card_issuer: "RIVER VALLEY CREDIT UNION",+ card_issuing_country: "UNITEDSTATES",+ card_isin: "400002",+ card_extended_bin: null,+ card_exp_month: "10",+ card_exp_year: "25",+ card_holder_name: "CL-BRW1",+ payment_checks: null,+ authentication_data: null,+ },+ billing: null,+};++export const connectorDetails = {+ card_pm: {+ // Basic payment intent creation+ PaymentIntent: {+ Request: {+ currency: "USD",+ amount: 11500,+ customer_acceptance: null,+ setup_future_usage: "on_session",+ },+ Response: {+ status: 200,+ body: {+ status: "requires_payment_method",+ setup_future_usage: "on_session",+ amount: 11500,+ },+ },+ },+ // Payment intent with shipping cost+ PaymentIntentWithShippingCost: {+ Request: {+ currency: "USD",+ shipping_cost: 50,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_payment_method",+ shipping_cost: 50,+ amount: 11500,+ },+ },+ },+ // Payment confirmation with shipping cost+ PaymentConfirmWithShippingCost: {+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ customer_acceptance: null,+ setup_future_usage: "on_session",+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ shipping_cost: 50,+ amount_received: 11550,+ amount: 11500,+ net_amount: 11550,+ },+ },+ },+ // No 3DS automatic capture+ No3DSAutoCapture: {+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ amount: 11500,+ currency: "USD",+ customer_acceptance: null,+ setup_future_usage: "on_session",+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ payment_method: "card",+ attempt_count: 1,+ payment_method_data: payment_method_data_no3ds,+ },+ },+ },+ // No 3DS manual capture+ No3DSManualCapture: {+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ amount: 11500,+ currency: "USD",+ customer_acceptance: null,+ setup_future_usage: "on_session",+ },+ Response: {+ status: 200,+ body: {+ status: "requires_capture",+ payment_method: "card",+ attempt_count: 1,+ payment_method_data: payment_method_data_no3ds,+ },+ },+ },+ // 3DS automatic capture+ "3DSAutoCapture": {+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulThreeDSCardDetails,+ },+ amount: 11500,+ currency: "USD",+ customer_acceptance: null,+ setup_future_usage: "on_session",+ },+ Response: {+ status: 200,+ body: {+ status: "requires_customer_action",+ setup_future_usage: "on_session",+ payment_method_data: payment_method_data_3ds,+ },+ },+ },+ // 3DS manual capture+ "3DSManualCapture": {+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulThreeDSCardDetails,+ },+ amount: 11500,+ currency: "USD",+ customer_acceptance: null,+ setup_future_usage: "on_session",+ },+ Response: {+ status: 200,+ body: {+ status: "requires_customer_action",+ setup_future_usage: "on_session",+ payment_method_data: payment_method_data_3ds,+ },+ },+ },+ // Capture payment+ Capture: {+ Request: {+ amount_to_capture: 11500,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ amount: 11500,+ amount_capturable: 0,+ amount_received: 11500,+ },+ },+ },+ // Partial capture+ PartialCapture: {+ Request: {+ amount_to_capture: 5000,+ },+ Response: {+ status: 200,+ body: {+ status: "partially_captured",+ amount: 11500,+ amount_capturable: 0,+ amount_received: 5000,+ },+ },+ },+ // Void payment+ Void: {+ Request: {},+ Response: {+ status: 200,+ body: {+ status: "cancelled",+ },+ },+ },+ // Refund payment+ Refund: {+ Request: {+ amount: 11500,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },+ // Partial refund - Nuvei limitation: only supports single refund per sale+ // Note: Tests that attempt multiple partial refunds will fail after the first one+ // TRIGGER_SKIP is used to skip tests that would fail due to Nuvei's "only one refund per sale" limitation+ PartialRefund: {+ Configs: {+ TRIGGER_SKIP: true,+ },+ Request: {+ amount: 5000,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },+ // Manual payment refund+ manualPaymentRefund: {+ Request: {+ amount: 11500,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },+ // Manual payment partial refund - Nuvei limitation: only supports single refund per sale+ // Note: Tests that attempt multiple partial refunds will fail after the first one+ // TRIGGER_SKIP is used to skip tests that would fail due to Nuvei's "only one refund per sale" limitation+ manualPaymentPartialRefund: {+ Configs: {+ TRIGGER_SKIP: true,+ },+ Request: {+ amount: 5000,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },+ // Sync refund+ SyncRefund: {+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },++ ZeroAuthPaymentIntent: {+ Request: {+ amount: 0,+ setup_future_usage: "off_session",+ currency: "USD",+ },+ Response: {+ status: 200,+ body: {+ status: "requires_payment_method",+ setup_future_usage: "off_session",+ },+ },+ },+ ZeroAuthConfirmPayment: {+ Configs: {+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_type: "setup_mandate",+ payment_method: "card",+ payment_method_type: "credit",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ },+ Response: {+ status: 501,+ error: {+ type: "invalid_request",+ message: "Setup Mandate flow for Nuvei is not implemented",+ code: "IR_00",+ },+ },+ },+ // Save card scenarios+ SaveCardUseNo3DSAutoCapture: {+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ currency: "USD",+ setup_future_usage: "on_session",+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },+ SaveCardUseNo3DSManualCapture: {+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ currency: "USD",+ setup_future_usage: "on_session",+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_capture",+ },+ },+ },+ SaveCardUseNo3DSAutoCaptureOffSession: {+ Configs: {+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_method: "card",+ payment_method_type: "debit",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ setup_future_usage: "off_session",+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },+ SaveCardUse3DSAutoCaptureOffSession: {+ Configs: {+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_method: "card",+ payment_method_type: "debit",+ payment_method_data: {+ card: successfulThreeDSCardDetails,+ },+ setup_future_usage: "off_session",+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_customer_action",+ },+ },+ },+ SaveCardUseNo3DSManualCaptureOffSession: {+ Configs: {+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ setup_future_usage: "off_session",+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_capture",+ },+ },+ },+ SaveCardConfirmAutoCaptureOffSession: {+ Configs: {+ TRIGGER_SKIP: true,+ },+ Request: {+ setup_future_usage: "off_session",+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },+ SaveCardConfirmManualCaptureOffSession: {+ Configs: {+ TRIGGER_SKIP: true,+ },+ Request: {+ setup_future_usage: "off_session",+ },+ Response: {+ status: 200,+ body: {+ status: "requires_capture",+ },+ },+ },+ // Payment method ID mandate scenarios+ PaymentMethodIdMandateNo3DSAutoCapture: {+ Configs: {+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ currency: "USD",+ mandate_data: null,+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },+ PaymentMethodIdMandateNo3DSManualCapture: {+ Configs: {+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ currency: "USD",+ mandate_data: null,+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_capture",+ },+ },+ },+ PaymentMethodIdMandate3DSAutoCapture: {+ Configs: {+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulThreeDSCardDetails,+ },+ currency: "USD",+ mandate_data: null,+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },+ PaymentMethodIdMandate3DSManualCapture: {+ Configs: {+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulThreeDSCardDetails,+ },+ mandate_data: null,+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_capture",+ },+ },+ },+ },+ // Bank redirect payment methods+ bank_redirect_pm: {+ PaymentIntent: (paymentMethodType) => ({+ Request: {+ amount: 11500,+ currency: getCurrency(paymentMethodType),+ },+ Response: {+ status: 200,+ body: {+ status: "requires_payment_method",+ },+ },+ }),+ BlikPaymentIntent: {+ Request: {+ amount: 11500,+ currency: "PLN",+ },+ Response: {+ status: 200,+ body: {+ status: "requires_payment_method",+ },+ },+ },+ Blik: {+ Request: {+ payment_method: "bank_redirect",+ payment_method_type: "blik",+ payment_method_data: {+ bank_redirect: {+ blik: {},+ },+ },+ billing: {+ address: {+ line1: "1467",+ line2: "Harrison Street",+ line3: "Harrison Street",+ city: "Warsaw",+ state: "Mazovia",+ zip: "00-001",+ country: "PL",+ first_name: "John",+ last_name: "Doe",+ },+ phone: {+ number: "9123456789",+ country_code: "+48",+ },+ },+ },+ Response: {+ status: 400,+ body: {+ error: {+ type: "invalid_request",+ message:+ "No eligible connector was found for the current payment method configuration",+ code: "IR_39",+ },+ },+ },+ },+ Ideal: {+ Request: {+ payment_method: "bank_redirect",+ payment_method_type: "ideal",+ currency: "EUR", // iDEAL requires EUR currency+ payment_method_data: {+ bank_redirect: {+ ideal: {+ bank_name: "ing", // Maps to INGBNL2A in Nuvei+ },+ },+ },+ billing: {+ address: {+ line1: "1467",+ line2: "Harrison Street",+ line3: "Harrison Street",+ city: "Amsterdam",+ state: "North Holland",+ zip: "1012",+ country: "NL", // Netherlands required for iDEAL+ first_name: "John",+ last_name: "Doe",+ },+ phone: {+ number: "9123456789",+ country_code: "+31",+ },+ },+ },+ Response: {+ status: 200,+ body: {+ status: "requires_customer_action", // Bank redirect requires customer action+ error_code: null,+ error_message: null,+ },+ },+ },+ Giropay: {+ Request: {+ payment_method: "bank_redirect",+ payment_method_type: "giropay",+ currency: "EUR", // Giropay requires EUR currency+ payment_method_data: {+ bank_redirect: {+ giropay: {+ country: "DE", // Germany required for Giropay+ },+ },+ },+ billing: {+ address: {+ line1: "1467",+ line2: "Harrison Street",+ line3: "Harrison Street",+ city: "Berlin",+ state: "Berlin",+ zip: "10115",+ country: "DE", // Germany required for Giropay+ first_name: "John",+ last_name: "Doe",+ },+ phone: {+ number: "9123456789",+ country_code: "+49",+ },+ },+ },+ Response: {+ status: 200,+ body: {+ status: "requires_customer_action", // Bank redirect requires customer action+ error_code: null,+ error_message: null,+ },+ },+ },+ Sofort: {+ Request: {+ payment_method: "bank_redirect",+ payment_method_type: "sofort",+ currency: "EUR", // Sofort requires EUR currency+ payment_method_data: {+ bank_redirect: {+ sofort: {+ country: "DE", // Germany required for Sofort+ preferred_language: "en",+ },+ },+ },+ billing: {+ address: {+ line1: "1467",+ line2: "Harrison Street",+ line3: "Harrison Street",+ city: "Berlin",+ state: "Berlin",+ zip: "10115",+ country: "DE", // Germany required for Sofort+ first_name: "John",+ last_name: "Doe",+ },+ phone: {+ number: "9123456789",+ country_code: "+49",+ },+ },+ },+ Response: {+ status: 200,+ body: {+ status: "requires_customer_action", // Bank redirect requires customer action+ error_code: null,+ error_message: null,+ },+ },+ },+ Eps: {+ Request: {+ payment_method: "bank_redirect",+ payment_method_type: "eps",+ amount: 11500,+ currency: "EUR", // EPS requires EUR currency+ payment_method_data: {+ bank_redirect: {+ eps: {+ country: "AT", // Austria required for EPS+ },+ },+ },+ billing: {+ address: {+ line1: "1467",+ line2: "Harrison Street",+ line3: "Harrison Street",+ city: "Vienna",+ state: "Vienna",+ zip: "1010",+ country: "AT", // Austria required for EPS+ first_name: "John",+ last_name: "Doe",+ },+ phone: {+ number: "9123456789",+ country_code: "+43",+ },+ },+ },+ Response: {+ status: 200,+ body: {+ status: "requires_customer_action",+ },+ },+ },+ },+};diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.jsindex 2504258328..b986739119 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js@@ -38,6 +38,7 @@ import { connectorDetails as nexixpayConnectorDetails } from "./Nexixpay.js";import { connectorDetails as nmiConnectorDetails } from "./Nmi.js";import { connectorDetails as noonConnectorDetails } from "./Noon.js";import { connectorDetails as novalnetConnectorDetails } from "./Novalnet.js";+import { connectorDetails as nuveiConnectorDetails } from "./Nuvei.js";import { connectorDetails as payboxConnectorDetails } from "./Paybox.js";import { connectorDetails as payloadConnectorDetails } from "./Payload.js";import { connectorDetails as paypalConnectorDetails } from "./Paypal.js";@@ -93,6 +94,7 @@ const connectorDetails = {nmi: nmiConnectorDetails,noon: noonConnectorDetails,novalnet: novalnetConnectorDetails,+ nuvei: nuveiConnectorDetails,paybox: payboxConnectorDetails,payload: payloadConnectorDetails,paypal: paypalConnectorDetails,diff --git a/cypress-tests/cypress/support/redirectionHandler.js b/cypress-tests/cypress/support/redirectionHandler.jsindex 76f8afd3af..cd1670a931 100644--- a/cypress-tests/cypress/support/redirectionHandler.js+++ b/cypress-tests/cypress/support/redirectionHandler.js@@ -387,6 +387,167 @@ function bankRedirectRedirection(verifyUrl = false;break;+ case "nuvei":+ // Enhanced Nuvei bank redirect handling with timeout awareness+ cy.log(`Handling Nuvei ${paymentMethodType} bank redirect`);++ // Add timeout handling for Nuvei bank redirects+ cy.window().then((win) => {+ // Check if we're on a timeout or error page+ const pageText = win.document.body.innerText.toLowerCase();+ if (+ pageText.includes("timeout") ||+ pageText.includes("error") ||+ pageText.includes("not responding") ||+ pageText.includes("connection failed")+ ) {+ cy.log(+ `⚠ Nuvei ${paymentMethodType} timeout detected on redirect page`+ );+ verifyUrl = false; // Skip URL verification for timeout scenarios+ return;+ }+ });++ switch (paymentMethodType) {+ case "ideal":+ // Handle iDEAL bank selection and confirmation with timeout awareness+ cy.get("body", { timeout: 15000 }).then(($body) => {+ const bodyText = $body.text().toLowerCase();++ // Check for timeout indicators+ if (+ bodyText.includes("timeout") ||+ bodyText.includes("error")+ ) {+ cy.log(+ `Nuvei iDEAL timeout detected - skipping interaction`+ );+ verifyUrl = false;+ return;+ }++ // Look for bank selection dropdown or buttons+ if ($body.find('select[name="bank"]').length > 0) {+ cy.get('select[name="bank"]').select("INGBNL2A"); // ING Bank+ cy.get(+ 'button[type="submit"], input[type="submit"]'+ ).click();+ } else if (+ $body.find('button[data-bank="INGBNL2A"]').length > 0+ ) {+ cy.get('button[data-bank="INGBNL2A"]').click();+ } else {+ // Generic approach - look for ING or any bank button+ cy.contains("button, a", /ING|Bank/i)+ .first()+ .click();+ }+ });+ verifyUrl = true;+ break;++ case "giropay":+ // Handle Giropay flow with timeout awareness+ cy.get("body", { timeout: 15000 }).then(($body) => {+ const bodyText = $body.text().toLowerCase();++ if (+ bodyText.includes("timeout") ||+ bodyText.includes("error")+ ) {+ cy.log(+ `Nuvei Giropay timeout detected - skipping interaction`+ );+ verifyUrl = false;+ return;+ }++ if ($body.find('input[name="bank_code"]').length > 0) {+ cy.get('input[name="bank_code"]').type("12345678");+ cy.get(+ 'button[name="continue"], button[type="submit"]'+ ).click();+ } else {+ cy.contains(+ "button, input",+ /continue|submit|proceed/i+ ).click();+ }+ });+ verifyUrl = true;+ break;++ case "sofort":+ // Handle Sofort flow with timeout awareness+ cy.get("body", { timeout: 15000 }).then(($body) => {+ const bodyText = $body.text().toLowerCase();++ if (+ bodyText.includes("timeout") ||+ bodyText.includes("error")+ ) {+ cy.log(+ `Nuvei Sofort timeout detected - skipping interaction`+ );+ verifyUrl = false;+ return;+ }++ // Sofort typically requires bank selection and login simulation+ if ($body.find('select[name="bank"]').length > 0) {+ cy.get('select[name="bank"]').select(0); // Select first bank+ cy.get('button[type="submit"]').click();+ } else if ($body.find('input[name="login"]').length > 0) {+ // If login form is present+ cy.get('input[name="login"]').type("testuser");+ cy.get('input[name="password"]').type("testpass");+ cy.get('button[type="submit"]').click();+ } else {+ // Generic continue button+ cy.contains(+ "button, input",+ /continue|weiter|submit/i+ ).click();+ }+ });+ verifyUrl = true;+ break;++ case "eps":+ // Handle EPS flow with timeout awareness+ cy.get("body", { timeout: 15000 }).then(($body) => {+ const bodyText = $body.text().toLowerCase();++ if (+ bodyText.includes("timeout") ||+ bodyText.includes("error")+ ) {+ cy.log(`Nuvei EPS timeout detected - skipping interaction`);+ verifyUrl = false;+ return;+ }++ if ($body.find('select[name="bank"]').length > 0) {+ cy.get('select[name="bank"]').select(0); // Select first Austrian bank+ cy.get('button[type="submit"]').click();+ } else {+ cy.contains(+ "button, input",+ /continue|submit|weiter/i+ ).click();+ }+ });+ verifyUrl = true;+ break;++ default:+ throw new Error(+ `Unsupported Nuvei payment method type: ${paymentMethodType}`+ );+ }+ break;+case "nexinets":switch (paymentMethodType) {case "ideal":@@ -425,12 +586,6 @@ function bankRedirectRedirection(},{ paymentMethodType } // Pass options to handleFlow);-- // extract the verifyUrl decision from within the handleFlow callback- // since the callback runs asynchronously within cy.origin or directly,- // we need a way to signal back if verification is needed.- // we use a closure variable `verifyUrl` which is modified inside the callback.- // this relies on cypress command queue ensuring the callback completes before cy.then runs.}cy.then(() => {// The value of verifyUrl determined by the specific flow (Adyen iDEAL or handleFlow callback)@@ -776,7 +931,89 @@ function threeDsRedirection(redirectionUrl, expectedUrl, connectorId) {cy.get('input[id="submit"]').click();});break;+ case "nuvei":+ cy.wait(constants.WAIT_TIME); // Wait for the page to load++ // Check if we're on the Nuvei 3DS challenge page+ cy.get("body").then(($body) => {+ const bodyText = $body.text();++ if (+ bodyText.includes("ThreeDS ACS Emulator") ||+ bodyText.includes("Challenge Page")+ ) {+ // Look for success buttons (based on UI test patterns)+ cy.get("body").then(() => {+ // Try to find and click success buttons+ if ($body.find("#btn1").length > 0) {+ cy.get("#btn1").click();+ }++ if ($body.find("#btn5").length > 0) {+ cy.get("#btn5").click();+ }+ // If no specific buttons found, try generic success patterns+ if (+ $body.find("#btn1").length === 0 &&+ $body.find("#btn5").length === 0+ ) {+ // Look for any button with "success", "continue", or "submit" text+ cy.get(+ "button, input[type='button'], input[type='submit']"+ ).then(($buttons) => {+ $buttons.each((index, button) => {+ const buttonText = Cypress.$(button).text().toLowerCase();+ const buttonValue =+ Cypress.$(button).val()?.toLowerCase() || "";++ if (+ buttonText.includes("success") ||+ buttonText.includes("continue") ||+ buttonText.includes("submit") ||+ buttonValue.includes("success")+ ) {+ cy.wrap(button).click();+ return false; // Break the loop+ }+ });+ });+ }+ });+ } else if ($body.find("iframe").length > 0) {+ cy.log("Found iframe, attempting to interact with it");+ cy.get("iframe")+ .first()+ .its("0.contentDocument.body")+ .within(() => {+ // Look for 3DS challenge form elements+ cy.get("body").then(($iframeBody) => {+ const iframeText = $iframeBody.text();++ if (+ iframeText.includes("ThreeDS") ||+ iframeText.includes("Challenge")+ ) {+ // Try to find and interact with 3DS elements+ cy.get(+ "button, input[type='button'], input[type='submit']"+ ).then(($buttons) => {+ if ($buttons.length > 0) {+ cy.log("Clicking first available button in iframe");+ cy.wrap($buttons.first()).click();+ }+ });+ }+ });+ });+ } else {+ cy.log(+ "No specific 3DS elements found, waiting for automatic redirect"+ );+ cy.wait(constants.WAIT_TIME);+ }+ });+ break;case "stripe":cy.get("iframe", { timeout: constants.TIMEOUT }).its("0.contentDocument.body")