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 95fa82f9675a..7d66827ecd2b 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 "./_Reusable"; 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 998c6b91f7bc..c7c00207c28f 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 "./_Reusable"; 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 6877d609ac15..9c42945479a0 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 { getCustomExchange } from "./_Reusable"; +import { connectorDetails as commonConnectorDetails } from "./Commons"; 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/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/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 b30e989a2b73..e632df804402 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 "./_Reusable"; 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 8d4d94fa5635..aa20764c54fe 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 "./_Reusable"; 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 6c4db9df329b..51ac724ab2e7 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 "./_Reusable"; 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 72bd6451347a..a4a62a6f8070 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 a58bbb22f81d..77d0867117eb 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 "./_Reusable"; const billing = { address: { diff --git a/cypress-tests/cypress/e2e/configs/Payment/_Reusable.js b/cypress-tests/cypress/e2e/configs/Payment/_Reusable.js new file mode 100644 index 000000000000..a2fa7642e74c --- /dev/null +++ b/cypress-tests/cypress/e2e/configs/Payment/_Reusable.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/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 ecd85b051511..77ccba8e6715 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 "./_Reusable"; 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/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 4cd122782f21..c97e29e644c2 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/configs/Payout/_Reusable.js b/cypress-tests/cypress/e2e/configs/Payout/_Reusable.js new file mode 100644 index 000000000000..514f7135a63f --- /dev/null +++ b/cypress-tests/cypress/e2e/configs/Payout/_Reusable.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/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 21e885ac137c..e00e3d6ccbbf 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/PaymentTest/00028-MemoryCacheConfigs.cy.js b/cypress-tests/cypress/e2e/spec/Misc/00000-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/00000-MemoryCacheConfigs.cy.js index afa7ceda0d13..476603e541e9 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00028-MemoryCacheConfigs.cy.js +++ b/cypress-tests/cypress/e2e/spec/Misc/00000-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, value, "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 a0e2ad643e89..b64bfc42546b 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 1788a369faf6..8557c6c3c8ec 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 cfc55ceef9df..ca64eb0c3f2c 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 3d002740e60e..cde959ad8ea5 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 e5030647cb7c..c2f5bb108286 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 3a0b635f79a2..715d42386796 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 d9769daab4b6..f82284b569fd 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 0050aa39bfc1..342b5cc423bc 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 370d811ed628..c7da98909a92 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 4d534127ada2..1d7ac32f0bad 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 dc7386211666..db63105d830e 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 da2123d64623..6fa01f91991f 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 000d69c45e68..2af0b801d2d9 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 b8d0a51879de..f3704b84f973 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 bab24076f550..26c250a3237f 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 0cc1be503189..ba522b3cd71c 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 0426d17013ce..89d82f7fb934 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 913dd91ea8be..49f93aaa10f0 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 cc3b8dbaec76..4a7fc8403622 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 1a2dff1b5da3..ec8ddc6c7002 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 e3080d39878e..1554436abfb2 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 e7a06c622489..d6b1c99407f5 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 be594e764871..f1499dc93bd0 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 28262d025c4d..d88be298896a 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 db5757e464cb..4db0ad99900c 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 100% rename from cypress-tests/cypress/e2e/PaymentTest/00024-SessionCall.cy.js rename to cypress-tests/cypress/e2e/spec/Payment/00025-SessionCall.cy.js 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 b1ccc55ccb34..e6e6030d1b9e 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 a325ac5f2f0d..9bbf07b8808c 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 e281fc0a2f7a..76116acc2be0 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 0f754831d46e..292f5d06790c 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 75cc93a49844..4b04db2ae019 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 cfc55ceef9df..ca64eb0c3f2c 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 8bcff83685e0..ec7ee369930b 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 fd9b9d9f6e27..694a26b703c1 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 0cb4508ded82..174b257a4821 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 37dc1c2cdf0f..30ad8e6bf8d3 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 97% rename from cypress-tests/cypress/e2e/RoutingTest/00000-PriorityRouting.cy.js rename to cypress-tests/cypress/e2e/spec/Routing/00000-PriorityRouting.cy.js index 22e4b3783af1..79d9bff717e2 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; 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 97% rename from cypress-tests/cypress/e2e/RoutingTest/00001-VolumeBasedRouting.cy.js rename to cypress-tests/cypress/e2e/spec/Routing/00001-VolumeBasedRouting.cy.js index 7d7f75e3519b..a2b41af3849d 100644 --- a/cypress-tests/cypress/e2e/RoutingTest/00001-VolumeBasedRouting.cy.js +++ b/cypress-tests/cypress/e2e/spec/Routing/00001-VolumeBasedRouting.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; 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 98% rename from cypress-tests/cypress/e2e/RoutingTest/00002-RuleBasedRouting.cy.js rename to cypress-tests/cypress/e2e/spec/Routing/00002-RuleBasedRouting.cy.js index 304668752cd1..01852ea6ecab 100644 --- a/cypress-tests/cypress/e2e/RoutingTest/00002-RuleBasedRouting.cy.js +++ b/cypress-tests/cypress/e2e/spec/Routing/00002-RuleBasedRouting.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; 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 83% rename from cypress-tests/cypress/e2e/RoutingTest/00003-Retries.cy.js rename to cypress-tests/cypress/e2e/spec/Routing/00003-Retries.cy.js index 74c02d7ac9fd..c2d02c3de4eb 100644 --- a/cypress-tests/cypress/e2e/RoutingTest/00003-Retries.cy.js +++ b/cypress-tests/cypress/e2e/spec/Routing/00003-Retries.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; @@ -42,7 +42,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", () => { @@ -93,9 +99,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", () => { @@ -133,16 +145,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", () => { @@ -180,15 +198,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", () => { @@ -226,7 +250,7 @@ describe("Auto Retries & Step Up 3DS", () => { globalState, null, true, - max_auto_retries + 1 + maxAutoRetries + 1 ); }); }); @@ -280,9 +304,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", () => { @@ -320,16 +350,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", () => { @@ -367,16 +403,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", () => { @@ -414,7 +456,7 @@ describe("Auto Retries & Step Up 3DS", () => { globalState, null, true, - max_auto_retries + 1 + maxAutoRetries + 1 ); }); }); @@ -429,14 +471,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", () => { @@ -468,7 +522,7 @@ describe("Auto Retries & Step Up 3DS", () => { globalState, null, true, - max_auto_retries + 1 + maxAutoRetries + 1 ); }); }); @@ -477,7 +531,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 21f3f982fc02..93a97e18ee58 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,8 +45,8 @@ 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; } } @@ -297,34 +298,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 +372,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}"` + ); + } }); }); @@ -3251,56 +3296,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 || {}; @@ -3367,94 +3362,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 9b9015cad83d..b6378551751d 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 7032a72fb084..8d2afe5aae49 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 ."