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
refactor(cypress): move memory cache tests out of payment for misc (#6992)
Pa1NarK4382fc650ae5
diff --git a/cypress-tests/README.md b/cypress-tests/README.mdindex 87681bb6ea..4bcb517d4d 100644--- a/cypress-tests/README.md+++ b/cypress-tests/README.md@@ -1,4 +1,4 @@-# Hyperswitch Cypress Testing Framework+# Hyperswitch Cypress Testing Framework <!-- omit in toc -->## Overview@@ -61,7 +61,7 @@ CYPRESS_CONNECTOR="connector_id" npm run cypress:ci## Getting Started-## Prerequisites+### Prerequisites- Node.js (18.x or above)- npm or yarn@@ -70,7 +70,7 @@ CYPRESS_CONNECTOR="connector_id" npm run cypress:ci> [!NOTE]> To learn about the hardware requirements and software dependencies for running Cypress, refer to the [official documentation](https://docs.cypress.io/app/get-started/install-cypress).-## Installation+### Installation1. Clone the repository and switch to the project directory:@@ -119,32 +119,33 @@ CYPRESS_CONNECTOR="connector_id" npm run cypress:ci> [!NOTE]> To learn about how `creds` file should be structured, refer to the [example.creds.json](#example-credsjson) section below.-## Running Tests+### Running TestsExecution of Cypress tests can be done in two modes: Development mode (Interactive) and CI mode (Headless). The tests can be executed against a single connector or multiple connectors in parallel. Time taken to execute the tests will vary based on the number of connectors and the number of tests. For a single connector, the tests will take approximately 07-12 minutes to execute (this also depends on the hardware configurations).For Development mode, the tests will run in the Cypress UI where execution of tests can be seen in real-time and provides a larger area for debugging based on the need. In CI mode (Headless), tests run in the terminal without UI interaction and generate reports automatically.-### Development Mode (Interactive)+#### Development Mode (Interactive)```shellnpm run cypress```-### CI Mode (Headless)+#### CI Mode (Headless)```shell# All testsnpm run cypress:ci# Specific test suites-npm run cypress:payments # Payment tests+npm run cypress:misc # Miscellaneous tests (e.g. health check, memory cache etc.)npm run cypress:payment-method-list # Payment method list tests+npm run cypress:payments # Payment testsnpm run cypress:payouts # Payout testsnpm run cypress:routing # Routing tests```-### Execute tests against multiple connectors or in parallel+#### Execute tests against multiple connectors or in parallel1. Set additional environment variables:@@ -178,18 +179,27 @@ The folder structure of this directory is as follows:```txt.-├── .prettierrc # prettier configs-├── README.md # this file+├── .prettierrc # prettier configs+├── README.md # this file├── cypress│ ├── e2e-│ │ ├── <Service>Test # Directory for test scenarios related to connectors.-│ │ │ ├── 00000-test_<0>.cy.js-│ │ │ ├── ...-│ │ │ └── 0000n-test_<n>.cy.js-│ │ └── <Service>Utils # Directory for utility functions related to connectors.-│ │ ├── connector_<1>.js-│ │ ├── ...-│ │ └── connector_<n>.js+│ │ ├── configs # Directory for utility functions related to connectors.+│ │ │ ├── PaymentMethodList+│ │ │ │ ├── connector_<1>.js+│ │ │ │ ├── ...+│ │ │ │ └── connector_<n>.js+│ │ │ ├── Payment+│ │ │ ├── Payout+│ │ │ └── Routing+│ │ └── spec # Directory for test scenarios related to connectors.+│ │ ├── Misc+│ │ │ ├── 00000-test_<0>.cy.js+│ │ │ ├── ...+│ │ │ └── 0000n-test_<n>.cy.js+│ │ ├── Payment+│ │ ├── PaymentMethodList+│ │ ├── Payout+│ │ └── Routing│ ├── fixtures # Directory for storing test data API request.│ │ ├── fixture_<1>.json│ │ ├── ...@@ -197,11 +207,14 @@ The folder structure of this directory is as follows:│ ├── support # Directory for Cypress support files.│ │ ├── commands.js # File containing custom Cypress commands and utilities.│ │ ├── e2e.js-│ │ └── redirectionHandler.js+│ │ └── redirectionHandler.js # Functions for handling redirections in tests│ └── utils-│ ├── RequestBodyUtils.js+│ ├── RequestBodyUtils.js # Utility Functions for handling request bodies│ ├── State.js-│ └── featureFlags.js+│ └── featureFlags.js # Functions for validating and controlling feature flags+├── screenshots+│ └── <connector-name> # Connector directory for storing screenshots of test failures+│ └── <test-name>.png├── cypress.config.js # Cypress configuration file.├── eslint.config.js # linter configuration file.└── package.json # Node.js package file.@@ -240,8 +253,8 @@ To add a new test, create a new test file in the `e2e` directory under respectiv```javascript// cypress/e2e/<Service>Test/NewFeature.cy.js-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";describe("New Feature", () => {let globalState;diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Adyen.js b/cypress-tests/cypress/e2e/configs/Payment/Adyen.jssimilarity index 99%rename from cypress-tests/cypress/e2e/PaymentUtils/Adyen.jsrename to cypress-tests/cypress/e2e/configs/Payment/Adyen.jsindex 95fa82f967..d5bdd190e9 100644--- a/cypress-tests/cypress/e2e/PaymentUtils/Adyen.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Adyen.js@@ -1,4 +1,4 @@-import { getCustomExchange } from "./Commons";+import { getCustomExchange } from "./Modifiers";const successfulNo3DSCardDetails = {card_number: "4111111111111111",diff --git a/cypress-tests/cypress/e2e/PaymentUtils/BankOfAmerica.js b/cypress-tests/cypress/e2e/configs/Payment/BankOfAmerica.jssimilarity index 100%rename from cypress-tests/cypress/e2e/PaymentUtils/BankOfAmerica.jsrename to cypress-tests/cypress/e2e/configs/Payment/BankOfAmerica.jsdiff --git a/cypress-tests/cypress/e2e/PaymentUtils/Bluesnap.js b/cypress-tests/cypress/e2e/configs/Payment/Bluesnap.jssimilarity index 100%rename from cypress-tests/cypress/e2e/PaymentUtils/Bluesnap.jsrename to cypress-tests/cypress/e2e/configs/Payment/Bluesnap.jsdiff --git a/cypress-tests/cypress/e2e/PaymentUtils/Checkout.js b/cypress-tests/cypress/e2e/configs/Payment/Checkout.jssimilarity index 100%rename from cypress-tests/cypress/e2e/PaymentUtils/Checkout.jsrename to cypress-tests/cypress/e2e/configs/Payment/Checkout.jsdiff --git a/cypress-tests/cypress/e2e/PaymentUtils/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.jssimilarity index 94%rename from cypress-tests/cypress/e2e/PaymentUtils/Commons.jsrename to cypress-tests/cypress/e2e/configs/Payment/Commons.jsindex 998c6b91f7..f021a0a98f 100644--- a/cypress-tests/cypress/e2e/PaymentUtils/Commons.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js@@ -1,45 +1,5 @@// This file is the default. To override, add to connector.js-import State from "../../utils/State";--const globalState = new State({- connectorId: Cypress.env("CONNECTOR"),- baseUrl: Cypress.env("BASEURL"),- adminApiKey: Cypress.env("ADMINAPIKEY"),- connectorAuthFilePath: Cypress.env("CONNECTOR_AUTH_FILE_PATH"),-});--const connectorName = normalize(globalState.get("connectorId"));--function normalize(input) {- const exceptions = {- bankofamerica: "Bank of America",- cybersource: "Cybersource",- paybox: "Paybox",- paypal: "Paypal",- wellsfargo: "Wellsfargo",- fiuu: "Fiuu",- noon: "Noon",- // Add more known exceptions here- };-- if (typeof input !== "string") {- const specName = Cypress.spec.name;-- if (specName.includes("-")) {- const parts = specName.split("-");-- if (parts.length > 1 && parts[1].includes(".")) {- return parts[1].split(".")[0];- }- }-- // Fallback- return `${specName}`;- }-- const lowerCaseInput = input.toLowerCase();- return exceptions[lowerCaseInput] || input;-}+import { getCustomExchange } from "./Modifiers";const successfulNo3DSCardDetails = {card_number: "4111111111111111",@@ -141,68 +101,6 @@ export const fullNameRequiredField = {};export const billingRequiredField = {};-/*-`getDefaultExchange` contains the default Request and Response to be considered if none provided.-`getCustomExchange` takes in 2 optional fields named as Request and Response.-with `getCustomExchange`, if 501 response is expected, there is no need to pass Response as it considers default values.-*/--// Const to get default PaymentExchange object-const getDefaultExchange = () => ({- Request: {},- Response: {- status: 501,- body: {- error: {- type: "invalid_request",- message: `Selected payment method through ${connectorName} is not implemented`,- code: "IR_00",- },- },- },-});--const getUnsupportedExchange = () => ({- Request: {- currency: "EUR",- },- Response: {- status: 400,- body: {- error: {- type: "invalid_request",- message: `Payment method type not supported`,- code: "IR_19",- },- },- },-});--// Const to get PaymentExchange with overridden properties-export const getCustomExchange = (overrides) => {- const defaultExchange = getDefaultExchange();-- return {- ...defaultExchange,- ...(overrides.Configs ? { Configs: overrides.Configs } : {}),- Request: {- ...defaultExchange.Request,- ...(overrides.Request || {}),- },- Response: {- ...defaultExchange.Response,- ...(overrides.Response || {}),- },- ...(overrides.ResponseCustom- ? { ResponseCustom: overrides.ResponseCustom }- : {}),- };-};--// Function to update the default status code-export const updateDefaultStatusCode = () => {- return getUnsupportedExchange().Response;-};export const payment_methods_enabled = [{diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Cybersource.js b/cypress-tests/cypress/e2e/configs/Payment/Cybersource.jssimilarity index 99%rename from cypress-tests/cypress/e2e/PaymentUtils/Cybersource.jsrename to cypress-tests/cypress/e2e/configs/Payment/Cybersource.jsindex f918fb2592..804f9aca0d 100644--- a/cypress-tests/cypress/e2e/PaymentUtils/Cybersource.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Cybersource.js@@ -1,7 +1,5 @@-import {- connectorDetails as commonConnectorDetails,- getCustomExchange,-} from "./Commons";+import { connectorDetails as commonConnectorDetails } from "./Commons";+import { getCustomExchange } from "./Modifiers";const successfulNo3DSCardDetails = {card_number: "4242424242424242",diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Datatrans.js b/cypress-tests/cypress/e2e/configs/Payment/Datatrans.jssimilarity index 100%rename from cypress-tests/cypress/e2e/PaymentUtils/Datatrans.jsrename to cypress-tests/cypress/e2e/configs/Payment/Datatrans.jsdiff --git a/cypress-tests/cypress/e2e/PaymentUtils/Deutschebank.js b/cypress-tests/cypress/e2e/configs/Payment/Deutschebank.jssimilarity index 100%rename from cypress-tests/cypress/e2e/PaymentUtils/Deutschebank.jsrename to cypress-tests/cypress/e2e/configs/Payment/Deutschebank.jsdiff --git a/cypress-tests/cypress/e2e/PaymentUtils/Elavon.js b/cypress-tests/cypress/e2e/configs/Payment/Elavon.jssimilarity index 100%rename from cypress-tests/cypress/e2e/PaymentUtils/Elavon.jsrename to cypress-tests/cypress/e2e/configs/Payment/Elavon.jsdiff --git a/cypress-tests/cypress/e2e/PaymentUtils/Fiservemea.js b/cypress-tests/cypress/e2e/configs/Payment/Fiservemea.jssimilarity index 100%rename from cypress-tests/cypress/e2e/PaymentUtils/Fiservemea.jsrename to cypress-tests/cypress/e2e/configs/Payment/Fiservemea.jsdiff --git a/cypress-tests/cypress/e2e/PaymentUtils/Fiuu.js b/cypress-tests/cypress/e2e/configs/Payment/Fiuu.jssimilarity index 100%rename from cypress-tests/cypress/e2e/PaymentUtils/Fiuu.jsrename to cypress-tests/cypress/e2e/configs/Payment/Fiuu.jsdiff --git a/cypress-tests/cypress/e2e/PaymentUtils/Iatapay.js b/cypress-tests/cypress/e2e/configs/Payment/Iatapay.jssimilarity index 100%rename from cypress-tests/cypress/e2e/PaymentUtils/Iatapay.jsrename to cypress-tests/cypress/e2e/configs/Payment/Iatapay.jsdiff --git a/cypress-tests/cypress/e2e/PaymentUtils/ItauBank.js b/cypress-tests/cypress/e2e/configs/Payment/ItauBank.jssimilarity index 100%rename from cypress-tests/cypress/e2e/PaymentUtils/ItauBank.jsrename to cypress-tests/cypress/e2e/configs/Payment/ItauBank.jsdiff --git a/cypress-tests/cypress/e2e/PaymentUtils/Jpmorgan.js b/cypress-tests/cypress/e2e/configs/Payment/Jpmorgan.jssimilarity index 100%rename from cypress-tests/cypress/e2e/PaymentUtils/Jpmorgan.jsrename to cypress-tests/cypress/e2e/configs/Payment/Jpmorgan.jsdiff --git a/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js b/cypress-tests/cypress/e2e/configs/Payment/Modifiers.jsnew file mode 100644index 0000000000..a2fa7642e7--- /dev/null+++ b/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js@@ -0,0 +1,104 @@+import State from "../../../utils/State";++const globalState = new State({+ connectorId: Cypress.env("CONNECTOR"),+ baseUrl: Cypress.env("BASEURL"),+ adminApiKey: Cypress.env("ADMINAPIKEY"),+ connectorAuthFilePath: Cypress.env("CONNECTOR_AUTH_FILE_PATH"),+});++const connectorName = normalize(globalState.get("connectorId"));++function normalize(input) {+ const exceptions = {+ bankofamerica: "Bank of America",+ cybersource: "Cybersource",+ paybox: "Paybox",+ paypal: "Paypal",+ wellsfargo: "Wellsfargo",+ fiuu: "Fiuu",+ noon: "Noon",+ // Add more known exceptions here+ };++ if (typeof input !== "string") {+ const specName = Cypress.spec.name;++ if (specName.includes("-")) {+ const parts = specName.split("-");++ if (parts.length > 1 && parts[1].includes(".")) {+ return parts[1].split(".")[0];+ }+ }++ // Fallback+ return `${specName}`;+ }++ const lowerCaseInput = input.toLowerCase();+ return exceptions[lowerCaseInput] || input;+}++/*+`getDefaultExchange` contains the default Request and Response to be considered if none provided.+`getCustomExchange` takes in 2 optional fields named as Request and Response.+with `getCustomExchange`, if 501 response is expected, there is no need to pass Response as it considers default values.+*/++// Const to get default PaymentExchange object+const getDefaultExchange = () => ({+ Request: {},+ Response: {+ status: 501,+ body: {+ error: {+ type: "invalid_request",+ message: `Selected payment method through ${connectorName} is not implemented`,+ code: "IR_00",+ },+ },+ },+});++const getUnsupportedExchange = () => ({+ Request: {+ currency: "EUR",+ },+ Response: {+ status: 400,+ body: {+ error: {+ type: "invalid_request",+ message: `Payment method type not supported`,+ code: "IR_19",+ },+ },+ },+});++// Const to get PaymentExchange with overridden properties+export const getCustomExchange = (overrides) => {+ const defaultExchange = getDefaultExchange();++ return {+ ...defaultExchange,+ ...(overrides.Configs ? { Configs: overrides.Configs } : {}),+ Request: {+ ...defaultExchange.Request,+ ...(overrides.Request || {}),+ },+ Response: {+ ...defaultExchange.Response,+ ...(overrides.Response || {}),+ },+ ...(overrides.ResponseCustom+ ? { ResponseCustom: overrides.ResponseCustom }+ : {}),+ };+};++// Function to update the default status code+export const updateDefaultStatusCode = () => {+ return getUnsupportedExchange().Response;+};diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Nexixpay.js b/cypress-tests/cypress/e2e/configs/Payment/Nexixpay.jssimilarity index 100%rename from cypress-tests/cypress/e2e/PaymentUtils/Nexixpay.jsrename to cypress-tests/cypress/e2e/configs/Payment/Nexixpay.jsdiff --git a/cypress-tests/cypress/e2e/PaymentUtils/Nmi.js b/cypress-tests/cypress/e2e/configs/Payment/Nmi.jssimilarity index 100%rename from cypress-tests/cypress/e2e/PaymentUtils/Nmi.jsrename to cypress-tests/cypress/e2e/configs/Payment/Nmi.jsdiff --git a/cypress-tests/cypress/e2e/PaymentUtils/Noon.js b/cypress-tests/cypress/e2e/configs/Payment/Noon.jssimilarity index 100%rename from cypress-tests/cypress/e2e/PaymentUtils/Noon.jsrename to cypress-tests/cypress/e2e/configs/Payment/Noon.jsdiff --git a/cypress-tests/cypress/e2e/PaymentUtils/Novalnet.js b/cypress-tests/cypress/e2e/configs/Payment/Novalnet.jssimilarity index 100%rename from cypress-tests/cypress/e2e/PaymentUtils/Novalnet.jsrename to cypress-tests/cypress/e2e/configs/Payment/Novalnet.jsdiff --git a/cypress-tests/cypress/e2e/PaymentUtils/Paybox.js b/cypress-tests/cypress/e2e/configs/Payment/Paybox.jssimilarity index 100%rename from cypress-tests/cypress/e2e/PaymentUtils/Paybox.jsrename to cypress-tests/cypress/e2e/configs/Payment/Paybox.jsdiff --git a/cypress-tests/cypress/e2e/PaymentUtils/Paypal.js b/cypress-tests/cypress/e2e/configs/Payment/Paypal.jssimilarity index 99%rename from cypress-tests/cypress/e2e/PaymentUtils/Paypal.jsrename to cypress-tests/cypress/e2e/configs/Payment/Paypal.jsindex b30e989a2b..787ad2afab 100644--- a/cypress-tests/cypress/e2e/PaymentUtils/Paypal.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Paypal.js@@ -1,4 +1,4 @@-import { getCustomExchange } from "./Commons";+import { getCustomExchange } from "./Modifiers";const successfulNo3DSCardDetails = {card_number: "4012000033330026",diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Stripe.js b/cypress-tests/cypress/e2e/configs/Payment/Stripe.jssimilarity index 99%rename from cypress-tests/cypress/e2e/PaymentUtils/Stripe.jsrename to cypress-tests/cypress/e2e/configs/Payment/Stripe.jsindex 8d4d94fa56..1bfc1bff97 100644--- a/cypress-tests/cypress/e2e/PaymentUtils/Stripe.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Stripe.js@@ -1,8 +1,8 @@import {cardRequiredField,connectorDetails as commonConnectorDetails,- getCustomExchange,} from "./Commons";+import { getCustomExchange } from "./Modifiers";const successfulNo3DSCardDetails = {card_number: "4242424242424242",diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Trustpay.js b/cypress-tests/cypress/e2e/configs/Payment/Trustpay.jssimilarity index 99%rename from cypress-tests/cypress/e2e/PaymentUtils/Trustpay.jsrename to cypress-tests/cypress/e2e/configs/Payment/Trustpay.jsindex 6c4db9df32..cfd3332eab 100644--- a/cypress-tests/cypress/e2e/PaymentUtils/Trustpay.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Trustpay.js@@ -1,4 +1,4 @@-import { getCustomExchange } from "./Commons";+import { getCustomExchange } from "./Modifiers";const successfulNo3DSCardDetails = {card_number: "4200000000000000",diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.jssimilarity index 99%rename from cypress-tests/cypress/e2e/PaymentUtils/Utils.jsrename to cypress-tests/cypress/e2e/configs/Payment/Utils.jsindex 011383e887..c35e5950b7 100644--- a/cypress-tests/cypress/e2e/PaymentUtils/Utils.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js@@ -1,4 +1,4 @@-import { execConfig, validateConfig } from "../../utils/featureFlags.js";+import { execConfig, validateConfig } from "../../../utils/featureFlags.js";import { connectorDetails as adyenConnectorDetails } from "./Adyen.js";import { connectorDetails as bankOfAmericaConnectorDetails } from "./BankOfAmerica.js";diff --git a/cypress-tests/cypress/e2e/PaymentUtils/WellsFargo.js b/cypress-tests/cypress/e2e/configs/Payment/WellsFargo.jssimilarity index 100%rename from cypress-tests/cypress/e2e/PaymentUtils/WellsFargo.jsrename to cypress-tests/cypress/e2e/configs/Payment/WellsFargo.jsdiff --git a/cypress-tests/cypress/e2e/PaymentUtils/WorldPay.js b/cypress-tests/cypress/e2e/configs/Payment/WorldPay.jssimilarity index 99%rename from cypress-tests/cypress/e2e/PaymentUtils/WorldPay.jsrename to cypress-tests/cypress/e2e/configs/Payment/WorldPay.jsindex a811cac786..3e13aeba75 100644--- a/cypress-tests/cypress/e2e/PaymentUtils/WorldPay.js+++ b/cypress-tests/cypress/e2e/configs/Payment/WorldPay.js@@ -1,4 +1,4 @@-import { getCustomExchange } from "./Commons";+import { getCustomExchange } from "./Modifiers";const billing = {address: {diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Xendit.js b/cypress-tests/cypress/e2e/configs/Payment/Xendit.jssimilarity index 100%rename from cypress-tests/cypress/e2e/PaymentUtils/Xendit.jsrename to cypress-tests/cypress/e2e/configs/Payment/Xendit.jsdiff --git a/cypress-tests/cypress/e2e/PaymentMethodListUtils/Commons.js b/cypress-tests/cypress/e2e/configs/PaymentMethodList/Commons.jssimilarity index 100%rename from cypress-tests/cypress/e2e/PaymentMethodListUtils/Commons.jsrename to cypress-tests/cypress/e2e/configs/PaymentMethodList/Commons.jsdiff --git a/cypress-tests/cypress/e2e/PaymentMethodListUtils/Connector.js b/cypress-tests/cypress/e2e/configs/PaymentMethodList/Connector.jssimilarity index 100%rename from cypress-tests/cypress/e2e/PaymentMethodListUtils/Connector.jsrename to cypress-tests/cypress/e2e/configs/PaymentMethodList/Connector.jsdiff --git a/cypress-tests/cypress/e2e/PaymentMethodListUtils/Utils.js b/cypress-tests/cypress/e2e/configs/PaymentMethodList/Utils.jssimilarity index 100%rename from cypress-tests/cypress/e2e/PaymentMethodListUtils/Utils.jsrename to cypress-tests/cypress/e2e/configs/PaymentMethodList/Utils.jsdiff --git a/cypress-tests/cypress/e2e/PayoutUtils/Adyen.js b/cypress-tests/cypress/e2e/configs/Payout/Adyen.jssimilarity index 100%rename from cypress-tests/cypress/e2e/PayoutUtils/Adyen.jsrename to cypress-tests/cypress/e2e/configs/Payout/Adyen.jsdiff --git a/cypress-tests/cypress/e2e/PayoutUtils/AdyenPlatform.js b/cypress-tests/cypress/e2e/configs/Payout/AdyenPlatform.jssimilarity index 100%rename from cypress-tests/cypress/e2e/PayoutUtils/AdyenPlatform.jsrename to cypress-tests/cypress/e2e/configs/Payout/AdyenPlatform.jsdiff --git a/cypress-tests/cypress/e2e/PayoutUtils/Commons.js b/cypress-tests/cypress/e2e/configs/Payout/Commons.jssimilarity index 62%rename from cypress-tests/cypress/e2e/PayoutUtils/Commons.jsrename to cypress-tests/cypress/e2e/configs/Payout/Commons.jsindex ecd85b0515..749b39cc8d 100644--- a/cypress-tests/cypress/e2e/PayoutUtils/Commons.js+++ b/cypress-tests/cypress/e2e/configs/Payout/Commons.js@@ -1,44 +1,5 @@// This file is the default. To override, add to connector.js-import State from "../../utils/State";--const globalState = new State({- connectorId: Cypress.env("CONNECTOR"),- baseUrl: Cypress.env("BASEURL"),- adminApiKey: Cypress.env("ADMINAPIKEY"),- connectorAuthFilePath: Cypress.env("CONNECTOR_AUTH_FILE_PATH"),-});--const connectorName = normalise(globalState.get("connectorId"));--function normalise(input) {- const exceptions = {- adyenplatform: "Adyenplatform",- wise: "Wise",- wellsfargo: "Wellsfargo",- // Add more known exceptions here- };-- if (typeof input !== "string") {- const specName = Cypress.spec.name;-- if (specName.includes("-")) {- const parts = specName.split("-");-- if (parts.length > 1 && parts[1].includes(".")) {- return parts[1].split(".")[0];- }- }-- // Fallback- return `${specName}`;- }-- if (exceptions[input.toLowerCase()]) {- return exceptions[input.toLowerCase()];- } else {- return input;- }-}+import { getCustomExchange } from "./Modifiers";const card_data = {card_number: "4111111111111111",@@ -71,44 +32,6 @@ const billing = {},};-/*-`getDefaultExchange` contains the default Request and Response to be considered if none provided.-`getCustomExchange` takes in 2 optional fields named as Request and Response.-with `getCustomExchange`, if 501 response is expected, there is no need to pass Response as it considers default values.-*/--// Const to get default PaymentExchange object-const getDefaultExchange = () => ({- Request: {},- Response: {- status: 501,- body: {- error: {- type: "invalid_request",- message: `Selected payment method through ${connectorName} is not implemented`,- code: "IR_00",- },- },- },-});--// Const to get PaymentExchange with overridden properties-export const getCustomExchange = (overrides) => {- const defaultExchange = getDefaultExchange();-- return {- ...defaultExchange,- Request: {- ...defaultExchange.Request,- ...(overrides.Request || {}),- },- Response: {- ...defaultExchange.Response,- ...(overrides.Response || {}),- },- };-};-export const connectorDetails = {card_pm: {Create: getCustomExchange({diff --git a/cypress-tests/cypress/e2e/configs/Payout/Modifiers.js b/cypress-tests/cypress/e2e/configs/Payout/Modifiers.jsnew file mode 100644index 0000000000..514f7135a6--- /dev/null+++ b/cypress-tests/cypress/e2e/configs/Payout/Modifiers.js@@ -0,0 +1,78 @@+import State from "../../../utils/State";++const globalState = new State({+ connectorId: Cypress.env("CONNECTOR"),+ baseUrl: Cypress.env("BASEURL"),+ adminApiKey: Cypress.env("ADMINAPIKEY"),+ connectorAuthFilePath: Cypress.env("CONNECTOR_AUTH_FILE_PATH"),+});++const connectorName = normalise(globalState.get("connectorId"));++function normalise(input) {+ const exceptions = {+ adyenplatform: "Adyenplatform",+ wise: "Wise",+ wellsfargo: "Wellsfargo",+ // Add more known exceptions here+ };++ if (typeof input !== "string") {+ const specName = Cypress.spec.name;++ if (specName.includes("-")) {+ const parts = specName.split("-");++ if (parts.length > 1 && parts[1].includes(".")) {+ return parts[1].split(".")[0];+ }+ }++ // Fallback+ return `${specName}`;+ }++ if (exceptions[input.toLowerCase()]) {+ return exceptions[input.toLowerCase()];+ } else {+ return input;+ }+}++/*+`getDefaultExchange` contains the default Request and Response to be considered if none provided.+`getCustomExchange` takes in 2 optional fields named as Request and Response.+with `getCustomExchange`, if 501 response is expected, there is no need to pass Response as it considers default values.+*/++// Const to get default PaymentExchange object+const getDefaultExchange = () => ({+ Request: {},+ Response: {+ status: 501,+ body: {+ error: {+ type: "invalid_request",+ message: `Selected payment method through ${connectorName} is not implemented`,+ code: "IR_00",+ },+ },+ },+});++// Const to get PaymentExchange with overridden properties+export const getCustomExchange = (overrides) => {+ const defaultExchange = getDefaultExchange();++ return {+ ...defaultExchange,+ Request: {+ ...defaultExchange.Request,+ ...(overrides.Request || {}),+ },+ Response: {+ ...defaultExchange.Response,+ ...(overrides.Response || {}),+ },+ };+};diff --git a/cypress-tests/cypress/e2e/PayoutUtils/Utils.js b/cypress-tests/cypress/e2e/configs/Payout/Utils.jssimilarity index 97%rename from cypress-tests/cypress/e2e/PayoutUtils/Utils.jsrename to cypress-tests/cypress/e2e/configs/Payout/Utils.jsindex 4cd122782f..c97e29e644 100644--- a/cypress-tests/cypress/e2e/PayoutUtils/Utils.js+++ b/cypress-tests/cypress/e2e/configs/Payout/Utils.js@@ -1,4 +1,4 @@-import { validateConfig } from "../../utils/featureFlags.js";+import { validateConfig } from "../../../utils/featureFlags.js";import { connectorDetails as adyenConnectorDetails } from "./Adyen.js";import { connectorDetails as adyenPlatformConnectorDetails } from "./AdyenPlatform.js";diff --git a/cypress-tests/cypress/e2e/PayoutUtils/Wise.js b/cypress-tests/cypress/e2e/configs/Payout/Wise.jssimilarity index 100%rename from cypress-tests/cypress/e2e/PayoutUtils/Wise.jsrename to cypress-tests/cypress/e2e/configs/Payout/Wise.jsdiff --git a/cypress-tests/cypress/e2e/RoutingUtils/Adyen.js b/cypress-tests/cypress/e2e/configs/Routing/Adyen.jssimilarity index 100%rename from cypress-tests/cypress/e2e/RoutingUtils/Adyen.jsrename to cypress-tests/cypress/e2e/configs/Routing/Adyen.jsdiff --git a/cypress-tests/cypress/e2e/RoutingUtils/Autoretries.js b/cypress-tests/cypress/e2e/configs/Routing/Autoretries.jssimilarity index 100%rename from cypress-tests/cypress/e2e/RoutingUtils/Autoretries.jsrename to cypress-tests/cypress/e2e/configs/Routing/Autoretries.jsdiff --git a/cypress-tests/cypress/e2e/RoutingUtils/Commons.js b/cypress-tests/cypress/e2e/configs/Routing/Commons.jssimilarity index 100%rename from cypress-tests/cypress/e2e/RoutingUtils/Commons.jsrename to cypress-tests/cypress/e2e/configs/Routing/Commons.jsdiff --git a/cypress-tests/cypress/e2e/RoutingUtils/Stripe.js b/cypress-tests/cypress/e2e/configs/Routing/Stripe.jssimilarity index 99%rename from cypress-tests/cypress/e2e/RoutingUtils/Stripe.jsrename to cypress-tests/cypress/e2e/configs/Routing/Stripe.jsindex 21e885ac13..e00e3d6ccb 100644--- a/cypress-tests/cypress/e2e/RoutingUtils/Stripe.js+++ b/cypress-tests/cypress/e2e/configs/Routing/Stripe.js@@ -1,5 +1,3 @@-import {} from "./Commons";-const successfulNo3DSCardDetails = {card_number: "4242424242424242",card_exp_month: "10",diff --git a/cypress-tests/cypress/e2e/RoutingUtils/Utils.js b/cypress-tests/cypress/e2e/configs/Routing/Utils.jssimilarity index 100%rename from cypress-tests/cypress/e2e/RoutingUtils/Utils.jsrename to cypress-tests/cypress/e2e/configs/Routing/Utils.jsdiff --git a/cypress-tests/cypress/e2e/spec/Misc/00000-HealthCheck.cy.js b/cypress-tests/cypress/e2e/spec/Misc/00000-HealthCheck.cy.jsnew file mode 100644index 0000000000..d887e43cca--- /dev/null+++ b/cypress-tests/cypress/e2e/spec/Misc/00000-HealthCheck.cy.js@@ -0,0 +1,21 @@+import State from "../../../utils/State";++let globalState;++describe("In Memory Cache configs", () => {+ before("seed global state", () => {+ cy.task("getGlobalState").then((state) => {+ globalState = new State(state);+ });+ });++ after("flush global state", () => {+ cy.task("setGlobalState", globalState.data);+ });++ context("Health Check", () => {+ it("Create Configs", () => {+ cy.healthCheck(globalState);+ });+ });+});diff --git a/cypress-tests/cypress/e2e/PaymentTest/00028-MemoryCacheConfigs.cy.js b/cypress-tests/cypress/e2e/spec/Misc/00001-MemoryCacheConfigs.cy.jssimilarity index 58%rename from cypress-tests/cypress/e2e/PaymentTest/00028-MemoryCacheConfigs.cy.jsrename to cypress-tests/cypress/e2e/spec/Misc/00001-MemoryCacheConfigs.cy.jsindex afa7ceda0d..03b3d8cb89 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00028-MemoryCacheConfigs.cy.js+++ b/cypress-tests/cypress/e2e/spec/Misc/00001-MemoryCacheConfigs.cy.js@@ -1,8 +1,8 @@-import State from "../../utils/State";+import State from "../../../utils/State";let globalState;-describe("In Memory Cache Test", () => {+describe("In Memory Cache configs", () => {before("seed global state", () => {cy.task("getGlobalState").then((state) => {globalState = new State(state);@@ -19,17 +19,17 @@ describe("In Memory Cache Test", () => {const newValue = "new test value";it("Create Configs", () => {- cy.createConfigs(globalState, key, value);- cy.fetchConfigs(globalState, key, value);+ cy.setConfigs(globalState, key, value, "CREATE");+ cy.setConfigs(globalState, key, value, "FETCH");});it("Update Configs", () => {- cy.updateConfigs(globalState, key, newValue);- cy.fetchConfigs(globalState, key, newValue);+ cy.setConfigs(globalState, key, newValue, "UPDATE");+ cy.setConfigs(globalState, key, newValue, "FETCH");});it("delete configs", () => {- cy.deleteConfigs(globalState, key, newValue);+ cy.setConfigs(globalState, key, newValue, "DELETE");});});});diff --git a/cypress-tests/cypress/e2e/PaymentTest/00000-CoreFlows.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00000-CoreFlows.cy.jssimilarity index 96%rename from cypress-tests/cypress/e2e/PaymentTest/00000-CoreFlows.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00000-CoreFlows.cy.jsindex a0e2ad643e..b64bfc4254 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00000-CoreFlows.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00000-CoreFlows.cy.js@@ -1,6 +1,6 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import { payment_methods_enabled } from "../PaymentUtils/Commons";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import { payment_methods_enabled } from "../../configs/Payment/Commons";let globalState;diff --git a/cypress-tests/cypress/e2e/PaymentTest/00001-AccountCreate.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00001-AccountCreate.cy.jssimilarity index 84%rename from cypress-tests/cypress/e2e/PaymentTest/00001-AccountCreate.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00001-AccountCreate.cy.jsindex 1788a369fa..8557c6c3c8 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00001-AccountCreate.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00001-AccountCreate.cy.js@@ -1,5 +1,5 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";let globalState;describe("Account Create flow test", () => {diff --git a/cypress-tests/cypress/e2e/PaymentTest/00002-CustomerCreate.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00002-CustomerCreate.cy.jssimilarity index 81%rename from cypress-tests/cypress/e2e/PaymentTest/00002-CustomerCreate.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00002-CustomerCreate.cy.jsindex cfc55ceef9..ca64eb0c3f 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00002-CustomerCreate.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00002-CustomerCreate.cy.js@@ -1,5 +1,5 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";let globalState;diff --git a/cypress-tests/cypress/e2e/PaymentTest/00003-ConnectorCreate.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00003-ConnectorCreate.cy.jssimilarity index 84%rename from cypress-tests/cypress/e2e/PaymentTest/00003-ConnectorCreate.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00003-ConnectorCreate.cy.jsindex 3d002740e6..cde959ad8e 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00003-ConnectorCreate.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00003-ConnectorCreate.cy.js@@ -1,7 +1,7 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import { payment_methods_enabled } from "../PaymentUtils/Commons";-import * as utils from "../PaymentUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import { payment_methods_enabled } from "../../configs/Payment/Commons";+import * as utils from "../../configs/Payment/Utils";let globalState;describe("Connector Account Create flow test", () => {diff --git a/cypress-tests/cypress/e2e/PaymentTest/00004-NoThreeDSAutoCapture.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00004-NoThreeDSAutoCapture.cy.jssimilarity index 95%rename from cypress-tests/cypress/e2e/PaymentTest/00004-NoThreeDSAutoCapture.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00004-NoThreeDSAutoCapture.cy.jsindex e5030647cb..c2f5bb1082 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00004-NoThreeDSAutoCapture.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00004-NoThreeDSAutoCapture.cy.js@@ -1,6 +1,6 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import getConnectorDetails, * as utils from "../PaymentUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";let globalState;diff --git a/cypress-tests/cypress/e2e/PaymentTest/00005-ThreeDSAutoCapture.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00005-ThreeDSAutoCapture.cy.jssimilarity index 89%rename from cypress-tests/cypress/e2e/PaymentTest/00005-ThreeDSAutoCapture.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00005-ThreeDSAutoCapture.cy.jsindex 3a0b635f79..715d423867 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00005-ThreeDSAutoCapture.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00005-ThreeDSAutoCapture.cy.js@@ -1,6 +1,6 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import getConnectorDetails, * as utils from "../PaymentUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";let globalState;diff --git a/cypress-tests/cypress/e2e/PaymentTest/00006-NoThreeDSManualCapture.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00006-NoThreeDSManualCapture.cy.jssimilarity index 97%rename from cypress-tests/cypress/e2e/PaymentTest/00006-NoThreeDSManualCapture.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00006-NoThreeDSManualCapture.cy.jsindex d9769daab4..f82284b569 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00006-NoThreeDSManualCapture.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00006-NoThreeDSManualCapture.cy.js@@ -1,6 +1,6 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import getConnectorDetails, * as utils from "../PaymentUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";let globalState;diff --git a/cypress-tests/cypress/e2e/PaymentTest/00007-VoidPayment.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00007-VoidPayment.cy.jssimilarity index 96%rename from cypress-tests/cypress/e2e/PaymentTest/00007-VoidPayment.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00007-VoidPayment.cy.jsindex 68582a8e9a..c298f16483 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00007-VoidPayment.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00007-VoidPayment.cy.js@@ -1,6 +1,6 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import getConnectorDetails, * as utils from "../PaymentUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";let globalState;diff --git a/cypress-tests/cypress/e2e/PaymentTest/00008-SyncPayment.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00008-SyncPayment.cy.jssimilarity index 89%rename from cypress-tests/cypress/e2e/PaymentTest/00008-SyncPayment.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00008-SyncPayment.cy.jsindex 370d811ed6..c7da98909a 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00008-SyncPayment.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00008-SyncPayment.cy.js@@ -1,6 +1,6 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import getConnectorDetails, * as utils from "../PaymentUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";let globalState;diff --git a/cypress-tests/cypress/e2e/PaymentTest/00009-RefundPayment.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00009-RefundPayment.cy.jssimilarity index 99%rename from cypress-tests/cypress/e2e/PaymentTest/00009-RefundPayment.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00009-RefundPayment.cy.jsindex 4d534127ad..1d7ac32f0b 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00009-RefundPayment.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00009-RefundPayment.cy.js@@ -1,6 +1,6 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import getConnectorDetails, * as utils from "../PaymentUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";let globalState;diff --git a/cypress-tests/cypress/e2e/PaymentTest/00010-SyncRefund.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00010-SyncRefund.cy.jssimilarity index 92%rename from cypress-tests/cypress/e2e/PaymentTest/00010-SyncRefund.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00010-SyncRefund.cy.jsindex dc73862116..db63105d83 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00010-SyncRefund.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00010-SyncRefund.cy.js@@ -1,6 +1,6 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import getConnectorDetails, * as utils from "../PaymentUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";let globalState;diff --git a/cypress-tests/cypress/e2e/PaymentTest/00011-CreateSingleuseMandate.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00011-CreateSingleuseMandate.cy.jssimilarity index 96%rename from cypress-tests/cypress/e2e/PaymentTest/00011-CreateSingleuseMandate.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00011-CreateSingleuseMandate.cy.jsindex da2123d646..6fa01f9199 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00011-CreateSingleuseMandate.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00011-CreateSingleuseMandate.cy.js@@ -1,6 +1,6 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import getConnectorDetails, * as utils from "../PaymentUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";let globalState;diff --git a/cypress-tests/cypress/e2e/PaymentTest/00012-CreateMultiuseMandate.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00012-CreateMultiuseMandate.cy.jssimilarity index 97%rename from cypress-tests/cypress/e2e/PaymentTest/00012-CreateMultiuseMandate.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00012-CreateMultiuseMandate.cy.jsindex 000d69c45e..2af0b801d2 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00012-CreateMultiuseMandate.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00012-CreateMultiuseMandate.cy.js@@ -1,6 +1,6 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import getConnectorDetails, * as utils from "../PaymentUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";let globalState;diff --git a/cypress-tests/cypress/e2e/PaymentTest/00013-ListAndRevokeMandate.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00013-ListAndRevokeMandate.cy.jssimilarity index 94%rename from cypress-tests/cypress/e2e/PaymentTest/00013-ListAndRevokeMandate.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00013-ListAndRevokeMandate.cy.jsindex b8d0a51879..f3704b84f9 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00013-ListAndRevokeMandate.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00013-ListAndRevokeMandate.cy.js@@ -1,6 +1,6 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import getConnectorDetails, * as utils from "../PaymentUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";let globalState;diff --git a/cypress-tests/cypress/e2e/PaymentTest/00014-SaveCardFlow.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00014-SaveCardFlow.cy.jssimilarity index 99%rename from cypress-tests/cypress/e2e/PaymentTest/00014-SaveCardFlow.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00014-SaveCardFlow.cy.jsindex bab24076f5..26c250a323 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00014-SaveCardFlow.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00014-SaveCardFlow.cy.js@@ -1,6 +1,6 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import getConnectorDetails, * as utils from "../PaymentUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";let globalState;let saveCardBody;diff --git a/cypress-tests/cypress/e2e/PaymentTest/00015-ZeroAuthMandate.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00015-ZeroAuthMandate.cy.jssimilarity index 96%rename from cypress-tests/cypress/e2e/PaymentTest/00015-ZeroAuthMandate.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00015-ZeroAuthMandate.cy.jsindex 0cc1be5031..ba522b3cd7 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00015-ZeroAuthMandate.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00015-ZeroAuthMandate.cy.js@@ -1,6 +1,6 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import getConnectorDetails, * as utils from "../PaymentUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";let globalState;diff --git a/cypress-tests/cypress/e2e/PaymentTest/00016-ThreeDSManualCapture.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00016-ThreeDSManualCapture.cy.jssimilarity index 94%rename from cypress-tests/cypress/e2e/PaymentTest/00016-ThreeDSManualCapture.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00016-ThreeDSManualCapture.cy.jsindex 0426d17013..89d82f7fb9 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00016-ThreeDSManualCapture.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00016-ThreeDSManualCapture.cy.js@@ -1,7 +1,6 @@-import captureBody from "../../fixtures/capture-flow-body.json";-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import getConnectorDetails, * as utils from "../PaymentUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";let globalState;@@ -76,7 +75,7 @@ describe("Card - ThreeDS Manual payment flow test", () => {"card_pm"]["Capture"];- cy.captureCallTest(captureBody, data, 6500, globalState);+ cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);if (shouldContinue)shouldContinue = utils.should_continue_further(data);@@ -136,7 +135,7 @@ describe("Card - ThreeDS Manual payment flow test", () => {"card_pm"]["Capture"];- cy.captureCallTest(captureBody, data, 6500, globalState);+ cy.captureCallTest(fixtures.captureBody, data, 6500, globalState);if (shouldContinue)shouldContinue = utils.should_continue_further(data);@@ -214,7 +213,7 @@ describe("Card - ThreeDS Manual payment flow test", () => {"card_pm"]["PartialCapture"];- cy.captureCallTest(captureBody, data, 100, globalState);+ cy.captureCallTest(fixtures.captureBody, data, 100, globalState);if (shouldContinue)shouldContinue = utils.should_continue_further(data);@@ -274,7 +273,7 @@ describe("Card - ThreeDS Manual payment flow test", () => {"card_pm"]["PartialCapture"];- cy.captureCallTest(captureBody, data, 100, globalState);+ cy.captureCallTest(fixtures.captureBody, data, 100, globalState);if (shouldContinue)shouldContinue = utils.should_continue_further(data);diff --git a/cypress-tests/cypress/e2e/PaymentTest/00017-BankTransfers.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00017-BankTransfers.cy.jssimilarity index 91%rename from cypress-tests/cypress/e2e/PaymentTest/00017-BankTransfers.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00017-BankTransfers.cy.jsindex 913dd91ea8..49f93aaa10 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00017-BankTransfers.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00017-BankTransfers.cy.js@@ -1,6 +1,6 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import getConnectorDetails, * as utils from "../PaymentUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";let globalState;diff --git a/cypress-tests/cypress/e2e/PaymentTest/00018-BankRedirect.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00018-BankRedirect.cy.jssimilarity index 97%rename from cypress-tests/cypress/e2e/PaymentTest/00018-BankRedirect.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00018-BankRedirect.cy.jsindex cc3b8dbaec..4a7fc84036 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00018-BankRedirect.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00018-BankRedirect.cy.js@@ -1,6 +1,6 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import getConnectorDetails, * as utils from "../PaymentUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";let globalState;diff --git a/cypress-tests/cypress/e2e/PaymentTest/00019-MandatesUsingPMID.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00019-MandatesUsingPMID.cy.jssimilarity index 98%rename from cypress-tests/cypress/e2e/PaymentTest/00019-MandatesUsingPMID.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00019-MandatesUsingPMID.cy.jsindex 1a2dff1b5d..ec8ddc6c70 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00019-MandatesUsingPMID.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00019-MandatesUsingPMID.cy.js@@ -1,6 +1,6 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import getConnectorDetails, * as utils from "../PaymentUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";let globalState;diff --git a/cypress-tests/cypress/e2e/PaymentTest/00020-MandatesUsingNTIDProxy.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00020-MandatesUsingNTIDProxy.cy.jssimilarity index 96%rename from cypress-tests/cypress/e2e/PaymentTest/00020-MandatesUsingNTIDProxy.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00020-MandatesUsingNTIDProxy.cy.jsindex e3080d3987..1554436abf 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00020-MandatesUsingNTIDProxy.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00020-MandatesUsingNTIDProxy.cy.js@@ -1,6 +1,6 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import getConnectorDetails, * as utils from "../PaymentUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";let globalState;let connector;diff --git a/cypress-tests/cypress/e2e/PaymentTest/00021-UPI.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00021-UPI.cy.jssimilarity index 96%rename from cypress-tests/cypress/e2e/PaymentTest/00021-UPI.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00021-UPI.cy.jsindex e7a06c6224..d6b1c99407 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00021-UPI.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00021-UPI.cy.js@@ -1,6 +1,6 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import getConnectorDetails, * as utils from "../PaymentUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";let globalState;diff --git a/cypress-tests/cypress/e2e/PaymentTest/00022-Variations.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00022-Variations.cy.jssimilarity index 99%rename from cypress-tests/cypress/e2e/PaymentTest/00022-Variations.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00022-Variations.cy.jsindex be594e7648..f1499dc93b 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00022-Variations.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00022-Variations.cy.js@@ -1,6 +1,6 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import getConnectorDetails, * as utils from "../PaymentUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";let globalState;let paymentIntentBody;diff --git a/cypress-tests/cypress/e2e/PaymentTest/00023-PaymentMethods.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00023-PaymentMethods.cy.jssimilarity index 94%rename from cypress-tests/cypress/e2e/PaymentTest/00023-PaymentMethods.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00023-PaymentMethods.cy.jsindex 28262d025c..d88be29889 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00023-PaymentMethods.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00023-PaymentMethods.cy.js@@ -1,6 +1,6 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import getConnectorDetails, * as utils from "../PaymentUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";let globalState;diff --git a/cypress-tests/cypress/e2e/PaymentTest/00024-ConnectorAgnosticNTID.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00024-ConnectorAgnosticNTID.cy.jssimilarity index 97%rename from cypress-tests/cypress/e2e/PaymentTest/00024-ConnectorAgnosticNTID.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00024-ConnectorAgnosticNTID.cy.jsindex db5757e464..4db0ad9990 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00024-ConnectorAgnosticNTID.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00024-ConnectorAgnosticNTID.cy.js@@ -1,7 +1,7 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import { payment_methods_enabled } from "../PaymentUtils/Commons";-import getConnectorDetails, * as utils from "../PaymentUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import { payment_methods_enabled } from "../../configs/Payment/Commons";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";let globalState;diff --git a/cypress-tests/cypress/e2e/PaymentTest/00024-SessionCall.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00025-SessionCall.cy.jssimilarity index 87%rename from cypress-tests/cypress/e2e/PaymentTest/00024-SessionCall.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00025-SessionCall.cy.jsindex 8d729a2f77..5a62f5f1a6 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00024-SessionCall.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00025-SessionCall.cy.js@@ -1,6 +1,6 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import getConnectorDetails, * as utils from "../PaymentUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";let globalState;diff --git a/cypress-tests/cypress/e2e/PaymentTest/00025-BusinessProfileConfigs.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00026-BusinessProfileConfigs.cy.jssimilarity index 97%rename from cypress-tests/cypress/e2e/PaymentTest/00025-BusinessProfileConfigs.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00026-BusinessProfileConfigs.cy.jsindex b1ccc55ccb..e6e6030d1b 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00025-BusinessProfileConfigs.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00026-BusinessProfileConfigs.cy.js@@ -1,7 +1,7 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import { payment_methods_enabled } from "../PaymentUtils/Commons";-import getConnectorDetails, * as utils from "../PaymentUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import { payment_methods_enabled } from "../../configs/Payment/Commons";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";let globalState;diff --git a/cypress-tests/cypress/e2e/PaymentTest/00026-DynamicFields.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00027-DynamicFields.cy.jssimilarity index 95%rename from cypress-tests/cypress/e2e/PaymentTest/00026-DynamicFields.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00027-DynamicFields.cy.jsindex a325ac5f2f..9bbf07b880 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00026-DynamicFields.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00027-DynamicFields.cy.js@@ -1,7 +1,7 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import { cardCreditEnabled } from "../PaymentMethodListUtils/Commons";-import getConnectorDetails, * as utils from "../PaymentUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";+import { cardCreditEnabled } from "../../configs/PaymentMethodList/Commons";let globalState;diff --git a/cypress-tests/cypress/e2e/PaymentTest/00027-IncrementalAuth.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00028-IncrementalAuth.cy.jssimilarity index 95%rename from cypress-tests/cypress/e2e/PaymentTest/00027-IncrementalAuth.cy.jsrename to cypress-tests/cypress/e2e/spec/Payment/00028-IncrementalAuth.cy.jsindex e281fc0a2f..76116acc2b 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00027-IncrementalAuth.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00028-IncrementalAuth.cy.js@@ -1,6 +1,6 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import getConnectorDetails, * as utils from "../PaymentUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";let connector;let globalState;diff --git a/cypress-tests/cypress/e2e/PaymentMethodListTest/00000-PaymentMethodListTests.cy.js b/cypress-tests/cypress/e2e/spec/PaymentMethodList/00000-PaymentMethodListTests.cy.jssimilarity index 99%rename from cypress-tests/cypress/e2e/PaymentMethodListTest/00000-PaymentMethodListTests.cy.jsrename to cypress-tests/cypress/e2e/spec/PaymentMethodList/00000-PaymentMethodListTests.cy.jsindex 0f754831d4..292f5d0679 100644--- a/cypress-tests/cypress/e2e/PaymentMethodListTest/00000-PaymentMethodListTests.cy.js+++ b/cypress-tests/cypress/e2e/spec/PaymentMethodList/00000-PaymentMethodListTests.cy.js@@ -1,16 +1,16 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";import {bankRedirectIdealAndCreditEnabled,bankRedirectIdealEnabled,cardCreditEnabled,+ cardCreditEnabledInEur,cardCreditEnabledInUs,cardCreditEnabledInUsd,- cardCreditEnabledInEur,createPaymentBodyWithCurrency,createPaymentBodyWithCurrencyCountry,-} from "../PaymentMethodListUtils/Commons";-import getConnectorDetails from "../PaymentMethodListUtils/Utils";+} from "../../configs/PaymentMethodList/Commons";+import getConnectorDetails from "../../configs/PaymentMethodList/Utils";let globalState;describe("Payment Method list using Constraint Graph flow tests", () => {diff --git a/cypress-tests/cypress/e2e/PayoutTest/00000-AccountCreate.cy.js b/cypress-tests/cypress/e2e/spec/Payout/00000-AccountCreate.cy.jssimilarity index 84%rename from cypress-tests/cypress/e2e/PayoutTest/00000-AccountCreate.cy.jsrename to cypress-tests/cypress/e2e/spec/Payout/00000-AccountCreate.cy.jsindex 75cc93a498..4b04db2ae0 100644--- a/cypress-tests/cypress/e2e/PayoutTest/00000-AccountCreate.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payout/00000-AccountCreate.cy.js@@ -1,5 +1,5 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";let globalState;diff --git a/cypress-tests/cypress/e2e/PayoutTest/00001-CustomerCreate.cy.js b/cypress-tests/cypress/e2e/spec/Payout/00001-CustomerCreate.cy.jssimilarity index 81%rename from cypress-tests/cypress/e2e/PayoutTest/00001-CustomerCreate.cy.jsrename to cypress-tests/cypress/e2e/spec/Payout/00001-CustomerCreate.cy.jsindex cfc55ceef9..ca64eb0c3f 100644--- a/cypress-tests/cypress/e2e/PayoutTest/00001-CustomerCreate.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payout/00001-CustomerCreate.cy.js@@ -1,5 +1,5 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";let globalState;diff --git a/cypress-tests/cypress/e2e/PayoutTest/00002-ConnectorCreate.cy.js b/cypress-tests/cypress/e2e/spec/Payout/00002-ConnectorCreate.cy.jssimilarity index 83%rename from cypress-tests/cypress/e2e/PayoutTest/00002-ConnectorCreate.cy.jsrename to cypress-tests/cypress/e2e/spec/Payout/00002-ConnectorCreate.cy.jsindex 8bcff83685..ec7ee36993 100644--- a/cypress-tests/cypress/e2e/PayoutTest/00002-ConnectorCreate.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payout/00002-ConnectorCreate.cy.js@@ -1,5 +1,5 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";let globalState;describe("Connector Account Create flow test", () => {diff --git a/cypress-tests/cypress/e2e/PayoutTest/00003-CardTest.cy.js b/cypress-tests/cypress/e2e/spec/Payout/00003-CardTest.cy.jssimilarity index 94%rename from cypress-tests/cypress/e2e/PayoutTest/00003-CardTest.cy.jsrename to cypress-tests/cypress/e2e/spec/Payout/00003-CardTest.cy.jsindex fd9b9d9f6e..694a26b703 100644--- a/cypress-tests/cypress/e2e/PayoutTest/00003-CardTest.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payout/00003-CardTest.cy.js@@ -1,6 +1,6 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import * as utils from "../PayoutUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import * as utils from "../../configs/Payout/Utils";let globalState;diff --git a/cypress-tests/cypress/e2e/PayoutTest/00004-BankTransfer.cy.js b/cypress-tests/cypress/e2e/spec/Payout/00004-BankTransfer.cy.jssimilarity index 96%rename from cypress-tests/cypress/e2e/PayoutTest/00004-BankTransfer.cy.jsrename to cypress-tests/cypress/e2e/spec/Payout/00004-BankTransfer.cy.jsindex 0cb4508ded..174b257a48 100644--- a/cypress-tests/cypress/e2e/PayoutTest/00004-BankTransfer.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payout/00004-BankTransfer.cy.js@@ -1,6 +1,6 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import * as utils from "../PayoutUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import * as utils from "../../configs/Payout/Utils";let globalState;diff --git a/cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.js b/cypress-tests/cypress/e2e/spec/Payout/00005-SavePayout.cy.jssimilarity index 97%rename from cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.jsrename to cypress-tests/cypress/e2e/spec/Payout/00005-SavePayout.cy.jsindex 37dc1c2cdf..30ad8e6bf8 100644--- a/cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payout/00005-SavePayout.cy.js@@ -1,6 +1,6 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import * as utils from "../PayoutUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import * as utils from "../../configs/Payout/Utils";let globalState;let payoutBody;diff --git a/cypress-tests/cypress/e2e/RoutingTest/00000-PriorityRouting.cy.js b/cypress-tests/cypress/e2e/spec/Routing/00000-PriorityRouting.cy.jssimilarity index 84%rename from cypress-tests/cypress/e2e/RoutingTest/00000-PriorityRouting.cy.jsrename to cypress-tests/cypress/e2e/spec/Routing/00000-PriorityRouting.cy.jsindex 5699712ec2..a070592d76 100644--- a/cypress-tests/cypress/e2e/RoutingTest/00000-PriorityRouting.cy.js+++ b/cypress-tests/cypress/e2e/spec/Routing/00000-PriorityRouting.cy.js@@ -1,6 +1,6 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import * as utils from "../RoutingUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import * as utils from "../../configs/Routing/Utils";let globalState;@@ -8,11 +8,29 @@ describe("Priority Based Routing Test", () => {let shouldContinue = true;beforeEach(() => {- // Restore the session if it existscy.session("login", () => {- cy.userLogin(globalState);- cy.terminate2Fa(globalState);- cy.userInfo(globalState);+ // Make sure we have credentials+ if (!globalState.get("email") || !globalState.get("password")) {+ throw new Error("Missing login credentials in global state");+ }++ cy.userLogin(globalState)+ .then(() => cy.terminate2Fa(globalState))+ .then(() => cy.userInfo(globalState))+ .then(() => {+ // Verify we have all necessary tokens and IDs+ const requiredKeys = [+ "userInfoToken",+ "merchantId",+ "organizationId",+ "profileId",+ ];+ requiredKeys.forEach((key) => {+ if (!globalState.get(key)) {+ throw new Error(`Missing required key after login: ${key}`);+ }+ });+ });});});diff --git a/cypress-tests/cypress/e2e/RoutingTest/00001-VolumeBasedRouting.cy.js b/cypress-tests/cypress/e2e/spec/Routing/00001-VolumeBasedRouting.cy.jssimilarity index 87%rename from cypress-tests/cypress/e2e/RoutingTest/00001-VolumeBasedRouting.cy.jsrename to cypress-tests/cypress/e2e/spec/Routing/00001-VolumeBasedRouting.cy.jsindex 16b640bc03..75d5b7ab84 100644--- a/cypress-tests/cypress/e2e/RoutingTest/00001-VolumeBasedRouting.cy.js+++ b/cypress-tests/cypress/e2e/spec/Routing/00001-VolumeBasedRouting.cy.js@@ -1,16 +1,35 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import * as utils from "../RoutingUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import * as utils from "../../configs/Routing/Utils";let globalState;describe("Volume Based Routing Test", () => {+ // Restore the session if it existsbeforeEach(() => {- // Restore the session if it existscy.session("login", () => {- cy.userLogin(globalState);- cy.terminate2Fa(globalState);- cy.userInfo(globalState);+ // Make sure we have credentials+ if (!globalState.get("email") || !globalState.get("password")) {+ throw new Error("Missing login credentials in global state");+ }++ cy.userLogin(globalState)+ .then(() => cy.terminate2Fa(globalState))+ .then(() => cy.userInfo(globalState))+ .then(() => {+ // Verify we have all necessary tokens and IDs+ const requiredKeys = [+ "userInfoToken",+ "merchantId",+ "organizationId",+ "profileId",+ ];+ requiredKeys.forEach((key) => {+ if (!globalState.get(key)) {+ throw new Error(`Missing required key after login: ${key}`);+ }+ });+ });});});diff --git a/cypress-tests/cypress/e2e/RoutingTest/00002-RuleBasedRouting.cy.js b/cypress-tests/cypress/e2e/spec/Routing/00002-RuleBasedRouting.cy.jssimilarity index 93%rename from cypress-tests/cypress/e2e/RoutingTest/00002-RuleBasedRouting.cy.jsrename to cypress-tests/cypress/e2e/spec/Routing/00002-RuleBasedRouting.cy.jsindex a1621a530a..cf18a20487 100644--- a/cypress-tests/cypress/e2e/RoutingTest/00002-RuleBasedRouting.cy.js+++ b/cypress-tests/cypress/e2e/spec/Routing/00002-RuleBasedRouting.cy.js@@ -1,16 +1,35 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import * as utils from "../RoutingUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import * as utils from "../../configs/Routing/Utils";let globalState;describe("Rule Based Routing Test", () => {+ // Restore the session if it existsbeforeEach(() => {- // Restore the session if it existscy.session("login", () => {- cy.userLogin(globalState);- cy.terminate2Fa(globalState);- cy.userInfo(globalState);+ // Make sure we have credentials+ if (!globalState.get("email") || !globalState.get("password")) {+ throw new Error("Missing login credentials in global state");+ }++ cy.userLogin(globalState)+ .then(() => cy.terminate2Fa(globalState))+ .then(() => cy.userInfo(globalState))+ .then(() => {+ // Verify we have all necessary tokens and IDs+ const requiredKeys = [+ "userInfoToken",+ "merchantId",+ "organizationId",+ "profileId",+ ];+ requiredKeys.forEach((key) => {+ if (!globalState.get(key)) {+ throw new Error(`Missing required key after login: ${key}`);+ }+ });+ });});});diff --git a/cypress-tests/cypress/e2e/RoutingTest/00003-Retries.cy.js b/cypress-tests/cypress/e2e/spec/Routing/00003-Retries.cy.jssimilarity index 79%rename from cypress-tests/cypress/e2e/RoutingTest/00003-Retries.cy.jsrename to cypress-tests/cypress/e2e/spec/Routing/00003-Retries.cy.jsindex 94fcaed104..0e4eaed7c3 100644--- a/cypress-tests/cypress/e2e/RoutingTest/00003-Retries.cy.js+++ b/cypress-tests/cypress/e2e/spec/Routing/00003-Retries.cy.js@@ -1,16 +1,35 @@-import * as fixtures from "../../fixtures/imports";-import State from "../../utils/State";-import * as utils from "../RoutingUtils/Utils";+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import * as utils from "../../configs/Routing/Utils";let globalState;describe("Auto Retries & Step Up 3DS", () => {+ // Restore the session if it existsbeforeEach(() => {- // Restore the session if it existscy.session("login", () => {- cy.userLogin(globalState);- cy.terminate2Fa(globalState);- cy.userInfo(globalState);+ // Make sure we have credentials+ if (!globalState.get("email") || !globalState.get("password")) {+ throw new Error("Missing login credentials in global state");+ }++ cy.userLogin(globalState)+ .then(() => cy.terminate2Fa(globalState))+ .then(() => cy.userInfo(globalState))+ .then(() => {+ // Verify we have all necessary tokens and IDs+ const requiredKeys = [+ "userInfoToken",+ "merchantId",+ "organizationId",+ "profileId",+ ];+ requiredKeys.forEach((key) => {+ if (!globalState.get(key)) {+ throw new Error(`Missing required key after login: ${key}`);+ }+ });+ });});});@@ -45,7 +64,13 @@ describe("Auto Retries & Step Up 3DS", () => {context("Auto Retries", () => {context("[Config: enable] Auto retries", () => {it("Enable auto retries", () => {- cy.updateConfig("autoRetry", globalState, "true");+ const merchantId = globalState.get("merchantId");+ cy.setConfigs(+ globalState,+ `should_call_gsm_${merchantId}`,+ "true",+ "UPDATE"+ );});context("Max auto retries", () => {@@ -96,9 +121,15 @@ describe("Auto Retries & Step Up 3DS", () => {});context("Max auto retries = 2", () => {- const max_auto_retries = 2;+ const maxAutoRetries = 2;it("Update max auto retries", () => {- cy.updateConfig("maxRetries", globalState, `${max_auto_retries}`);+ const merchantId = globalState.get("merchantId");+ cy.setConfigs(+ globalState,+ `max_auto_retries_enabled_${merchantId}`,+ `${maxAutoRetries}`,+ "UPDATE"+ );});context("Make payment", () => {@@ -136,16 +167,22 @@ describe("Auto Retries & Step Up 3DS", () => {globalState,null,true,- max_auto_retries + 1+ maxAutoRetries + 1);});});});context("Max auto retries = 1", () => {- const max_auto_retries = 1;+ const maxAutoRetries = 1;it("Update max auto retries", () => {- cy.updateConfig("maxRetries", globalState, `${max_auto_retries}`);+ const merchantId = globalState.get("merchantId");+ cy.setConfigs(+ globalState,+ `max_auto_retries_enabled_${merchantId}`,+ `${maxAutoRetries}`,+ "UPDATE"+ );});context("Make payment", () => {@@ -183,15 +220,21 @@ describe("Auto Retries & Step Up 3DS", () => {globalState,null,true,- max_auto_retries + 1+ maxAutoRetries + 1);});});});context("Max auto retries = 0", () => {- const max_auto_retries = 0;+ const maxAutoRetries = 0;it("Update max auto retries", () => {- cy.updateConfig("maxRetries", globalState, `${max_auto_retries}`);+ const merchantId = globalState.get("merchantId");+ cy.setConfigs(+ globalState,+ `max_auto_retries_enabled_${merchantId}`,+ `${maxAutoRetries}`,+ "UPDATE"+ );});context("Make payment", () => {@@ -229,7 +272,7 @@ describe("Auto Retries & Step Up 3DS", () => {globalState,null,true,- max_auto_retries + 1+ maxAutoRetries + 1);});});@@ -283,9 +326,15 @@ describe("Auto Retries & Step Up 3DS", () => {});context("Max auto retries = 2", () => {- const max_auto_retries = 2;+ const maxAutoRetries = 2;it("Update max auto retries", () => {- cy.updateConfig("maxRetries", globalState, `${max_auto_retries}`);+ const merchantId = globalState.get("merchantId");+ cy.setConfigs(+ globalState,+ `max_auto_retries_enabled_${merchantId}`,+ `${maxAutoRetries}`,+ "UPDATE"+ );});context("Make payment", () => {@@ -323,16 +372,22 @@ describe("Auto Retries & Step Up 3DS", () => {globalState,null,true,- max_auto_retries + 1+ maxAutoRetries + 1);});});});context("Max auto retries = 1", () => {- const max_auto_retries = 1;+ const maxAutoRetries = 1;it("Update max auto retries", () => {- cy.updateConfig("maxRetries", globalState, `${max_auto_retries}`);+ const merchantId = globalState.get("merchantId");+ cy.setConfigs(+ globalState,+ `max_auto_retries_enabled_${merchantId}`,+ `${maxAutoRetries}`,+ "UPDATE"+ );});context("Make payment", () => {@@ -370,16 +425,22 @@ describe("Auto Retries & Step Up 3DS", () => {globalState,null,true,- max_auto_retries + 1+ maxAutoRetries + 1);});});});context("Max auto retries = 0", () => {- const max_auto_retries = 0;+ const maxAutoRetries = 0;it("Update max auto retries", () => {- cy.updateConfig("maxRetries", globalState, `${max_auto_retries}`);+ const merchantId = globalState.get("merchantId");+ cy.setConfigs(+ globalState,+ `max_auto_retries_enabled_${merchantId}`,+ `${maxAutoRetries}`,+ "UPDATE"+ );});context("Make payment", () => {@@ -417,7 +478,7 @@ describe("Auto Retries & Step Up 3DS", () => {globalState,null,true,- max_auto_retries + 1+ maxAutoRetries + 1);});});@@ -432,14 +493,26 @@ describe("Auto Retries & Step Up 3DS", () => {});it("[Config: enable] Step up for Stripe", () => {- cy.updateConfig("stepUp", globalState, '["stripe"]');+ const merchantId = globalState.get("merchantId");+ cy.setConfigs(+ globalState,+ `step_up_enabled_${merchantId}`,+ '["stripe"]',+ "UPDATE"+ );});});context("Make Payment", () => {- const max_auto_retries = 1;+ const maxAutoRetries = 1;it("Update max auto retries", () => {- cy.updateConfig("maxRetries", globalState, `${max_auto_retries}`);+ const merchantId = globalState.get("merchantId");+ cy.setConfigs(+ globalState,+ `max_auto_retries_enabled_${merchantId}`,+ `${maxAutoRetries}`,+ "UPDATE"+ );});it("Payment create call", () => {@@ -471,7 +544,7 @@ describe("Auto Retries & Step Up 3DS", () => {globalState,null,true,- max_auto_retries + 1+ maxAutoRetries + 1);});});@@ -480,7 +553,13 @@ describe("Auto Retries & Step Up 3DS", () => {context("[Config: disable] Auto retries", () => {it("[Config: disable] Auto retries", () => {- cy.updateConfig("autoRetry", globalState, "false");+ const merchantId = globalState.get("merchantId");+ cy.setConfigs(+ globalState,+ `should_call_gsm_${merchantId}`,+ "false",+ "UPDATE"+ );});it("[Config: disable] Step up GSM", () => {diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.jsindex 1b7b41a035..9d01f924b5 100644--- a/cypress-tests/cypress/support/commands.js+++ b/cypress-tests/cypress/support/commands.js@@ -29,9 +29,10 @@ import {defaultErrorHandler,extractIntegerAtEnd,getValueByKey,-} from "../e2e/PaymentUtils/Utils";+} from "../e2e/configs/Payment/Utils";import { execConfig, validateConfig } from "../utils/featureFlags";import * as RequestBodyUtils from "../utils/RequestBodyUtils";+import { isoTimeTomorrow, validateEnv } from "../utils/RequestBodyUtils.js";import { handleRedirection } from "./redirectionHandler";function logRequestId(xRequestId) {@@ -44,11 +45,34 @@ function logRequestId(xRequestId) {function validateErrorMessage(response, resData) {if (resData.body.status !== "failed") {- expect(response.body.error_message).to.be.null;- expect(response.body.error_code).to.be.null;+ expect(response.body.error_message, "error_message").to.be.null;+ expect(response.body.error_code, "error_code").to.be.null;}}+Cypress.Commands.add("healthCheck", (globalState) => {+ const baseUrl = globalState.get("baseUrl");+ const url = `${baseUrl}/health`;++ cy.request({+ method: "GET",+ url: url,+ headers: {+ Accept: "application/json",+ },+ }).then((response) => {+ logRequestId(response.headers["x-request-id"]);++ if (response.status === 200) {+ expect(response.body).to.equal("health is good");+ } else {+ throw new Error(+ `Health Check failed with status: \`${response.status}\` and body: \`${response.body}\``+ );+ }+ });+});+Cypress.Commands.add("merchantCreateCallTest",(merchantCreateBody, globalState) => {@@ -297,34 +321,70 @@ Cypress.Commands.add(});});-+// API Key API callsCypress.Commands.add("apiKeyCreateTest", (apiKeyCreateBody, globalState) => {+ // Define the necessary variables and constant++ const apiKey = globalState.get("adminApiKey");+ const baseUrl = globalState.get("baseUrl");+ // We do not want to keep API Key forever,+ // so we set the expiry to tomorrow as new merchant accounts are created with every run+ const expiry = isoTimeTomorrow();+ const keyIdType = "key_id";+ const keyId = validateEnv(baseUrl, keyIdType);+ const merchantId = globalState.get("merchantId");+ const url = `${baseUrl}/api_keys/${merchantId}`;++ // Update request body+ apiKeyCreateBody.expiration = expiry;+cy.request({method: "POST",- url: `${globalState.get("baseUrl")}/api_keys/${globalState.get("merchantId")}`,+ url: url,headers: {Accept: "application/json","Content-Type": "application/json",- "api-key": globalState.get("adminApiKey"),+ "api-key": apiKey,},body: apiKeyCreateBody,failOnStatusCode: false,}).then((response) => {logRequestId(response.headers["x-request-id"]);- // Handle the response as needed- globalState.set("apiKey", response.body.api_key);- globalState.set("apiKeyId", response.body.key_id);+ if (response.status === 200) {+ expect(response.body.merchant_id).to.equal(merchantId);+ expect(response.body.description).to.equal(apiKeyCreateBody.description);++ // API Key assertions are intentionally excluded to avoid being exposed in the logs+ expect(response.body).to.have.property(keyIdType).and.to.include(keyId)+ .and.to.not.be.empty;++ globalState.set("apiKeyId", response.body.key_id);+ globalState.set("apiKey", response.body.api_key);++ cy.task("setGlobalState", globalState.data);+ } else {+ // to be updated+ throw new Error(+ `API Key create call failed with status ${response.status} and message: "${response.body.error.message}"`+ );+ }});});Cypress.Commands.add("apiKeyUpdateCall", (apiKeyUpdateBody, globalState) => {- const merchant_id = globalState.get("merchantId");- const api_key_id = globalState.get("apiKeyId");+ const merchantId = globalState.get("merchantId");+ const apiKeyId = globalState.get("apiKeyId");+ // We do not want to keep API Key forever,+ // so we set the expiry to tomorrow as new merchant accounts are created with every run+ const expiry = isoTimeTomorrow();++ // Update request body+ apiKeyUpdateBody.expiration = expiry;cy.request({method: "POST",- url: `${globalState.get("baseUrl")}/api_keys/${merchant_id}/${api_key_id}`,+ url: `${globalState.get("baseUrl")}/api_keys/${merchantId}/${apiKeyId}`,headers: {Accept: "application/json","Content-Type": "application/json",@@ -335,10 +395,18 @@ Cypress.Commands.add("apiKeyUpdateCall", (apiKeyUpdateBody, globalState) => {}).then((response) => {logRequestId(response.headers["x-request-id"]);- // Handle the response as needed- expect(response.body.name).to.equal("Updated API Key");- expect(response.body.key_id).to.equal(api_key_id);- expect(response.body.merchant_id).to.equal(merchant_id);+ if (response.status === 200) {+ expect(response.body.name).to.equal("Updated API Key");+ expect(response.body.merchant_id).to.equal(merchantId);++ // API Key assertions are intentionally excluded to avoid being exposed in the logs+ expect(response.body.key_id).to.equal(apiKeyId);+ } else {+ // to be updated+ throw new Error(+ `API Key create call failed with status ${response.status} and message: "${response.body.error.message}"`+ );+ }});});@@ -3030,6 +3098,9 @@ Cypress.Commands.add("userLogin", (globalState) => {.be.empty;const totpToken = response.body.token;+ if (!totpToken) {+ throw new Error("No token received from login");+ }globalState.set("totpToken", totpToken);}} else {@@ -3063,6 +3134,9 @@ Cypress.Commands.add("terminate2Fa", (globalState) => {.to.not.be.empty;const userInfoToken = response.body.token;+ if (!userInfoToken) {+ throw new Error("No user info token received");+ }globalState.set("userInfoToken", userInfoToken);}} else {@@ -3075,14 +3149,18 @@ Cypress.Commands.add("terminate2Fa", (globalState) => {Cypress.Commands.add("userInfo", (globalState) => {// Define the necessary variables and constantconst baseUrl = globalState.get("baseUrl");- const apiKey = globalState.get("userInfoToken");+ const userInfoToken = globalState.get("userInfoToken");const url = `${baseUrl}/user`;+ if (!userInfoToken) {+ throw new Error("No user info token available");+ }+cy.request({method: "GET",url: url,headers: {- Authorization: `Bearer ${apiKey}`,+ Authorization: `Bearer ${userInfoToken}`,"Content-Type": "application/json",},failOnStatusCode: false,@@ -3101,7 +3179,7 @@ Cypress.Commands.add("userInfo", (globalState) => {globalState.set("organizationId", response.body.org_id);globalState.set("profileId", response.body.profile_id);- globalState.set("userInfoToken", apiKey);+ globalState.set("userInfoToken", userInfoToken);} else {throw new Error(`User login call failed to fetch user info with status: "${response.status}" and message: "${response.body.error.message}"`@@ -3254,56 +3332,6 @@ Cypress.Commands.add(});-Cypress.Commands.add("updateConfig", (configType, globalState, value) => {- const base_url = globalState.get("baseUrl");- const merchant_id = globalState.get("merchantId");- const api_key = globalState.get("adminApiKey");-- let key;- let url;- let body;-- switch (configType) {- case "autoRetry":- key = `should_call_gsm_${merchant_id}`;- url = `${base_url}/configs/${key}`;- body = { key: key, value: value };- break;- case "maxRetries":- key = `max_auto_retries_enabled_${merchant_id}`;- url = `${base_url}/configs/${key}`;- body = { key: key, value: value };- break;- case "stepUp":- key = `step_up_enabled_${merchant_id}`;- url = `${base_url}/configs/${key}`;- body = { key: key, value: value };- break;- default:- throw new Error(- `Invalid config type passed into the configs: "${api_key}: ${value}"`- );- }-- cy.request({- method: "POST",- url: url,- headers: {- "Content-Type": "application/json",- "api-key": api_key,- },- body: body,- failOnStatusCode: false,- }).then((response) => {- logRequestId(response.headers["x-request-id"]);-- if (response.status === 200) {- expect(response.body).to.have.property("key").to.equal(key);- expect(response.body).to.have.property("value").to.equal(value);- }- });-});-Cypress.Commands.add("incrementalAuth", (globalState, data) => {const { Request: reqData, Response: resData } = data || {};@@ -3370,94 +3398,52 @@ Cypress.Commands.add("incrementalAuth", (globalState, data) => {});});-Cypress.Commands.add("createConfigs", (globalState, key, value) => {- const base_url = globalState.get("baseUrl");- const api_key = globalState.get("adminApiKey");-- cy.request({- method: "POST",- url: `${base_url}/configs/`,- headers: {- "Content-Type": "application/json",- "api-key": api_key,- },- body: {- key: key,- value: value,- },- failOnStatusCode: false,- }).then((response) => {- logRequestId(response.headers["x-request-id"]);-- expect(response.status).to.equal(200);- expect(response.body).to.have.property("key").to.equal(key);- expect(response.body).to.have.property("value").to.equal(value);- });-});--Cypress.Commands.add("fetchConfigs", (globalState, key, value) => {- const base_url = globalState.get("baseUrl");- const api_key = globalState.get("adminApiKey");-- cy.request({- method: "GET",- url: `${base_url}/configs/${key}`,- headers: {- "Content-Type": "application/json",- "api-key": api_key,- },- failOnStatusCode: false,- }).then((response) => {- logRequestId(response.headers["x-request-id"]);-- expect(response.status).to.equal(200);- expect(response.body).to.have.property("key").to.equal(key);- expect(response.body).to.have.property("value").to.equal(value);- });-});+Cypress.Commands.add("setConfigs", (globalState, key, value, requestType) => {+ if (!key || !requestType) {+ throw new Error("Key and requestType are required parameters");+ }-Cypress.Commands.add("updateConfigs", (globalState, key, value) => {- const base_url = globalState.get("baseUrl");- const api_key = globalState.get("adminApiKey");+ const REQUEST_CONFIG = {+ CREATE: { method: "POST", useKey: false },+ UPDATE: { method: "POST", useKey: true },+ FETCH: { method: "GET", useKey: true },+ DELETE: { method: "DELETE", useKey: true },+ };- cy.request({- method: "POST",- url: `${base_url}/configs/${key}`,- headers: {- "Content-Type": "application/json",- "api-key": api_key,- },- body: {- key: key,- value: value,- },- failOnStatusCode: false,- }).then((response) => {- logRequestId(response.headers["x-request-id"]);+ const config = REQUEST_CONFIG[requestType];+ if (!config) {+ throw new Error(`Invalid requestType: ${requestType}`);+ }- expect(response.status).to.equal(200);- expect(response.body).to.have.property("key").to.equal(key);- expect(response.body).to.have.property("value").to.equal(value);- });-});+ const apiKey = globalState.get("adminApiKey");+ const baseUrl = globalState.get("baseUrl");+ const url = `${baseUrl}/configs/${config.useKey ? key : ""}`;-Cypress.Commands.add("deleteConfigs", (globalState, key, value) => {- const base_url = globalState.get("baseUrl");- const api_key = globalState.get("adminApiKey");+ const getRequestBody = {+ CREATE: () => ({ key, value }),+ UPDATE: () => ({ value }),+ };+ const body = getRequestBody[requestType]?.() || undefined;cy.request({- method: "DELETE",- url: `${base_url}/configs/${key}`,+ method: config.method,+ url,headers: {"Content-Type": "application/json",- "api-key": api_key,+ "api-key": apiKey,},+ ...(body && { body }),failOnStatusCode: false,}).then((response) => {logRequestId(response.headers["x-request-id"]);- expect(response.status).to.equal(200);- expect(response.body).to.have.property("key").to.equal(key);- expect(response.body).to.have.property("value").to.equal(value);+ if (response.status === 200) {+ expect(response.body).to.have.property("key").to.equal(key);+ expect(response.body).to.have.property("value").to.equal(value);+ } else {+ throw new Error(+ `Failed to set configs with status ${response.status} and message ${response.body.error.message}`+ );+ }});});diff --git a/cypress-tests/cypress/utils/RequestBodyUtils.js b/cypress-tests/cypress/utils/RequestBodyUtils.jsindex 9b9015cad8..b637855175 100644--- a/cypress-tests/cypress/utils/RequestBodyUtils.js+++ b/cypress-tests/cypress/utils/RequestBodyUtils.js@@ -1,3 +1,18 @@+const keyPrefixes = {+ localhost: {+ publishable_key: "pk_dev_",+ key_id: "dev_",+ },+ integ: {+ publishable_key: "pk_snd_",+ key_id: "snd_",+ },+ sandbox: {+ publishable_key: "pk_snd_",+ key_id: "snd_",+ },+};+export const setClientSecret = (requestBody, clientSecret) => {requestBody["client_secret"] = clientSecret;};@@ -25,3 +40,37 @@ export const generateRandomString = (prefix = "cyMerchant") => {export const setMerchantId = (merchantCreateBody, merchantId) => {merchantCreateBody["merchant_id"] = merchantId;};++export function isoTimeTomorrow() {+ const now = new Date();++ // Create a new date object for tomorrow+ const tomorrow = new Date(now);+ tomorrow.setDate(now.getDate() + 1);++ // Convert to ISO string format+ const isoStringTomorrow = tomorrow.toISOString();+ return isoStringTomorrow;+}++export function validateEnv(baseUrl, keyIdType) {+ if (!baseUrl) {+ throw new Error("Please provide a baseUrl");+ }++ const environment = Object.keys(keyPrefixes).find((env) =>+ baseUrl.includes(env)+ );++ if (!environment) {+ throw new Error("Unsupported baseUrl");+ }++ const prefix = keyPrefixes[environment][keyIdType];++ if (!prefix) {+ throw new Error(`Unsupported keyIdType: ${keyIdType}`);+ }++ return prefix;+}diff --git a/cypress-tests/package.json b/cypress-tests/package.jsonindex 2f2f2c692c..a2e0a961e8 100644--- a/cypress-tests/package.json+++ b/cypress-tests/package.json@@ -8,10 +8,11 @@"cypress": "npx cypress open","cypress-e2e": "npx cypress run --e2e","cypress:ci": "npx cypress run --headless",- "cypress:payments": "cypress run --headless --spec 'cypress/e2e/PaymentTest/**/*'",- "cypress:payouts": "cypress run --headless --spec 'cypress/e2e/PayoutTest/**/*'",- "cypress:payment-method-list": "cypress run --headless --spec 'cypress/e2e/PaymentMethodListTest/**/*'",- "cypress:routing": "cypress run --headless --spec 'cypress/e2e/RoutingTest/**/*'",+ "cypress:misc": "cypress run --headless --spec 'cypress/e2e/spec/Misc/**/*'",+ "cypress:payment-method-list": "cypress run --headless --spec 'cypress/e2e/spec/PaymentMethodList/**/*'",+ "cypress:payments": "cypress run --headless --spec 'cypress/e2e/spec/Payment/**/*'",+ "cypress:payouts": "cypress run --headless --spec 'cypress/e2e/spec/Payout/**/*'",+ "cypress:routing": "cypress run --headless --spec 'cypress/e2e/spec/Routing/**/*'","format": "prettier --config .prettierrc . --write","format:check": "prettier --config .prettierrc . --check","lint": "eslint ."