Skip to content

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

refactor(cypress): move memory cache tests out of payment for misc (#6992)

Pa1NarK4382fc650ae5
diff --git a/cypress-tests/README.md b/cypress-tests/README.md
index 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
+### Installation
1. 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 Tests
Execution 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)
```shell
npm run cypress
```
-### CI Mode (Headless)
+#### CI Mode (Headless)
```shell
# All tests
npm 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 tests
npm run cypress:payouts # Payout tests
npm run cypress:routing # Routing tests
```
-### Execute tests against multiple connectors or in parallel
+#### Execute tests against multiple connectors or in parallel
1. 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.js
similarity index 99%
rename from cypress-tests/cypress/e2e/PaymentUtils/Adyen.js
rename to cypress-tests/cypress/e2e/configs/Payment/Adyen.js
index 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.js
similarity index 100%
rename from cypress-tests/cypress/e2e/PaymentUtils/BankOfAmerica.js
rename to cypress-tests/cypress/e2e/configs/Payment/BankOfAmerica.js
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Bluesnap.js b/cypress-tests/cypress/e2e/configs/Payment/Bluesnap.js
similarity index 100%
rename from cypress-tests/cypress/e2e/PaymentUtils/Bluesnap.js
rename to cypress-tests/cypress/e2e/configs/Payment/Bluesnap.js
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Checkout.js b/cypress-tests/cypress/e2e/configs/Payment/Checkout.js
similarity index 100%
rename from cypress-tests/cypress/e2e/PaymentUtils/Checkout.js
rename to cypress-tests/cypress/e2e/configs/Payment/Checkout.js
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
similarity index 94%
rename from cypress-tests/cypress/e2e/PaymentUtils/Commons.js
rename to cypress-tests/cypress/e2e/configs/Payment/Commons.js
index 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.js
similarity index 99%
rename from cypress-tests/cypress/e2e/PaymentUtils/Cybersource.js
rename to cypress-tests/cypress/e2e/configs/Payment/Cybersource.js
index 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.js
similarity index 100%
rename from cypress-tests/cypress/e2e/PaymentUtils/Datatrans.js
rename to cypress-tests/cypress/e2e/configs/Payment/Datatrans.js
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Deutschebank.js b/cypress-tests/cypress/e2e/configs/Payment/Deutschebank.js
similarity index 100%
rename from cypress-tests/cypress/e2e/PaymentUtils/Deutschebank.js
rename to cypress-tests/cypress/e2e/configs/Payment/Deutschebank.js
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Elavon.js b/cypress-tests/cypress/e2e/configs/Payment/Elavon.js
similarity index 100%
rename from cypress-tests/cypress/e2e/PaymentUtils/Elavon.js
rename to cypress-tests/cypress/e2e/configs/Payment/Elavon.js
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Fiservemea.js b/cypress-tests/cypress/e2e/configs/Payment/Fiservemea.js
similarity index 100%
rename from cypress-tests/cypress/e2e/PaymentUtils/Fiservemea.js
rename to cypress-tests/cypress/e2e/configs/Payment/Fiservemea.js
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Fiuu.js b/cypress-tests/cypress/e2e/configs/Payment/Fiuu.js
similarity index 100%
rename from cypress-tests/cypress/e2e/PaymentUtils/Fiuu.js
rename to cypress-tests/cypress/e2e/configs/Payment/Fiuu.js
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Iatapay.js b/cypress-tests/cypress/e2e/configs/Payment/Iatapay.js
similarity index 100%
rename from cypress-tests/cypress/e2e/PaymentUtils/Iatapay.js
rename to cypress-tests/cypress/e2e/configs/Payment/Iatapay.js
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/ItauBank.js b/cypress-tests/cypress/e2e/configs/Payment/ItauBank.js
similarity index 100%
rename from cypress-tests/cypress/e2e/PaymentUtils/ItauBank.js
rename to cypress-tests/cypress/e2e/configs/Payment/ItauBank.js
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Jpmorgan.js b/cypress-tests/cypress/e2e/configs/Payment/Jpmorgan.js
similarity index 100%
rename from cypress-tests/cypress/e2e/PaymentUtils/Jpmorgan.js
rename to cypress-tests/cypress/e2e/configs/Payment/Jpmorgan.js
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js b/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js
new file mode 100644
index 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.js
similarity index 100%
rename from cypress-tests/cypress/e2e/PaymentUtils/Nexixpay.js
rename to cypress-tests/cypress/e2e/configs/Payment/Nexixpay.js
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Nmi.js b/cypress-tests/cypress/e2e/configs/Payment/Nmi.js
similarity index 100%
rename from cypress-tests/cypress/e2e/PaymentUtils/Nmi.js
rename to cypress-tests/cypress/e2e/configs/Payment/Nmi.js
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Noon.js b/cypress-tests/cypress/e2e/configs/Payment/Noon.js
similarity index 100%
rename from cypress-tests/cypress/e2e/PaymentUtils/Noon.js
rename to cypress-tests/cypress/e2e/configs/Payment/Noon.js
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Novalnet.js b/cypress-tests/cypress/e2e/configs/Payment/Novalnet.js
similarity index 100%
rename from cypress-tests/cypress/e2e/PaymentUtils/Novalnet.js
rename to cypress-tests/cypress/e2e/configs/Payment/Novalnet.js
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Paybox.js b/cypress-tests/cypress/e2e/configs/Payment/Paybox.js
similarity index 100%
rename from cypress-tests/cypress/e2e/PaymentUtils/Paybox.js
rename to cypress-tests/cypress/e2e/configs/Payment/Paybox.js
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Paypal.js b/cypress-tests/cypress/e2e/configs/Payment/Paypal.js
similarity index 99%
rename from cypress-tests/cypress/e2e/PaymentUtils/Paypal.js
rename to cypress-tests/cypress/e2e/configs/Payment/Paypal.js
index 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.js
similarity index 99%
rename from cypress-tests/cypress/e2e/PaymentUtils/Stripe.js
rename to cypress-tests/cypress/e2e/configs/Payment/Stripe.js
index 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.js
similarity index 99%
rename from cypress-tests/cypress/e2e/PaymentUtils/Trustpay.js
rename to cypress-tests/cypress/e2e/configs/Payment/Trustpay.js
index 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.js
similarity index 99%
rename from cypress-tests/cypress/e2e/PaymentUtils/Utils.js
rename to cypress-tests/cypress/e2e/configs/Payment/Utils.js
index 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.js
similarity index 100%
rename from cypress-tests/cypress/e2e/PaymentUtils/WellsFargo.js
rename to cypress-tests/cypress/e2e/configs/Payment/WellsFargo.js
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/WorldPay.js b/cypress-tests/cypress/e2e/configs/Payment/WorldPay.js
similarity index 99%
rename from cypress-tests/cypress/e2e/PaymentUtils/WorldPay.js
rename to cypress-tests/cypress/e2e/configs/Payment/WorldPay.js
index 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.js
similarity index 100%
rename from cypress-tests/cypress/e2e/PaymentUtils/Xendit.js
rename to cypress-tests/cypress/e2e/configs/Payment/Xendit.js
diff --git a/cypress-tests/cypress/e2e/PaymentMethodListUtils/Commons.js b/cypress-tests/cypress/e2e/configs/PaymentMethodList/Commons.js
similarity index 100%
rename from cypress-tests/cypress/e2e/PaymentMethodListUtils/Commons.js
rename to cypress-tests/cypress/e2e/configs/PaymentMethodList/Commons.js
diff --git a/cypress-tests/cypress/e2e/PaymentMethodListUtils/Connector.js b/cypress-tests/cypress/e2e/configs/PaymentMethodList/Connector.js
similarity index 100%
rename from cypress-tests/cypress/e2e/PaymentMethodListUtils/Connector.js
rename to cypress-tests/cypress/e2e/configs/PaymentMethodList/Connector.js
diff --git a/cypress-tests/cypress/e2e/PaymentMethodListUtils/Utils.js b/cypress-tests/cypress/e2e/configs/PaymentMethodList/Utils.js
similarity index 100%
rename from cypress-tests/cypress/e2e/PaymentMethodListUtils/Utils.js
rename to cypress-tests/cypress/e2e/configs/PaymentMethodList/Utils.js
diff --git a/cypress-tests/cypress/e2e/PayoutUtils/Adyen.js b/cypress-tests/cypress/e2e/configs/Payout/Adyen.js
similarity index 100%
rename from cypress-tests/cypress/e2e/PayoutUtils/Adyen.js
rename to cypress-tests/cypress/e2e/configs/Payout/Adyen.js
diff --git a/cypress-tests/cypress/e2e/PayoutUtils/AdyenPlatform.js b/cypress-tests/cypress/e2e/configs/Payout/AdyenPlatform.js
similarity index 100%
rename from cypress-tests/cypress/e2e/PayoutUtils/AdyenPlatform.js
rename to cypress-tests/cypress/e2e/configs/Payout/AdyenPlatform.js
diff --git a/cypress-tests/cypress/e2e/PayoutUtils/Commons.js b/cypress-tests/cypress/e2e/configs/Payout/Commons.js
similarity index 62%
rename from cypress-tests/cypress/e2e/PayoutUtils/Commons.js
rename to cypress-tests/cypress/e2e/configs/Payout/Commons.js
index 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.js
new file mode 100644
index 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.js
similarity index 97%
rename from cypress-tests/cypress/e2e/PayoutUtils/Utils.js
rename to cypress-tests/cypress/e2e/configs/Payout/Utils.js
index 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.js
similarity index 100%
rename from cypress-tests/cypress/e2e/PayoutUtils/Wise.js
rename to cypress-tests/cypress/e2e/configs/Payout/Wise.js
diff --git a/cypress-tests/cypress/e2e/RoutingUtils/Adyen.js b/cypress-tests/cypress/e2e/configs/Routing/Adyen.js
similarity index 100%
rename from cypress-tests/cypress/e2e/RoutingUtils/Adyen.js
rename to cypress-tests/cypress/e2e/configs/Routing/Adyen.js
diff --git a/cypress-tests/cypress/e2e/RoutingUtils/Autoretries.js b/cypress-tests/cypress/e2e/configs/Routing/Autoretries.js
similarity index 100%
rename from cypress-tests/cypress/e2e/RoutingUtils/Autoretries.js
rename to cypress-tests/cypress/e2e/configs/Routing/Autoretries.js
diff --git a/cypress-tests/cypress/e2e/RoutingUtils/Commons.js b/cypress-tests/cypress/e2e/configs/Routing/Commons.js
similarity index 100%
rename from cypress-tests/cypress/e2e/RoutingUtils/Commons.js
rename to cypress-tests/cypress/e2e/configs/Routing/Commons.js
diff --git a/cypress-tests/cypress/e2e/RoutingUtils/Stripe.js b/cypress-tests/cypress/e2e/configs/Routing/Stripe.js
similarity index 99%
rename from cypress-tests/cypress/e2e/RoutingUtils/Stripe.js
rename to cypress-tests/cypress/e2e/configs/Routing/Stripe.js
index 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.js
similarity index 100%
rename from cypress-tests/cypress/e2e/RoutingUtils/Utils.js
rename to cypress-tests/cypress/e2e/configs/Routing/Utils.js
diff --git a/cypress-tests/cypress/e2e/spec/Misc/00000-HealthCheck.cy.js b/cypress-tests/cypress/e2e/spec/Misc/00000-HealthCheck.cy.js
new file mode 100644
index 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.js
similarity index 58%
rename from cypress-tests/cypress/e2e/PaymentTest/00028-MemoryCacheConfigs.cy.js
rename to cypress-tests/cypress/e2e/spec/Misc/00001-MemoryCacheConfigs.cy.js
index 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.js
similarity index 96%
rename from cypress-tests/cypress/e2e/PaymentTest/00000-CoreFlows.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00000-CoreFlows.cy.js
index 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.js
similarity index 84%
rename from cypress-tests/cypress/e2e/PaymentTest/00001-AccountCreate.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00001-AccountCreate.cy.js
index 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.js
similarity index 81%
rename from cypress-tests/cypress/e2e/PaymentTest/00002-CustomerCreate.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00002-CustomerCreate.cy.js
index 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.js
similarity index 84%
rename from cypress-tests/cypress/e2e/PaymentTest/00003-ConnectorCreate.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00003-ConnectorCreate.cy.js
index 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.js
similarity index 95%
rename from cypress-tests/cypress/e2e/PaymentTest/00004-NoThreeDSAutoCapture.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00004-NoThreeDSAutoCapture.cy.js
index 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.js
similarity index 89%
rename from cypress-tests/cypress/e2e/PaymentTest/00005-ThreeDSAutoCapture.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00005-ThreeDSAutoCapture.cy.js
index 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.js
similarity index 97%
rename from cypress-tests/cypress/e2e/PaymentTest/00006-NoThreeDSManualCapture.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00006-NoThreeDSManualCapture.cy.js
index 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.js
similarity index 96%
rename from cypress-tests/cypress/e2e/PaymentTest/00007-VoidPayment.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00007-VoidPayment.cy.js
index 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.js
similarity index 89%
rename from cypress-tests/cypress/e2e/PaymentTest/00008-SyncPayment.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00008-SyncPayment.cy.js
index 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.js
similarity index 99%
rename from cypress-tests/cypress/e2e/PaymentTest/00009-RefundPayment.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00009-RefundPayment.cy.js
index 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.js
similarity index 92%
rename from cypress-tests/cypress/e2e/PaymentTest/00010-SyncRefund.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00010-SyncRefund.cy.js
index 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.js
similarity index 96%
rename from cypress-tests/cypress/e2e/PaymentTest/00011-CreateSingleuseMandate.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00011-CreateSingleuseMandate.cy.js
index 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.js
similarity index 97%
rename from cypress-tests/cypress/e2e/PaymentTest/00012-CreateMultiuseMandate.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00012-CreateMultiuseMandate.cy.js
index 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.js
similarity index 94%
rename from cypress-tests/cypress/e2e/PaymentTest/00013-ListAndRevokeMandate.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00013-ListAndRevokeMandate.cy.js
index 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.js
similarity index 99%
rename from cypress-tests/cypress/e2e/PaymentTest/00014-SaveCardFlow.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00014-SaveCardFlow.cy.js
index 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.js
similarity index 96%
rename from cypress-tests/cypress/e2e/PaymentTest/00015-ZeroAuthMandate.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00015-ZeroAuthMandate.cy.js
index 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.js
similarity index 94%
rename from cypress-tests/cypress/e2e/PaymentTest/00016-ThreeDSManualCapture.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00016-ThreeDSManualCapture.cy.js
index 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.js
similarity index 91%
rename from cypress-tests/cypress/e2e/PaymentTest/00017-BankTransfers.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00017-BankTransfers.cy.js
index 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.js
similarity index 97%
rename from cypress-tests/cypress/e2e/PaymentTest/00018-BankRedirect.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00018-BankRedirect.cy.js
index 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.js
similarity index 98%
rename from cypress-tests/cypress/e2e/PaymentTest/00019-MandatesUsingPMID.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00019-MandatesUsingPMID.cy.js
index 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.js
similarity index 96%
rename from cypress-tests/cypress/e2e/PaymentTest/00020-MandatesUsingNTIDProxy.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00020-MandatesUsingNTIDProxy.cy.js
index 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.js
similarity index 96%
rename from cypress-tests/cypress/e2e/PaymentTest/00021-UPI.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00021-UPI.cy.js
index 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.js
similarity index 99%
rename from cypress-tests/cypress/e2e/PaymentTest/00022-Variations.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00022-Variations.cy.js
index 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.js
similarity index 94%
rename from cypress-tests/cypress/e2e/PaymentTest/00023-PaymentMethods.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00023-PaymentMethods.cy.js
index 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.js
similarity index 97%
rename from cypress-tests/cypress/e2e/PaymentTest/00024-ConnectorAgnosticNTID.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00024-ConnectorAgnosticNTID.cy.js
index 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.js
similarity index 87%
rename from cypress-tests/cypress/e2e/PaymentTest/00024-SessionCall.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00025-SessionCall.cy.js
index 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.js
similarity index 97%
rename from cypress-tests/cypress/e2e/PaymentTest/00025-BusinessProfileConfigs.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00026-BusinessProfileConfigs.cy.js
index 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.js
similarity index 95%
rename from cypress-tests/cypress/e2e/PaymentTest/00026-DynamicFields.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00027-DynamicFields.cy.js
index 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.js
similarity index 95%
rename from cypress-tests/cypress/e2e/PaymentTest/00027-IncrementalAuth.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/00028-IncrementalAuth.cy.js
index 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.js
similarity index 99%
rename from cypress-tests/cypress/e2e/PaymentMethodListTest/00000-PaymentMethodListTests.cy.js
rename to cypress-tests/cypress/e2e/spec/PaymentMethodList/00000-PaymentMethodListTests.cy.js
index 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.js
similarity index 84%
rename from cypress-tests/cypress/e2e/PayoutTest/00000-AccountCreate.cy.js
rename to cypress-tests/cypress/e2e/spec/Payout/00000-AccountCreate.cy.js
index 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.js
similarity index 81%
rename from cypress-tests/cypress/e2e/PayoutTest/00001-CustomerCreate.cy.js
rename to cypress-tests/cypress/e2e/spec/Payout/00001-CustomerCreate.cy.js
index 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.js
similarity index 83%
rename from cypress-tests/cypress/e2e/PayoutTest/00002-ConnectorCreate.cy.js
rename to cypress-tests/cypress/e2e/spec/Payout/00002-ConnectorCreate.cy.js
index 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.js
similarity index 94%
rename from cypress-tests/cypress/e2e/PayoutTest/00003-CardTest.cy.js
rename to cypress-tests/cypress/e2e/spec/Payout/00003-CardTest.cy.js
index 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.js
similarity index 96%
rename from cypress-tests/cypress/e2e/PayoutTest/00004-BankTransfer.cy.js
rename to cypress-tests/cypress/e2e/spec/Payout/00004-BankTransfer.cy.js
index 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.js
similarity index 97%
rename from cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.js
rename to cypress-tests/cypress/e2e/spec/Payout/00005-SavePayout.cy.js
index 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.js
similarity index 84%
rename from cypress-tests/cypress/e2e/RoutingTest/00000-PriorityRouting.cy.js
rename to cypress-tests/cypress/e2e/spec/Routing/00000-PriorityRouting.cy.js
index 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 exists
cy.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.js
similarity index 87%
rename from cypress-tests/cypress/e2e/RoutingTest/00001-VolumeBasedRouting.cy.js
rename to cypress-tests/cypress/e2e/spec/Routing/00001-VolumeBasedRouting.cy.js
index 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 exists
beforeEach(() => {
- // Restore the session if it exists
cy.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.js
similarity index 93%
rename from cypress-tests/cypress/e2e/RoutingTest/00002-RuleBasedRouting.cy.js
rename to cypress-tests/cypress/e2e/spec/Routing/00002-RuleBasedRouting.cy.js
index 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 exists
beforeEach(() => {
- // Restore the session if it exists
cy.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.js
similarity index 79%
rename from cypress-tests/cypress/e2e/RoutingTest/00003-Retries.cy.js
rename to cypress-tests/cypress/e2e/spec/Routing/00003-Retries.cy.js
index 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 exists
beforeEach(() => {
- // Restore the session if it exists
cy.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.js
index 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 calls
Cypress.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 constant
const 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.js
index 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.json
index 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 ."