From 9796ab4c45a88b82eb354454d58d689b95fb4819 Mon Sep 17 00:00:00 2001 From: PiX <69745008+pixincreate@users.noreply.github.com> Date: Tue, 2 Jul 2024 22:07:36 +0530 Subject: [PATCH 1/4] refactor(cypress): unify fixtures in tests --- .../e2e/PaymentTest/00000-AccountCreate.cy.js | 7 +- .../PaymentTest/00001-CustomerCreate.cy.js | 4 +- .../PaymentTest/00002-ConnectorCreate.cy.js | 4 +- .../00003-NoThreeDSAutoCapture.cy.js | 19 +- .../00004-ThreeDSAutoCapture.cy.js | 15 +- .../00005-NoThreeDSManualCapture.cy.js | 51 ++- .../e2e/PaymentTest/00006-VoidPayment.cy.js | 35 +- .../e2e/PaymentTest/00007-SyncPayment.cy.js | 13 +- .../e2e/PaymentTest/00008-RefundPayment.cy.js | 409 ++++++++++++++---- .../e2e/PaymentTest/00009-SyncRefund.cy.js | 25 +- .../00010-CreateSingleuseMandate.cy.js | 43 +- .../00011-CreateMultiuseMandate.cy.js | 52 ++- .../00012-ListAndRevokeMandate.cy.js | 11 +- .../e2e/PaymentTest/00013-SaveCardFlow.cy.js | 48 +- .../PaymentTest/00014-ZeroAuthMandate.cy.js | 13 +- .../00015-ThreeDSManualCapture.cy.js | 32 +- .../e2e/PaymentTest/00016-BankTransfers.cy.js | 9 +- .../e2e/PaymentTest/00017-BankRedirect.cy.js | 37 +- .../PaymentTest/00018-MandatesUsingPMID.cy.js | 137 ++++-- .../cypress/e2e/PaymentTest/00019-UPI.cy.js | 36 +- .../e2e/PayoutTest/00000-AccountCreate.cy.js | 8 +- .../e2e/PayoutTest/00001-CustomerCreate.cy.js | 4 +- .../PayoutTest/00002-ConnectorCreate.cy.js | 4 +- .../e2e/PayoutTest/00003-CardTest.cy.js | 8 +- .../e2e/PayoutTest/00004-BankTransfer.cy.js | 10 +- .../e2e/PayoutTest/00005-SavePayout.cy.js | 17 +- .../00000-PaymentRoutingTest.cy.js | 13 +- cypress-tests/cypress/fixtures/imports.js | 41 ++ 28 files changed, 799 insertions(+), 306 deletions(-) create mode 100644 cypress-tests/cypress/fixtures/imports.js diff --git a/cypress-tests/cypress/e2e/PaymentTest/00000-AccountCreate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00000-AccountCreate.cy.js index 821a22bed3cb..5753421a7458 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00000-AccountCreate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00000-AccountCreate.cy.js @@ -1,6 +1,5 @@ -import apiKeyCreateBody from "../../fixtures/create-api-key-body.json"; -import merchantCreateBody from "../../fixtures/merchant-create-body.json"; import State from "../../utils/State"; +import * as fixtures from "../../fixtures/imports"; let globalState; describe("Account Create flow test", () => { @@ -15,10 +14,10 @@ describe("Account Create flow test", () => { }); it("merchant-create-call-test", () => { - cy.merchantCreateCallTest(merchantCreateBody, globalState); + cy.merchantCreateCallTest(fixtures.merchantCreateBody, globalState); }); it("api-key-create-call-test", () => { - cy.apiKeyCreateTest(apiKeyCreateBody, globalState); + cy.apiKeyCreateTest(fixtures.apiKeyCreateBody, globalState); }); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00001-CustomerCreate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00001-CustomerCreate.cy.js index d51a2f78ae95..cfc55ceef9df 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00001-CustomerCreate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00001-CustomerCreate.cy.js @@ -1,4 +1,4 @@ -import customerCreateBody from "../../fixtures/create-customer-body.json"; +import * as fixtures from "../../fixtures/imports"; import State from "../../utils/State"; let globalState; @@ -15,6 +15,6 @@ describe("Customer Create flow test", () => { }); it("customer-create-call-test", () => { - cy.createCustomerCallTest(customerCreateBody, globalState); + cy.createCustomerCallTest(fixtures.customerCreateBody, globalState); }); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00002-ConnectorCreate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00002-ConnectorCreate.cy.js index 439850d4cc29..0174fd4ef601 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00002-ConnectorCreate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00002-ConnectorCreate.cy.js @@ -1,4 +1,4 @@ -import createConnectorBody from "../../fixtures/create-connector-body.json"; +import * as fixtures from "../../fixtures/imports"; import State from "../../utils/State"; import { payment_methods_enabled } from "../PaymentUtils/Commons"; @@ -16,7 +16,7 @@ describe("Connector Account Create flow test", () => { it("connector-create-call-test", () => { cy.createConnectorCallTest( - createConnectorBody, + fixtures.createConnectorBody, payment_methods_enabled, globalState ); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00003-NoThreeDSAutoCapture.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00003-NoThreeDSAutoCapture.cy.js index 49250e68d656..80f15230e13d 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00003-NoThreeDSAutoCapture.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00003-NoThreeDSAutoCapture.cy.js @@ -1,9 +1,6 @@ -import confirmBody from "../../fixtures/confirm-body.json"; -import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json"; -import createPaymentBody from "../../fixtures/create-payment-body.json"; +import * as fixtures from "../../fixtures/imports"; import State from "../../utils/State"; -import getConnectorDetails from "../PaymentUtils/utils"; -import * as utils from "../PaymentUtils/utils"; +import getConnectorDetails, * as utils from "../PaymentUtils/utils"; let globalState; @@ -34,7 +31,7 @@ describe("Card - NoThreeDS payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "no_three_ds", @@ -55,7 +52,13 @@ describe("Card - NoThreeDS payment flow test", () => { ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + cy.confirmCallTest( + fixtures.confirmBody, + req_data, + res_data, + true, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -82,7 +85,7 @@ describe("Card - NoThreeDS payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createConfirmPaymentTest( - createConfirmPaymentBody, + fixtures.createConfirmPaymentBody, req_data, res_data, "no_three_ds", diff --git a/cypress-tests/cypress/e2e/PaymentTest/00004-ThreeDSAutoCapture.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00004-ThreeDSAutoCapture.cy.js index c9fb1339b1cf..29a9ed6f7013 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00004-ThreeDSAutoCapture.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00004-ThreeDSAutoCapture.cy.js @@ -1,9 +1,8 @@ import confirmBody from "../../fixtures/confirm-body.json"; -import createPaymentBody from "../../fixtures/create-payment-body.json"; import State from "../../utils/State"; import getConnectorDetails from "../PaymentUtils/utils"; import * as utils from "../PaymentUtils/utils"; - +import * as fixtures from "../../fixtures/imports"; let globalState; describe("Card - ThreeDS payment flow test", () => { @@ -32,7 +31,7 @@ describe("Card - ThreeDS payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "three_ds", @@ -53,13 +52,19 @@ describe("Card - ThreeDS payment flow test", () => { ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + cy.confirmCallTest( + fixtures.confirmBody, + req_data, + res_data, + true, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); it("Handle redirection", () => { - let expected_redirection = confirmBody["return_url"]; + let expected_redirection = fixtures.confirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00005-NoThreeDSManualCapture.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00005-NoThreeDSManualCapture.cy.js index bcd65753ace6..9888d207085d 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00005-NoThreeDSManualCapture.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00005-NoThreeDSManualCapture.cy.js @@ -5,6 +5,7 @@ import createPaymentBody from "../../fixtures/create-payment-body.json"; import State from "../../utils/State"; import getConnectorDetails from "../PaymentUtils/utils"; import * as utils from "../PaymentUtils/utils"; +import * as fixtures from "../../fixtures/imports"; let globalState; @@ -36,7 +37,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "no_three_ds", @@ -59,7 +60,13 @@ describe("Card - NoThreeDS Manual payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + cy.confirmCallTest( + fixtures.confirmBody, + req_data, + res_data, + true, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -75,7 +82,13 @@ describe("Card - NoThreeDS Manual payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 6500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -103,7 +116,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => { let res_data = data["Response"]; console.log("det -> " + data.card); cy.createConfirmPaymentTest( - createConfirmPaymentBody, + fixtures.createConfirmPaymentBody, req_data, res_data, "no_three_ds", @@ -125,7 +138,13 @@ describe("Card - NoThreeDS Manual payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 6500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -155,7 +174,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "no_three_ds", @@ -179,7 +198,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => { let res_data = data["Response"]; console.log("det -> " + data.card); cy.confirmCallTest( - confirmBody, + fixtures.confirmBody, req_data, res_data, true, @@ -199,7 +218,13 @@ describe("Card - NoThreeDS Manual payment flow test", () => { ]["PartialCapture"]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.captureCallTest(captureBody, req_data, res_data, 100, globalState); + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 100, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -227,7 +252,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => { let res_data = data["Response"]; console.log("det -> " + data.card); cy.createConfirmPaymentTest( - createConfirmPaymentBody, + fixtures.createConfirmPaymentBody, req_data, res_data, "no_three_ds", @@ -249,7 +274,13 @@ describe("Card - NoThreeDS Manual payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.captureCallTest(captureBody, req_data, res_data, 100, globalState); + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 100, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00006-VoidPayment.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00006-VoidPayment.cy.js index 98ff9c5c15ed..edb897ce4e6f 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00006-VoidPayment.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00006-VoidPayment.cy.js @@ -1,9 +1,6 @@ -import confirmBody from "../../fixtures/confirm-body.json"; -import createPaymentBody from "../../fixtures/create-payment-body.json"; -import voidBody from "../../fixtures/void-payment-body.json"; +import * as fixtures from "../../fixtures/imports"; import State from "../../utils/State"; -import getConnectorDetails from "../PaymentUtils/utils"; -import * as utils from "../PaymentUtils/utils"; +import getConnectorDetails, * as utils from "../PaymentUtils/utils"; let globalState; @@ -34,7 +31,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "no_three_ds", @@ -57,7 +54,13 @@ describe("Card - NoThreeDS Manual payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + cy.confirmCallTest( + fixtures.confirmBody, + req_data, + res_data, + true, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -68,7 +71,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => { ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.voidCallTest(voidBody, req_data, res_data, globalState); + cy.voidCallTest(fixtures.voidBody, req_data, res_data, globalState); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -92,7 +95,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "no_three_ds", @@ -113,7 +116,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => { ]["Void"]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.voidCallTest(voidBody, req_data, res_data, globalState); + cy.voidCallTest(fixtures.voidBody, req_data, res_data, globalState); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -138,7 +141,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "no_three_ds", @@ -161,7 +164,13 @@ describe("Card - NoThreeDS Manual payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.confirmCallTest(confirmBody, req_data, res_data, false, globalState); + cy.confirmCallTest( + fixtures.confirmBody, + req_data, + res_data, + false, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -172,7 +181,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => { ]["Void"]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.voidCallTest(voidBody, req_data, res_data, globalState); + cy.voidCallTest(fixtures.voidBody, req_data, res_data, globalState); if (should_continue) should_continue = utils.should_continue_further(res_data); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00007-SyncPayment.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00007-SyncPayment.cy.js index 2d6174efbb61..7c259af02b6e 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00007-SyncPayment.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00007-SyncPayment.cy.js @@ -1,8 +1,7 @@ -import confirmBody from "../../fixtures/confirm-body.json"; -import createPaymentBody from "../../fixtures/create-payment-body.json"; import State from "../../utils/State"; import getConnectorDetails from "../PaymentUtils/utils"; import * as utils from "../PaymentUtils/utils"; +import * as fixtures from "../../fixtures/imports"; let globalState; @@ -31,7 +30,7 @@ describe("Card - Sync payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "no_three_ds", @@ -54,7 +53,13 @@ describe("Card - Sync payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + cy.confirmCallTest( + fixtures.confirmBody, + req_data, + res_data, + true, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00008-RefundPayment.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00008-RefundPayment.cy.js index 163607e42c4d..39c393a47cb6 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00008-RefundPayment.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00008-RefundPayment.cy.js @@ -1,11 +1,4 @@ -import captureBody from "../../fixtures/capture-flow-body.json"; -import confirmBody from "../../fixtures/confirm-body.json"; -import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json"; -import citConfirmBody from "../../fixtures/create-mandate-cit.json"; -import mitConfirmBody from "../../fixtures/create-mandate-mit.json"; -import createPaymentBody from "../../fixtures/create-payment-body.json"; -import listRefundCall from "../../fixtures/list-refund-call-body.json"; -import refundBody from "../../fixtures/refund-flow-body.json"; +import * as fixtures from "../../fixtures/imports"; import State from "../../utils/State"; import getConnectorDetails, * as utils from "../PaymentUtils/utils"; @@ -38,7 +31,7 @@ describe("Card - Refund flow - No 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "no_three_ds", @@ -61,7 +54,13 @@ describe("Card - Refund flow - No 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + cy.confirmCallTest( + fixtures.confirmBody, + req_data, + res_data, + true, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -76,7 +75,13 @@ describe("Card - Refund flow - No 3DS", () => { ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState); + cy.refundCallTest( + fixtures.refundBody, + req_data, + res_data, + 6500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -98,7 +103,7 @@ describe("Card - Refund flow - No 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "no_three_ds", @@ -121,7 +126,13 @@ describe("Card - Refund flow - No 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + cy.confirmCallTest( + fixtures.confirmBody, + req_data, + res_data, + true, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -136,7 +147,13 @@ describe("Card - Refund flow - No 3DS", () => { ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 1200, globalState); + cy.refundCallTest( + fixtures.refundBody, + req_data, + res_data, + 1200, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -147,7 +164,13 @@ describe("Card - Refund flow - No 3DS", () => { ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 1200, globalState); + cy.refundCallTest( + fixtures.refundBody, + req_data, + res_data, + 1200, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -172,7 +195,7 @@ describe("Card - Refund flow - No 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createConfirmPaymentTest( - createConfirmPaymentBody, + fixtures.createConfirmPaymentBody, req_data, res_data, "no_three_ds", @@ -193,7 +216,13 @@ describe("Card - Refund flow - No 3DS", () => { ]["Refund"]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState); + cy.refundCallTest( + fixtures.refundBody, + req_data, + res_data, + 6500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -219,7 +248,7 @@ describe("Card - Refund flow - No 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createConfirmPaymentTest( - createConfirmPaymentBody, + fixtures.createConfirmPaymentBody, req_data, res_data, "no_three_ds", @@ -240,7 +269,13 @@ describe("Card - Refund flow - No 3DS", () => { ]["PartialRefund"]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 3000, globalState); + cy.refundCallTest( + fixtures.refundBody, + req_data, + res_data, + 3000, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -251,7 +286,13 @@ describe("Card - Refund flow - No 3DS", () => { ]["PartialRefund"]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 3000, globalState); + cy.refundCallTest( + fixtures.refundBody, + req_data, + res_data, + 3000, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -285,7 +326,7 @@ describe("Card - Refund flow - No 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "no_three_ds", @@ -308,7 +349,13 @@ describe("Card - Refund flow - No 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + cy.confirmCallTest( + fixtures.confirmBody, + req_data, + res_data, + true, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -324,7 +371,13 @@ describe("Card - Refund flow - No 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 6500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -339,7 +392,13 @@ describe("Card - Refund flow - No 3DS", () => { ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState); + cy.refundCallTest( + fixtures.refundBody, + req_data, + res_data, + 6500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -372,7 +431,7 @@ describe("Card - Refund flow - No 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "no_three_ds", @@ -395,7 +454,13 @@ describe("Card - Refund flow - No 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + cy.confirmCallTest( + fixtures.confirmBody, + req_data, + res_data, + true, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -411,7 +476,13 @@ describe("Card - Refund flow - No 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 6500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -426,7 +497,13 @@ describe("Card - Refund flow - No 3DS", () => { ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 3000, globalState); + cy.refundCallTest( + fixtures.refundBody, + req_data, + res_data, + 3000, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -436,7 +513,13 @@ describe("Card - Refund flow - No 3DS", () => { ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 3000, globalState); + cy.refundCallTest( + fixtures.refundBody, + req_data, + res_data, + 3000, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -452,7 +535,7 @@ describe("Card - Refund flow - No 3DS", () => { should_continue = utils.should_continue_further(res_data); }); it("list-refund-call-test", () => { - cy.listRefundCallTest(listRefundCall, globalState); + cy.listRefundCallTest(fixtures.listRefundCall, globalState); }); }); @@ -472,7 +555,7 @@ describe("Card - Refund flow - No 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "no_three_ds", @@ -495,7 +578,13 @@ describe("Card - Refund flow - No 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + cy.confirmCallTest( + fixtures.confirmBody, + req_data, + res_data, + true, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -511,7 +600,13 @@ describe("Card - Refund flow - No 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.captureCallTest(captureBody, req_data, res_data, 100, globalState); + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 100, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -526,7 +621,13 @@ describe("Card - Refund flow - No 3DS", () => { ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 100, globalState); + cy.refundCallTest( + fixtures.refundBody, + req_data, + res_data, + 100, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -559,7 +660,7 @@ describe("Card - Refund flow - No 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "no_three_ds", @@ -582,7 +683,13 @@ describe("Card - Refund flow - No 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + cy.confirmCallTest( + fixtures.confirmBody, + req_data, + res_data, + true, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -598,7 +705,13 @@ describe("Card - Refund flow - No 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.captureCallTest(captureBody, req_data, res_data, 100, globalState); + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 100, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -613,7 +726,13 @@ describe("Card - Refund flow - No 3DS", () => { ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 100, globalState); + cy.refundCallTest( + fixtures.refundBody, + req_data, + res_data, + 100, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -649,7 +768,7 @@ describe("Card - Refund flow - No 3DS", () => { let res_data = data["Response"]; console.log("det -> " + req_data.card); cy.citForMandatesCallTest( - citConfirmBody, + fixtures.citConfirmBody, req_data, res_data, 7000, @@ -664,7 +783,7 @@ describe("Card - Refund flow - No 3DS", () => { it("Confirm No 3DS MIT", () => { cy.mitForMandatesCallTest( - mitConfirmBody, + fixtures.mitConfirmBody, 7000, true, "automatic", @@ -674,7 +793,7 @@ describe("Card - Refund flow - No 3DS", () => { it("Confirm No 3DS MIT", () => { cy.mitForMandatesCallTest( - mitConfirmBody, + fixtures.mitConfirmBody, 7000, true, "automatic", @@ -688,7 +807,13 @@ describe("Card - Refund flow - No 3DS", () => { ]["Refund"]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 7000, globalState); + cy.refundCallTest( + fixtures.refundBody, + req_data, + res_data, + 7000, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -734,7 +859,7 @@ describe("Card - Refund flow - 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "three_ds", @@ -755,13 +880,19 @@ describe("Card - Refund flow - 3DS", () => { ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + cy.confirmCallTest( + fixtures.confirmBody, + req_data, + res_data, + true, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); it("Handle redirection", () => { - let expected_redirection = confirmBody["return_url"]; + let expected_redirection = fixtures.confirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); @@ -775,7 +906,13 @@ describe("Card - Refund flow - 3DS", () => { ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState); + cy.refundCallTest( + fixtures.refundBody, + req_data, + res_data, + 6500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -797,7 +934,7 @@ describe("Card - Refund flow - 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "three_ds", @@ -819,13 +956,19 @@ describe("Card - Refund flow - 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + cy.confirmCallTest( + fixtures.confirmBody, + req_data, + res_data, + true, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); it("Handle redirection", () => { - let expected_redirection = confirmBody["return_url"]; + let expected_redirection = fixtures.confirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); @@ -839,7 +982,13 @@ describe("Card - Refund flow - 3DS", () => { ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 1200, globalState); + cy.refundCallTest( + fixtures.refundBody, + req_data, + res_data, + 1200, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -850,7 +999,13 @@ describe("Card - Refund flow - 3DS", () => { ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 1200, globalState); + cy.refundCallTest( + fixtures.refundBody, + req_data, + res_data, + 1200, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -872,7 +1027,7 @@ describe("Card - Refund flow - 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createConfirmPaymentTest( - createConfirmPaymentBody, + fixtures.createConfirmPaymentBody, req_data, res_data, "three_ds", @@ -884,7 +1039,7 @@ describe("Card - Refund flow - 3DS", () => { }); it("Handle redirection", () => { - let expected_redirection = confirmBody["return_url"]; + let expected_redirection = fixtures.confirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); @@ -898,7 +1053,13 @@ describe("Card - Refund flow - 3DS", () => { ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState); + cy.refundCallTest( + fixtures.refundBody, + req_data, + res_data, + 6500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -922,7 +1083,7 @@ describe("Card - Refund flow - 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createConfirmPaymentTest( - createConfirmPaymentBody, + fixtures.createConfirmPaymentBody, req_data, res_data, "three_ds", @@ -934,7 +1095,7 @@ describe("Card - Refund flow - 3DS", () => { }); it("Handle redirection", () => { - let expected_redirection = confirmBody["return_url"]; + let expected_redirection = fixtures.confirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); @@ -948,7 +1109,13 @@ describe("Card - Refund flow - 3DS", () => { ]["PartialRefund"]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 3000, globalState); + cy.refundCallTest( + fixtures.refundBody, + req_data, + res_data, + 3000, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -959,7 +1126,13 @@ describe("Card - Refund flow - 3DS", () => { ]["PartialRefund"]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 3000, globalState); + cy.refundCallTest( + fixtures.refundBody, + req_data, + res_data, + 3000, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -993,7 +1166,7 @@ describe("Card - Refund flow - 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "three_ds", @@ -1015,13 +1188,19 @@ describe("Card - Refund flow - 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + cy.confirmCallTest( + fixtures.confirmBody, + req_data, + res_data, + true, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); it("Handle redirection", () => { - let expected_redirection = confirmBody["return_url"]; + let expected_redirection = fixtures.confirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); @@ -1035,7 +1214,13 @@ describe("Card - Refund flow - 3DS", () => { ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 6500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -1050,7 +1235,13 @@ describe("Card - Refund flow - 3DS", () => { ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState); + cy.refundCallTest( + fixtures.refundBody, + req_data, + res_data, + 6500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -1072,7 +1263,7 @@ describe("Card - Refund flow - 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "three_ds", @@ -1094,13 +1285,19 @@ describe("Card - Refund flow - 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + cy.confirmCallTest( + fixtures.confirmBody, + req_data, + res_data, + true, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); it("Handle redirection", () => { - let expected_redirection = confirmBody["return_url"]; + let expected_redirection = fixtures.confirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); @@ -1114,7 +1311,13 @@ describe("Card - Refund flow - 3DS", () => { ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 6500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -1129,7 +1332,13 @@ describe("Card - Refund flow - 3DS", () => { ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 5000, globalState); + cy.refundCallTest( + fixtures.refundBody, + req_data, + res_data, + 5000, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -1139,7 +1348,13 @@ describe("Card - Refund flow - 3DS", () => { ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 1500, globalState); + cy.refundCallTest( + fixtures.refundBody, + req_data, + res_data, + 1500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -1161,7 +1376,7 @@ describe("Card - Refund flow - 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "three_ds", @@ -1183,13 +1398,19 @@ describe("Card - Refund flow - 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + cy.confirmCallTest( + fixtures.confirmBody, + req_data, + res_data, + true, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); it("Handle redirection", () => { - let expected_redirection = confirmBody["return_url"]; + let expected_redirection = fixtures.confirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); @@ -1203,7 +1424,13 @@ describe("Card - Refund flow - 3DS", () => { ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.captureCallTest(captureBody, req_data, res_data, 100, globalState); + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 100, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -1218,7 +1445,13 @@ describe("Card - Refund flow - 3DS", () => { ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 100, globalState); + cy.refundCallTest( + fixtures.refundBody, + req_data, + res_data, + 100, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -1240,7 +1473,7 @@ describe("Card - Refund flow - 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "three_ds", @@ -1262,13 +1495,19 @@ describe("Card - Refund flow - 3DS", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + cy.confirmCallTest( + fixtures.confirmBody, + req_data, + res_data, + true, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); it("Handle redirection", () => { - let expected_redirection = confirmBody["return_url"]; + let expected_redirection = fixtures.confirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); @@ -1282,7 +1521,13 @@ describe("Card - Refund flow - 3DS", () => { ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.captureCallTest(captureBody, req_data, res_data, 100, globalState); + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 100, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -1297,7 +1542,13 @@ describe("Card - Refund flow - 3DS", () => { ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 50, globalState); + cy.refundCallTest( + fixtures.refundBody, + req_data, + res_data, + 50, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00009-SyncRefund.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00009-SyncRefund.cy.js index 630f8e70708e..f16e75edb686 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00009-SyncRefund.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00009-SyncRefund.cy.js @@ -1,9 +1,6 @@ -import confirmBody from "../../fixtures/confirm-body.json"; -import createPaymentBody from "../../fixtures/create-payment-body.json"; -import refundBody from "../../fixtures/refund-flow-body.json"; +import * as fixtures from "../../fixtures/imports"; import State from "../../utils/State"; -import getConnectorDetails from "../PaymentUtils/utils"; -import * as utils from "../PaymentUtils/utils"; +import getConnectorDetails, * as utils from "../PaymentUtils/utils"; let globalState; @@ -33,7 +30,7 @@ describe("Card - Sync Refund flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "no_three_ds", @@ -56,7 +53,13 @@ describe("Card - Sync Refund flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + cy.confirmCallTest( + fixtures.confirmBody, + req_data, + res_data, + true, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -71,7 +74,13 @@ describe("Card - Sync Refund flow test", () => { ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState); + cy.refundCallTest( + fixtures.refundBody, + req_data, + res_data, + 6500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00010-CreateSingleuseMandate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00010-CreateSingleuseMandate.cy.js index 1f37b061ec38..52bc315fdeba 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00010-CreateSingleuseMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00010-CreateSingleuseMandate.cy.js @@ -1,9 +1,6 @@ -import captureBody from "../../fixtures/capture-flow-body.json"; -import citConfirmBody from "../../fixtures/create-mandate-cit.json"; -import mitConfirmBody from "../../fixtures/create-mandate-mit.json"; +import * as fixtures from "../../fixtures/imports"; import State from "../../utils/State"; -import getConnectorDetails from "../PaymentUtils/utils"; -import * as utils from "../PaymentUtils/utils"; +import getConnectorDetails, * as utils from "../PaymentUtils/utils"; let globalState; @@ -38,7 +35,7 @@ describe("Card - SingleUse Mandates flow test", () => { let res_data = data["Response"]; console.log("det -> " + data.card); cy.citForMandatesCallTest( - citConfirmBody, + fixtures.citConfirmBody, req_data, res_data, 7000, @@ -53,7 +50,7 @@ describe("Card - SingleUse Mandates flow test", () => { it("Confirm No 3DS MIT", () => { cy.mitForMandatesCallTest( - mitConfirmBody, + fixtures.mitConfirmBody, 7000, true, "automatic", @@ -83,7 +80,7 @@ describe("Card - SingleUse Mandates flow test", () => { let res_data = data["Response"]; console.log("det -> " + data.card); cy.citForMandatesCallTest( - citConfirmBody, + fixtures.citConfirmBody, req_data, res_data, 6500, @@ -103,14 +100,20 @@ describe("Card - SingleUse Mandates flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 6500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); it("Confirm No 3DS MIT", () => { cy.mitForMandatesCallTest( - mitConfirmBody, + fixtures.mitConfirmBody, 6500, true, "manual", @@ -125,7 +128,13 @@ describe("Card - SingleUse Mandates flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 6500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -156,7 +165,7 @@ describe("Card - SingleUse Mandates flow test", () => { let res_data = data["Response"]; console.log("det -> " + data.card); cy.citForMandatesCallTest( - citConfirmBody, + fixtures.citConfirmBody, req_data, res_data, 6500, @@ -176,14 +185,20 @@ describe("Card - SingleUse Mandates flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 6500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); it("Confirm No 3DS MIT", () => { cy.mitForMandatesCallTest( - mitConfirmBody, + fixtures.mitConfirmBody, 7000, true, "automatic", diff --git a/cypress-tests/cypress/e2e/PaymentTest/00011-CreateMultiuseMandate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00011-CreateMultiuseMandate.cy.js index b7ca7b14934e..f40b3f770f71 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00011-CreateMultiuseMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00011-CreateMultiuseMandate.cy.js @@ -1,9 +1,7 @@ -import captureBody from "../../fixtures/capture-flow-body.json"; -import citConfirmBody from "../../fixtures/create-mandate-cit.json"; -import mitConfirmBody from "../../fixtures/create-mandate-mit.json"; import State from "../../utils/State"; import getConnectorDetails from "../PaymentUtils/utils"; import * as utils from "../PaymentUtils/utils"; +import * as fixtures from "../../fixtures/imports"; let globalState; @@ -38,7 +36,7 @@ describe("Card - MultiUse Mandates flow test", () => { let res_data = data["Response"]; console.log("det -> " + data.card); cy.citForMandatesCallTest( - citConfirmBody, + fixtures.citConfirmBody, req_data, res_data, 7000, @@ -53,7 +51,7 @@ describe("Card - MultiUse Mandates flow test", () => { it("Confirm No 3DS MIT", () => { cy.mitForMandatesCallTest( - mitConfirmBody, + fixtures.mitConfirmBody, 7000, true, "automatic", @@ -62,7 +60,7 @@ describe("Card - MultiUse Mandates flow test", () => { }); it("Confirm No 3DS MIT", () => { cy.mitForMandatesCallTest( - mitConfirmBody, + fixtures.mitConfirmBody, 7000, true, "automatic", @@ -92,7 +90,7 @@ describe("Card - MultiUse Mandates flow test", () => { let res_data = data["Response"]; console.log("det -> " + data.card); cy.citForMandatesCallTest( - citConfirmBody, + fixtures.citConfirmBody, req_data, res_data, 6500, @@ -112,14 +110,20 @@ describe("Card - MultiUse Mandates flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 6500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); it("Confirm No 3DS MIT 1", () => { cy.mitForMandatesCallTest( - mitConfirmBody, + fixtures.mitConfirmBody, 6500, true, "manual", @@ -134,14 +138,20 @@ describe("Card - MultiUse Mandates flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 6500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); it("Confirm No 3DS MIT 2", () => { cy.mitForMandatesCallTest( - mitConfirmBody, + fixtures.mitConfirmBody, 6500, true, "manual", @@ -156,7 +166,13 @@ describe("Card - MultiUse Mandates flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 6500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -183,7 +199,7 @@ describe("Card - MultiUse Mandates flow test", () => { let res_data = data["Response"]; console.log("det -> " + data.card); cy.citForMandatesCallTest( - citConfirmBody, + fixtures.citConfirmBody, req_data, res_data, 6500, @@ -203,14 +219,20 @@ describe("Card - MultiUse Mandates flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 6500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); it("Confirm No 3DS MIT", () => { cy.mitForMandatesCallTest( - mitConfirmBody, + fixtures.mitConfirmBody, 6500, true, "automatic", diff --git a/cypress-tests/cypress/e2e/PaymentTest/00012-ListAndRevokeMandate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00012-ListAndRevokeMandate.cy.js index 29327cc0396d..e8712d76ee97 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00012-ListAndRevokeMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00012-ListAndRevokeMandate.cy.js @@ -1,8 +1,5 @@ -import citConfirmBody from "../../fixtures/create-mandate-cit.json"; -import mitConfirmBody from "../../fixtures/create-mandate-mit.json"; -import getConnectorDetails from "../PaymentUtils/utils"; import * as utils from "../PaymentUtils/utils"; - +import * as fixtures from "../../fixtures/imports"; import State from "../../utils/State"; let globalState; @@ -31,14 +28,14 @@ describe("Card - SingleUse Mandates flow test", () => { it("Confirm No 3DS CIT", () => { console.log("confirm -> " + globalState.get("connectorId")); - let data = getConnectorDetails(globalState.get("connectorId"))[ + let data = fixtures.getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MandateSingleUseNo3DSAutoCapture"]; let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); cy.citForMandatesCallTest( - citConfirmBody, + fixtures.citConfirmBody, req_data, res_data, 7000, @@ -53,7 +50,7 @@ describe("Card - SingleUse Mandates flow test", () => { it("Confirm No 3DS MIT", () => { cy.mitForMandatesCallTest( - mitConfirmBody, + fixtures.mitConfirmBody, 7000, true, "automatic", diff --git a/cypress-tests/cypress/e2e/PaymentTest/00013-SaveCardFlow.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00013-SaveCardFlow.cy.js index ef9f47d262dc..9556261d4820 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00013-SaveCardFlow.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00013-SaveCardFlow.cy.js @@ -1,12 +1,8 @@ -import captureBody from "../../fixtures/capture-flow-body.json"; -import confirmBody from "../../fixtures/confirm-body.json"; -import createPaymentBody from "../../fixtures/create-payment-body.json"; -import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json"; -import customerCreateBody from "../../fixtures/create-customer-body.json"; -import SaveCardConfirmBody from "../../fixtures/save-card-confirm-body.json"; import getConnectorDetails from "../PaymentUtils/utils"; import * as utils from "../PaymentUtils/utils"; import State from "../../utils/State"; +import * as fixtures from "../../fixtures/imports"; + let globalState; describe("Card - SaveCard payment flow test", () => { @@ -28,7 +24,7 @@ describe("Card - SaveCard payment flow test", () => { }); it("customer-create-call-test", () => { - cy.createCustomerCallTest(customerCreateBody, globalState); + cy.createCustomerCallTest(fixtures.customerCreateBody, globalState); }); it("create+confirm-payment-call-test", () => { @@ -38,7 +34,7 @@ describe("Card - SaveCard payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createConfirmPaymentTest( - createConfirmPaymentBody, + fixtures.createConfirmPaymentBody, req_data, res_data, "no_three_ds", @@ -64,7 +60,7 @@ describe("Card - SaveCard payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "no_three_ds", @@ -82,7 +78,7 @@ describe("Card - SaveCard payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.saveCardConfirmCallTest( - SaveCardConfirmBody, + fixtures.SaveCardConfirmBody, req_data, res_data, globalState @@ -105,7 +101,7 @@ describe("Card - SaveCard payment flow test", () => { }); it("customer-create-call-test", () => { - cy.createCustomerCallTest(customerCreateBody, globalState); + cy.createCustomerCallTest(fixtures.customerCreateBody, globalState); }); it("create+confirm-payment-call-test", () => { @@ -115,7 +111,7 @@ describe("Card - SaveCard payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createConfirmPaymentTest( - createConfirmPaymentBody, + fixtures.createConfirmPaymentBody, req_data, res_data, "no_three_ds", @@ -141,7 +137,7 @@ describe("Card - SaveCard payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "no_three_ds", @@ -159,7 +155,7 @@ describe("Card - SaveCard payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.saveCardConfirmCallTest( - SaveCardConfirmBody, + fixtures.SaveCardConfirmBody, req_data, res_data, globalState @@ -178,7 +174,13 @@ describe("Card - SaveCard payment flow test", () => { ]["Capture"]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 6500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -197,7 +199,7 @@ describe("Card - SaveCard payment flow test", () => { }); it("customer-create-call-test", () => { - cy.createCustomerCallTest(customerCreateBody, globalState); + cy.createCustomerCallTest(fixtures.customerCreateBody, globalState); }); it("create+confirm-payment-call-test", () => { @@ -207,7 +209,7 @@ describe("Card - SaveCard payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createConfirmPaymentTest( - createConfirmPaymentBody, + fixtures.createConfirmPaymentBody, req_data, res_data, "no_three_ds", @@ -233,7 +235,7 @@ describe("Card - SaveCard payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "no_three_ds", @@ -251,7 +253,7 @@ describe("Card - SaveCard payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.saveCardConfirmCallTest( - SaveCardConfirmBody, + fixtures.SaveCardConfirmBody, req_data, res_data, globalState @@ -269,7 +271,13 @@ describe("Card - SaveCard payment flow test", () => { ]["PartialCapture"]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.captureCallTest(captureBody, req_data, res_data, 100, globalState); + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 100, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00014-ZeroAuthMandate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00014-ZeroAuthMandate.cy.js index af3aff94084c..5078567022dd 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00014-ZeroAuthMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00014-ZeroAuthMandate.cy.js @@ -1,8 +1,7 @@ -import citConfirmBody from "../../fixtures/create-mandate-cit.json"; -import mitConfirmBody from "../../fixtures/create-mandate-mit.json"; import State from "../../utils/State"; import getConnectorDetails from "../PaymentUtils/utils"; import * as utils from "../PaymentUtils/utils"; +import * as fixtures from "../../fixtures/imports"; let globalState; @@ -35,7 +34,7 @@ describe("Card - SingleUse Mandates flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.citForMandatesCallTest( - citConfirmBody, + fixtures.citConfirmBody, req_data, res_data, 0, @@ -50,7 +49,7 @@ describe("Card - SingleUse Mandates flow test", () => { it("Confirm No 3DS MIT", () => { cy.mitForMandatesCallTest( - mitConfirmBody, + fixtures.mitConfirmBody, 7000, true, "automatic", @@ -77,7 +76,7 @@ describe("Card - SingleUse Mandates flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.citForMandatesCallTest( - citConfirmBody, + fixtures.citConfirmBody, req_data, res_data, 0, @@ -92,7 +91,7 @@ describe("Card - SingleUse Mandates flow test", () => { it("Confirm No 3DS MIT", () => { cy.mitForMandatesCallTest( - mitConfirmBody, + fixtures.mitConfirmBody, 7000, true, "automatic", @@ -101,7 +100,7 @@ describe("Card - SingleUse Mandates flow test", () => { }); it("Confirm No 3DS MIT", () => { cy.mitForMandatesCallTest( - mitConfirmBody, + fixtures.mitConfirmBody, 7000, true, "automatic", diff --git a/cypress-tests/cypress/e2e/PaymentTest/00015-ThreeDSManualCapture.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00015-ThreeDSManualCapture.cy.js index 2d11186247af..6f1ed9472a97 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00015-ThreeDSManualCapture.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00015-ThreeDSManualCapture.cy.js @@ -1,10 +1,8 @@ -import createPaymentBody from "../../fixtures/create-payment-body.json"; -import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json"; -import confirmBody from "../../fixtures/confirm-body.json"; import getConnectorDetails from "../PaymentUtils/utils"; import State from "../../utils/State"; import captureBody from "../../fixtures/capture-flow-body.json"; import * as utils from "../PaymentUtils/utils"; +import * as fixtures from "../../fixtures/imports"; let globalState; @@ -36,7 +34,7 @@ describe("Card - ThreeDS Manual payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "three_ds", @@ -57,13 +55,19 @@ describe("Card - ThreeDS Manual payment flow test", () => { ]["3DSManualCapture"]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + cy.confirmCallTest( + fixtures.confirmBody, + req_data, + res_data, + true, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); it("Handle redirection", () => { - let expected_redirection = confirmBody["return_url"]; + let expected_redirection = fixtures.confirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); @@ -103,7 +107,7 @@ describe("Card - ThreeDS Manual payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createConfirmPaymentTest( - createConfirmPaymentBody, + fixtures.createConfirmPaymentBody, req_data, res_data, "three_ds", @@ -115,7 +119,8 @@ describe("Card - ThreeDS Manual payment flow test", () => { }); it("Handle redirection", () => { - let expected_redirection = createConfirmPaymentBody["return_url"]; + let expected_redirection = + fixtures.createConfirmPaymentBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); @@ -159,7 +164,7 @@ describe("Card - ThreeDS Manual payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "three_ds", @@ -181,7 +186,7 @@ describe("Card - ThreeDS Manual payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.confirmCallTest( - confirmBody, + fixtures.confirmBody, req_data, res_data, true, @@ -192,7 +197,7 @@ describe("Card - ThreeDS Manual payment flow test", () => { }); it("Handle redirection", () => { - let expected_redirection = confirmBody["return_url"]; + let expected_redirection = fixtures.confirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); @@ -232,7 +237,7 @@ describe("Card - ThreeDS Manual payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createConfirmPaymentTest( - createConfirmPaymentBody, + fixtures.createConfirmPaymentBody, req_data, res_data, "three_ds", @@ -244,7 +249,8 @@ describe("Card - ThreeDS Manual payment flow test", () => { }); it("Handle redirection", () => { - let expected_redirection = createConfirmPaymentBody["return_url"]; + let expected_redirection = + fixtures.createConfirmPaymentBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00016-BankTransfers.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00016-BankTransfers.cy.js index 0ff9eceda6b3..ba88284dc19d 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00016-BankTransfers.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00016-BankTransfers.cy.js @@ -1,7 +1,6 @@ -import confirmBody from "../../fixtures/confirm-body.json"; -import createPaymentBody from "../../fixtures/create-payment-body.json"; import State from "../../utils/State"; import getConnectorDetails, * as utils from "../PaymentUtils/utils"; +import * as fixtures from "../../fixtures/imports"; let globalState; @@ -32,7 +31,7 @@ describe("Bank Transfers", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "three_ds", @@ -54,7 +53,7 @@ describe("Bank Transfers", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.confirmBankTransferCallTest( - confirmBody, + fixtures.confirmBody, req_data, res_data, true, @@ -65,7 +64,7 @@ describe("Bank Transfers", () => { }); it("Handle bank transfer redirection", () => { - let expected_redirection = confirmBody["return_url"]; + let expected_redirection = fixtures.confirmBody["return_url"]; let payment_method_type = globalState.get("paymentMethodType"); cy.handleBankTransferRedirection( globalState, diff --git a/cypress-tests/cypress/e2e/PaymentTest/00017-BankRedirect.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00017-BankRedirect.cy.js index 9fb1052aa62a..1afd13bb69f8 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00017-BankRedirect.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00017-BankRedirect.cy.js @@ -1,7 +1,6 @@ -import confirmBody from "../../fixtures/confirm-body.json"; -import createPaymentBody from "../../fixtures/create-payment-body.json"; import State from "../../utils/State"; import getConnectorDetails, * as utils from "../PaymentUtils/utils"; +import * as fixtures from "../../fixtures/imports"; let globalState; @@ -36,7 +35,7 @@ describe("Bank Redirect tests", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "three_ds", @@ -58,7 +57,7 @@ describe("Bank Redirect tests", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.confirmBankRedirectCallTest( - confirmBody, + fixtures.confirmBody, req_data, res_data, true, @@ -84,7 +83,7 @@ describe("Bank Redirect tests", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "three_ds", @@ -106,7 +105,7 @@ describe("Bank Redirect tests", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.confirmBankRedirectCallTest( - confirmBody, + fixtures.confirmBody, req_data, res_data, true, @@ -118,7 +117,7 @@ describe("Bank Redirect tests", () => { it("Handle bank redirect redirection", () => { // return_url is a static url (https://hyperswitch.io) taken from confirm-body fixture and is not updated - let expected_redirection = confirmBody["return_url"]; + let expected_redirection = fixtures.confirmBody["return_url"]; let payment_method_type = globalState.get("paymentMethodType"); cy.handleBankRedirectRedirection( globalState, @@ -144,7 +143,7 @@ describe("Bank Redirect tests", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "three_ds", @@ -166,7 +165,7 @@ describe("Bank Redirect tests", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.confirmBankRedirectCallTest( - confirmBody, + fixtures.confirmBody, req_data, res_data, true, @@ -178,7 +177,7 @@ describe("Bank Redirect tests", () => { it("Handle bank redirect redirection", () => { // return_url is a static url (https://hyperswitch.io) taken from confirm-body fixture and is not updated - let expected_redirection = confirmBody["return_url"]; + let expected_redirection = fixtures.confirmBody["return_url"]; let payment_method_type = globalState.get("paymentMethodType"); cy.handleBankRedirectRedirection( globalState, @@ -203,7 +202,7 @@ describe("Bank Redirect tests", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "three_ds", @@ -225,7 +224,7 @@ describe("Bank Redirect tests", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.confirmBankRedirectCallTest( - confirmBody, + fixtures.confirmBody, req_data, res_data, true, @@ -237,7 +236,7 @@ describe("Bank Redirect tests", () => { it("Handle bank redirect redirection", () => { // return_url is a static url (https://hyperswitch.io) taken from confirm-body fixture and is not updated - let expected_redirection = confirmBody["return_url"]; + let expected_redirection = fixtures.confirmBody["return_url"]; let payment_method_type = globalState.get("paymentMethodType"); cy.handleBankRedirectRedirection( globalState, @@ -262,7 +261,7 @@ describe("Bank Redirect tests", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "three_ds", @@ -284,7 +283,7 @@ describe("Bank Redirect tests", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.confirmBankRedirectCallTest( - confirmBody, + fixtures.confirmBody, req_data, res_data, true, @@ -296,7 +295,7 @@ describe("Bank Redirect tests", () => { it("Handle bank redirect redirection", () => { // return_url is a static url (https://hyperswitch.io) taken from confirm-body fixture and is not updated - let expected_redirection = confirmBody["return_url"]; + let expected_redirection = fixtures.confirmBody["return_url"]; let payment_method_type = globalState.get("paymentMethodType"); cy.handleBankRedirectRedirection( globalState, @@ -321,7 +320,7 @@ describe("Bank Redirect tests", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "three_ds", @@ -343,7 +342,7 @@ describe("Bank Redirect tests", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.confirmBankRedirectCallTest( - confirmBody, + fixtures.confirmBody, req_data, res_data, true, @@ -354,7 +353,7 @@ describe("Bank Redirect tests", () => { }); it("Handle bank redirect redirection", () => { - let expected_redirection = confirmBody["return_url"]; + let expected_redirection = fixtures.confirmBody["return_url"]; let payment_method_type = globalState.get("paymentMethodType"); cy.handleBankRedirectRedirection( globalState, diff --git a/cypress-tests/cypress/e2e/PaymentTest/00018-MandatesUsingPMID.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00018-MandatesUsingPMID.cy.js index 926e8f363185..bc07af101899 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00018-MandatesUsingPMID.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00018-MandatesUsingPMID.cy.js @@ -1,9 +1,6 @@ -import captureBody from "../../fixtures/capture-flow-body.json"; -import citConfirmBody from "../../fixtures/create-mandate-cit.json"; -import createPaymentBody from "../../fixtures/create-payment-body"; -import pmIdConfirmBody from "../../fixtures/create-pm-id-mit.json"; import State from "../../utils/State"; import getConnectorDetails, * as utils from "../PaymentUtils/utils"; +import * as fixtures from "../../fixtures/imports"; let globalState; @@ -42,7 +39,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "no_three_ds", @@ -62,7 +59,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => { let res_data = data["Response"]; console.log("det -> " + data.card); cy.citForMandatesCallTest( - citConfirmBody, + fixtures.citConfirmBody, req_data, res_data, 7000, @@ -76,7 +73,13 @@ describe("Card - Mandates using Payment Method Id flow test", () => { }); it("Confirm No 3DS MIT", () => { - cy.mitUsingPMId(pmIdConfirmBody, 7000, true, "automatic", globalState); + cy.mitUsingPMId( + fixtures.pmIdConfirmBody, + 7000, + true, + "automatic", + globalState + ); }); } ); @@ -99,7 +102,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "no_three_ds", @@ -119,7 +122,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => { let res_data = data["Response"]; console.log("det -> " + data.card); cy.citForMandatesCallTest( - citConfirmBody, + fixtures.citConfirmBody, req_data, res_data, 6500, @@ -139,13 +142,25 @@ describe("Card - Mandates using Payment Method Id flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 6500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); it("Confirm No 3DS MIT", () => { - cy.mitUsingPMId(pmIdConfirmBody, 7000, true, "automatic", globalState); + cy.mitUsingPMId( + fixtures.pmIdConfirmBody, + 7000, + true, + "automatic", + globalState + ); }); } ); @@ -170,7 +185,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => { let res_data = data["Response"]; console.log("det -> " + data.card); cy.citForMandatesCallTest( - citConfirmBody, + fixtures.citConfirmBody, req_data, res_data, 7000, @@ -184,10 +199,22 @@ describe("Card - Mandates using Payment Method Id flow test", () => { }); it("Confirm No 3DS MIT", () => { - cy.mitUsingPMId(pmIdConfirmBody, 7000, true, "automatic", globalState); + cy.mitUsingPMId( + fixtures.pmIdConfirmBody, + 7000, + true, + "automatic", + globalState + ); }); it("Confirm No 3DS MIT", () => { - cy.mitUsingPMId(pmIdConfirmBody, 7000, true, "automatic", globalState); + cy.mitUsingPMId( + fixtures.pmIdConfirmBody, + 7000, + true, + "automatic", + globalState + ); }); } ); @@ -212,7 +239,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => { let res_data = data["Response"]; console.log("det -> " + data.card); cy.citForMandatesCallTest( - citConfirmBody, + fixtures.citConfirmBody, req_data, res_data, 6500, @@ -232,13 +259,25 @@ describe("Card - Mandates using Payment Method Id flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 6500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); it("Confirm No 3DS MIT 1", () => { - cy.mitUsingPMId(pmIdConfirmBody, 6500, true, "manual", globalState); + cy.mitUsingPMId( + fixtures.pmIdConfirmBody, + 6500, + true, + "manual", + globalState + ); }); it("mit-capture-call-test", () => { @@ -248,13 +287,25 @@ describe("Card - Mandates using Payment Method Id flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 6500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); it("Confirm No 3DS MIT 2", () => { - cy.mitUsingPMId(pmIdConfirmBody, 6500, true, "manual", globalState); + cy.mitUsingPMId( + fixtures.pmIdConfirmBody, + 6500, + true, + "manual", + globalState + ); }); it("mit-capture-call-test", () => { @@ -264,7 +315,13 @@ describe("Card - Mandates using Payment Method Id flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 6500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -291,7 +348,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => { let res_data = data["Response"]; console.log("det -> " + data.card); cy.citForMandatesCallTest( - citConfirmBody, + fixtures.citConfirmBody, req_data, res_data, 7000, @@ -305,15 +362,27 @@ describe("Card - Mandates using Payment Method Id flow test", () => { }); it("Handle redirection", () => { - let expected_redirection = citConfirmBody["return_url"]; + let expected_redirection = fixtures.citConfirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); it("Confirm No 3DS MIT", () => { - cy.mitUsingPMId(pmIdConfirmBody, 7000, true, "automatic", globalState); + cy.mitUsingPMId( + fixtures.pmIdConfirmBody, + 7000, + true, + "automatic", + globalState + ); }); it("Confirm No 3DS MIT", () => { - cy.mitUsingPMId(pmIdConfirmBody, 7000, true, "automatic", globalState); + cy.mitUsingPMId( + fixtures.pmIdConfirmBody, + 7000, + true, + "automatic", + globalState + ); }); } ); @@ -338,7 +407,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => { let res_data = data["Response"]; cy.citForMandatesCallTest( - citConfirmBody, + fixtures.citConfirmBody, req_data, res_data, 6500, @@ -352,7 +421,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => { }); it("Handle redirection", () => { - let expected_redirection = citConfirmBody["return_url"]; + let expected_redirection = fixtures.citConfirmBody["return_url"]; cy.handleRedirection(globalState, expected_redirection); }); @@ -363,13 +432,25 @@ describe("Card - Mandates using Payment Method Id flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; console.log("det -> " + data.card); - cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 6500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); it("Confirm No 3DS MIT", () => { - cy.mitUsingPMId(pmIdConfirmBody, 7000, true, "automatic", globalState); + cy.mitUsingPMId( + fixtures.pmIdConfirmBody, + 7000, + true, + "automatic", + globalState + ); }); } ); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00019-UPI.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00019-UPI.cy.js index 331f36c0c24d..ad30681801da 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00019-UPI.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00019-UPI.cy.js @@ -1,8 +1,6 @@ -import confirmBody from "../../fixtures/confirm-body.json"; -import createPaymentBody from "../../fixtures/create-payment-body.json"; -import refundBody from "../../fixtures/refund-flow-body.json"; import State from "../../utils/State"; import getConnectorDetails, * as utils from "../PaymentUtils/utils"; +import * as fixtures from "../../fixtures/imports"; let globalState; @@ -34,7 +32,7 @@ describe("UPI Payments - Hyperswitch", () => { let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "three_ds", @@ -57,14 +55,20 @@ describe("UPI Payments - Hyperswitch", () => { let req_data = data["Request"]; let res_data = data["Response"]; - cy.confirmUpiCall(confirmBody, req_data, res_data, true, globalState); + cy.confirmUpiCall( + fixtures.confirmBody, + req_data, + res_data, + true, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); it("Handle UPI Redirection", () => { - let expected_redirection = confirmBody["return_url"]; + let expected_redirection = fixtures.confirmBody["return_url"]; let payment_method_type = globalState.get("paymentMethodType"); cy.handleUpiRedirection( globalState, @@ -83,7 +87,13 @@ describe("UPI Payments - Hyperswitch", () => { ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState); + cy.refundCallTest( + fixtures.refundBody, + req_data, + res_data, + 6500, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -118,7 +128,7 @@ describe("UPI Payments - Hyperswitch", () => { let res_data = data["Response"]; cy.createPaymentIntentTest( - createPaymentBody, + fixtures.createPaymentBody, req_data, res_data, "three_ds", @@ -141,14 +151,20 @@ describe("UPI Payments - Hyperswitch", () => { let req_data = data["Request"]; let res_data = data["Response"]; - cy.confirmUpiCall(confirmBody, req_data, res_data, true, globalState); + cy.confirmUpiCall( + fixtures.confirmBody, + req_data, + res_data, + true, + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); it("Handle UPI Redirection", () => { - let expected_redirection = confirmBody["return_url"]; + let expected_redirection = fixtures.confirmBody["return_url"]; let payment_method_type = globalState.get("paymentMethodType"); cy.handleUpiRedirection( globalState, diff --git a/cypress-tests/cypress/e2e/PayoutTest/00000-AccountCreate.cy.js b/cypress-tests/cypress/e2e/PayoutTest/00000-AccountCreate.cy.js index 25305cc4fc2c..68d0bb458a11 100644 --- a/cypress-tests/cypress/e2e/PayoutTest/00000-AccountCreate.cy.js +++ b/cypress-tests/cypress/e2e/PayoutTest/00000-AccountCreate.cy.js @@ -1,8 +1,8 @@ -import apiKeyCreateBody from "../../fixtures/create-api-key-body.json"; -import merchantCreateBody from "../../fixtures/merchant-create-body.json"; import State from "../../utils/State"; +import * as fixtures from "../../fixtures/imports"; let globalState; + describe("Account Create flow test", () => { before("seed global state", () => { cy.task("getGlobalState").then((state) => { @@ -14,10 +14,10 @@ describe("Account Create flow test", () => { }); it("merchant-create-call-test", () => { - cy.merchantCreateCallTest(merchantCreateBody, globalState); + cy.merchantCreateCallTest(fixtures.merchantCreateBody, globalState); }); it("api-key-create-call-test", () => { - cy.apiKeyCreateTest(apiKeyCreateBody, globalState); + cy.apiKeyCreateTest(fixtures.apiKeyCreateBody, globalState); }); }); diff --git a/cypress-tests/cypress/e2e/PayoutTest/00001-CustomerCreate.cy.js b/cypress-tests/cypress/e2e/PayoutTest/00001-CustomerCreate.cy.js index d51a2f78ae95..8b42f91c1f2a 100644 --- a/cypress-tests/cypress/e2e/PayoutTest/00001-CustomerCreate.cy.js +++ b/cypress-tests/cypress/e2e/PayoutTest/00001-CustomerCreate.cy.js @@ -1,5 +1,5 @@ -import customerCreateBody from "../../fixtures/create-customer-body.json"; import State from "../../utils/State"; +import * as fixtures from "../../fixtures/imports"; let globalState; @@ -15,6 +15,6 @@ describe("Customer Create flow test", () => { }); it("customer-create-call-test", () => { - cy.createCustomerCallTest(customerCreateBody, globalState); + cy.createCustomerCallTest(fixtures.customerCreateBody, globalState); }); }); diff --git a/cypress-tests/cypress/e2e/PayoutTest/00002-ConnectorCreate.cy.js b/cypress-tests/cypress/e2e/PayoutTest/00002-ConnectorCreate.cy.js index e60049af249a..d018ee20491b 100644 --- a/cypress-tests/cypress/e2e/PayoutTest/00002-ConnectorCreate.cy.js +++ b/cypress-tests/cypress/e2e/PayoutTest/00002-ConnectorCreate.cy.js @@ -1,5 +1,5 @@ -import createConnectorBody from "../../fixtures/create-connector-body.json"; import State from "../../utils/State"; +import * as fixtures from "../../fixtures/imports"; let globalState; describe("Connector Account Create flow test", () => { @@ -14,6 +14,6 @@ describe("Connector Account Create flow test", () => { }); it("connector-create-call-test", () => { - cy.createPayoutConnectorCallTest(createConnectorBody, globalState); + cy.createPayoutConnectorCallTest(fixtures.createConnectorBody, globalState); }); }); diff --git a/cypress-tests/cypress/e2e/PayoutTest/00003-CardTest.cy.js b/cypress-tests/cypress/e2e/PayoutTest/00003-CardTest.cy.js index 54fa7f31d286..eed8cbabf3a2 100644 --- a/cypress-tests/cypress/e2e/PayoutTest/00003-CardTest.cy.js +++ b/cypress-tests/cypress/e2e/PayoutTest/00003-CardTest.cy.js @@ -1,6 +1,6 @@ -import createPayoutBody from "../../fixtures/create-payout-confirm-body.json"; import State from "../../utils/State"; import * as utils from "../PayoutUtils/utils"; +import * as fixtures from "../../fixtures/imports"; let globalState; @@ -37,7 +37,7 @@ describe("[Payout] Cards", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createConfirmPayoutTest( - createPayoutBody, + fixtures.createPayoutBody, req_data, res_data, true, @@ -64,7 +64,7 @@ describe("[Payout] Cards", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createConfirmPayoutTest( - createPayoutBody, + fixtures.createPayoutBody, req_data, res_data, true, @@ -101,7 +101,7 @@ describe("[Payout] Cards", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createConfirmPayoutTest( - createPayoutBody, + fixtures.createPayoutBody, req_data, res_data, false, diff --git a/cypress-tests/cypress/e2e/PayoutTest/00004-BankTransfer.cy.js b/cypress-tests/cypress/e2e/PayoutTest/00004-BankTransfer.cy.js index 9001cb212b08..da7b73a6648b 100644 --- a/cypress-tests/cypress/e2e/PayoutTest/00004-BankTransfer.cy.js +++ b/cypress-tests/cypress/e2e/PayoutTest/00004-BankTransfer.cy.js @@ -1,6 +1,6 @@ -import createPayoutBody from "../../fixtures/create-payout-confirm-body.json"; import State from "../../utils/State"; import * as utils from "../PayoutUtils/utils"; +import * as fixtures from "../../fixtures/imports"; let globalState; @@ -91,7 +91,7 @@ describe("[Payout] [Bank Transfer - SEPA]", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createConfirmPayoutTest( - createPayoutBody, + fixtures.createPayoutBody, req_data, res_data, true, @@ -117,7 +117,7 @@ describe("[Payout] [Bank Transfer - SEPA]", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createConfirmPayoutTest( - createPayoutBody, + fixtures.createPayoutBody, req_data, res_data, true, @@ -154,7 +154,7 @@ describe("[Payout] [Bank Transfer - SEPA]", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createConfirmPayoutTest( - createPayoutBody, + fixtures.createPayoutBody, req_data, res_data, false, @@ -202,7 +202,7 @@ describe("[Payout] [Bank Transfer - SEPA]", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createConfirmPayoutTest( - createPayoutBody, + fixtures.createPayoutBody, req_data, res_data, false, diff --git a/cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.js b/cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.js index 222ecc57ba98..5f4eeca56e3f 100644 --- a/cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.js +++ b/cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.js @@ -1,7 +1,6 @@ -import customerCreateBody from "../../fixtures/create-customer-body.json"; -import initialCreatePayoutBody from "../../fixtures/create-payout-confirm-body.json"; import State from "../../utils/State"; import * as utils from "../PayoutUtils/utils"; +import * as fixtures from "../../fixtures/imports"; let globalState; let createPayoutBody; @@ -35,11 +34,11 @@ describe("[Payout] Saved Card", () => { // This is needed to get customer payment methods beforeEach("seed global state", () => { - createPayoutBody = Cypress._.cloneDeep(initialCreatePayoutBody); + createPayoutBody = Cypress._.cloneDeep(fixtures.initialCreatePayoutBody); }); it("create customer", () => { - cy.createCustomerCallTest(customerCreateBody, globalState); + cy.createCustomerCallTest(fixtures.customerCreateBody, globalState); }); it("create payment method", () => { @@ -85,7 +84,7 @@ describe("[Payout] Saved Card", () => { let should_continue = true; // variable that will be used to skip tests if a previous test fails it("create customer", () => { - cy.createCustomerCallTest(customerCreateBody, globalState); + cy.createCustomerCallTest(fixtures.customerCreateBody, globalState); }); it("confirm-payout-call-with-auto-fulfill-test", () => { @@ -166,11 +165,13 @@ describe("[Payout] Saved Bank transfer", () => { () => { let should_continue = true; // variable that will be used to skip tests if a previous test fails beforeEach("reset createPayoutBody", () => { - createPayoutBody = Cypress._.cloneDeep(initialCreatePayoutBody); + createPayoutBody = Cypress._.cloneDeep( + fixtures.initialCreatePayoutBody + ); }); it("create customer", () => { - cy.createCustomerCallTest(customerCreateBody, globalState); + cy.createCustomerCallTest(fixtures.customerCreateBody, globalState); }); it("create payment method", () => { @@ -217,7 +218,7 @@ describe("[Payout] Saved Bank transfer", () => { let should_continue = true; // variable that will be used to skip tests if a previous test fails it("create customer", () => { - cy.createCustomerCallTest(customerCreateBody, globalState); + cy.createCustomerCallTest(fixtures.customerCreateBody, globalState); }); it("confirm-payout-call-with-auto-fulfill-test", () => { diff --git a/cypress-tests/cypress/e2e/RoutingTest/00000-PaymentRoutingTest.cy.js b/cypress-tests/cypress/e2e/RoutingTest/00000-PaymentRoutingTest.cy.js index 16f7458eaaa4..235ebbec48e2 100644 --- a/cypress-tests/cypress/e2e/RoutingTest/00000-PaymentRoutingTest.cy.js +++ b/cypress-tests/cypress/e2e/RoutingTest/00000-PaymentRoutingTest.cy.js @@ -1,9 +1,6 @@ -import apiKeyCreateBody from "../../fixtures/create-api-key-body.json"; -import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json"; -import customerCreateBody from "../../fixtures/create-customer-body.json"; -import routingConfigBody from "../../fixtures/routing-config-body.json"; import State from "../../utils/State"; import * as utils from "../RoutingUtils/utils"; +import * as fixtures from "../../fixtures/imports"; let globalState; @@ -42,11 +39,11 @@ describe("Routing Test", () => { }); it("api-key-create-call-test", () => { - cy.apiKeyCreateTest(apiKeyCreateBody, globalState); + cy.apiKeyCreateTest(fixtures.apiKeyCreateBody, globalState); }); it("customer-create-call-test", () => { - cy.createCustomerCallTest(customerCreateBody, globalState); + cy.createCustomerCallTest(fixtures.customerCreateBody, globalState); }); it("add-routing-config", () => { @@ -65,7 +62,7 @@ describe("Routing Test", () => { }, ]; cy.addRoutingConfig( - routingConfigBody, + fixtures.routingConfigBody, req_data, res_data, "priority", @@ -99,7 +96,7 @@ describe("Routing Test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createConfirmPaymentTest( - createConfirmPaymentBody, + fixtures.createConfirmPaymentBody, req_data, res_data, "no_three_ds", diff --git a/cypress-tests/cypress/fixtures/imports.js b/cypress-tests/cypress/fixtures/imports.js new file mode 100644 index 000000000000..808dd4d7d5e0 --- /dev/null +++ b/cypress-tests/cypress/fixtures/imports.js @@ -0,0 +1,41 @@ +import captureBody from "./capture-flow-body.json"; +import confirmBody from "./confirm-body.json"; +import apiKeyCreateBody from "./create-api-key-body.json"; +import createConfirmPaymentBody from "./create-confirm-body.json"; +import createConnectorBody from "./create-connector-body.json"; +import customerCreateBody from "./create-customer-body.json"; +import citConfirmBody from "./create-mandate-cit.json"; +import mitConfirmBody from "./create-mandate-mit.json"; +import createPaymentBody from "./create-payment-body.json"; +import { + default as createPayoutBody, + default as initialCreatePayoutBody, +} from "./create-payout-confirm-body.json"; +import pmIdConfirmBody from "./create-pm-id-mit.json"; +import listRefundCall from "./list-refund-call-body.json"; +import merchantCreateBody from "./merchant-create-body.json"; +import refundBody from "./refund-flow-body.json"; +import routingConfigBody from "./routing-config-body.json"; +import SaveCardConfirmBody from "./save-card-confirm-body.json"; +import voidBody from "./void-payment-body.json"; + +export { + SaveCardConfirmBody, + apiKeyCreateBody, + captureBody, + citConfirmBody, + confirmBody, + createConfirmPaymentBody, + createConnectorBody, + createPaymentBody, + createPayoutBody, + customerCreateBody, + initialCreatePayoutBody, + listRefundCall, + merchantCreateBody, + mitConfirmBody, + pmIdConfirmBody, + refundBody, + routingConfigBody, + voidBody, +}; From 8449a7fa629e0732beecc3c68b1d610b74d67f7f Mon Sep 17 00:00:00 2001 From: PiX <69745008+pixincreate@users.noreply.github.com> Date: Wed, 3 Jul 2024 12:45:34 +0530 Subject: [PATCH 2/4] refactor(cypress): simplify payout imports --- .../e2e/PayoutTest/00005-SavePayout.cy.js | 22 +++++++++---------- cypress-tests/cypress/fixtures/imports.js | 6 +---- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.js b/cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.js index 5f4eeca56e3f..407e13632652 100644 --- a/cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.js +++ b/cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.js @@ -3,7 +3,7 @@ import * as utils from "../PayoutUtils/utils"; import * as fixtures from "../../fixtures/imports"; let globalState; -let createPayoutBody; +let payoutBody; describe("[Payout] Saved Card", () => { let should_continue = true; // variable that will be used to skip tests if a previous test fails @@ -34,7 +34,7 @@ describe("[Payout] Saved Card", () => { // This is needed to get customer payment methods beforeEach("seed global state", () => { - createPayoutBody = Cypress._.cloneDeep(fixtures.initialCreatePayoutBody); + payoutBody = Cypress._.cloneDeep(fixtures.createPayoutBody); }); it("create customer", () => { @@ -61,7 +61,7 @@ describe("[Payout] Saved Card", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createConfirmWithTokenPayoutTest( - createPayoutBody, + payoutBody, req_data, res_data, true, @@ -94,7 +94,7 @@ describe("[Payout] Saved Card", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createConfirmPayoutTest( - createPayoutBody, + payoutBody, req_data, res_data, true, @@ -117,7 +117,7 @@ describe("[Payout] Saved Card", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createConfirmWithTokenPayoutTest( - createPayoutBody, + payoutBody, req_data, res_data, true, @@ -164,9 +164,9 @@ describe("[Payout] Saved Bank transfer", () => { "[Payout] [Bank Transfer] Onboard Customer Prior to Transaction", () => { let should_continue = true; // variable that will be used to skip tests if a previous test fails - beforeEach("reset createPayoutBody", () => { - createPayoutBody = Cypress._.cloneDeep( - fixtures.initialCreatePayoutBody + beforeEach("reset payoutBody", () => { + payoutBody = Cypress._.cloneDeep( + fixtures.createPayoutBody ); }); @@ -194,7 +194,7 @@ describe("[Payout] Saved Bank transfer", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createConfirmWithTokenPayoutTest( - createPayoutBody, + payoutBody, req_data, res_data, true, @@ -228,7 +228,7 @@ describe("[Payout] Saved Bank transfer", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createConfirmPayoutTest( - createPayoutBody, + payoutBody, req_data, res_data, true, @@ -251,7 +251,7 @@ describe("[Payout] Saved Bank transfer", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.createConfirmWithTokenPayoutTest( - createPayoutBody, + payoutBody, req_data, res_data, true, diff --git a/cypress-tests/cypress/fixtures/imports.js b/cypress-tests/cypress/fixtures/imports.js index 808dd4d7d5e0..aba05d6e7ab6 100644 --- a/cypress-tests/cypress/fixtures/imports.js +++ b/cypress-tests/cypress/fixtures/imports.js @@ -7,10 +7,7 @@ import customerCreateBody from "./create-customer-body.json"; import citConfirmBody from "./create-mandate-cit.json"; import mitConfirmBody from "./create-mandate-mit.json"; import createPaymentBody from "./create-payment-body.json"; -import { - default as createPayoutBody, - default as initialCreatePayoutBody, -} from "./create-payout-confirm-body.json"; +import createPayoutBody from "./create-payout-confirm-body.json"; import pmIdConfirmBody from "./create-pm-id-mit.json"; import listRefundCall from "./list-refund-call-body.json"; import merchantCreateBody from "./merchant-create-body.json"; @@ -30,7 +27,6 @@ export { createPaymentBody, createPayoutBody, customerCreateBody, - initialCreatePayoutBody, listRefundCall, merchantCreateBody, mitConfirmBody, From 5925156de768ee91ed81982d2a7b411aca63f216 Mon Sep 17 00:00:00 2001 From: PiX <69745008+pixincreate@users.noreply.github.com> Date: Wed, 3 Jul 2024 13:10:42 +0530 Subject: [PATCH 3/4] Chore: lints --- .../e2e/PaymentTest/00003-NoThreeDSAutoCapture.cy.js | 2 +- .../e2e/PaymentTest/00004-ThreeDSAutoCapture.cy.js | 7 +++---- .../PaymentTest/00005-NoThreeDSManualCapture.cy.js | 9 ++------- .../cypress/e2e/PaymentTest/00006-VoidPayment.cy.js | 2 +- .../cypress/e2e/PaymentTest/00007-SyncPayment.cy.js | 5 ++--- .../cypress/e2e/PaymentTest/00008-RefundPayment.cy.js | 2 +- .../cypress/e2e/PaymentTest/00009-SyncRefund.cy.js | 2 +- .../PaymentTest/00010-CreateSingleuseMandate.cy.js | 2 +- .../e2e/PaymentTest/00011-CreateMultiuseMandate.cy.js | 5 ++--- .../e2e/PaymentTest/00012-ListAndRevokeMandate.cy.js | 2 +- .../cypress/e2e/PaymentTest/00013-SaveCardFlow.cy.js | 11 +++++------ .../e2e/PaymentTest/00014-ZeroAuthMandate.cy.js | 5 ++--- .../e2e/PaymentTest/00015-ThreeDSManualCapture.cy.js | 5 ++--- .../cypress/e2e/PaymentTest/00016-BankTransfers.cy.js | 4 ++-- .../cypress/e2e/PaymentTest/00017-BankRedirect.cy.js | 4 ++-- .../e2e/PaymentTest/00018-MandatesUsingPMID.cy.js | 4 ++-- cypress-tests/cypress/e2e/PaymentTest/00019-UPI.cy.js | 4 ++-- .../cypress/e2e/PayoutTest/00000-AccountCreate.cy.js | 2 +- .../cypress/e2e/PayoutTest/00001-CustomerCreate.cy.js | 2 +- .../e2e/PayoutTest/00002-ConnectorCreate.cy.js | 2 +- .../cypress/e2e/PayoutTest/00003-CardTest.cy.js | 4 ++-- .../cypress/e2e/PayoutTest/00004-BankTransfer.cy.js | 4 ++-- .../cypress/e2e/PayoutTest/00005-SavePayout.cy.js | 8 +++----- .../e2e/RoutingTest/00000-PaymentRoutingTest.cy.js | 4 ++-- .../e2e/RoutingUtils/{Common.js => Commons.js} | 0 cypress-tests/cypress/e2e/RoutingUtils/utils.js | 2 +- cypress-tests/cypress/fixtures/imports.js | 4 ++-- 27 files changed, 47 insertions(+), 60 deletions(-) rename cypress-tests/cypress/e2e/RoutingUtils/{Common.js => Commons.js} (100%) diff --git a/cypress-tests/cypress/e2e/PaymentTest/00003-NoThreeDSAutoCapture.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00003-NoThreeDSAutoCapture.cy.js index 80f15230e13d..e8c719cebc74 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00003-NoThreeDSAutoCapture.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00003-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 getConnectorDetails, * as utils from "../PaymentUtils/Utils"; let globalState; diff --git a/cypress-tests/cypress/e2e/PaymentTest/00004-ThreeDSAutoCapture.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00004-ThreeDSAutoCapture.cy.js index 29a9ed6f7013..91dc2b1c382c 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00004-ThreeDSAutoCapture.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00004-ThreeDSAutoCapture.cy.js @@ -1,8 +1,7 @@ -import confirmBody from "../../fixtures/confirm-body.json"; -import State from "../../utils/State"; -import getConnectorDetails from "../PaymentUtils/utils"; -import * as utils from "../PaymentUtils/utils"; import * as fixtures from "../../fixtures/imports"; +import State from "../../utils/State"; +import getConnectorDetails, * as utils from "../PaymentUtils/Utils"; + let globalState; describe("Card - ThreeDS payment flow test", () => { diff --git a/cypress-tests/cypress/e2e/PaymentTest/00005-NoThreeDSManualCapture.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00005-NoThreeDSManualCapture.cy.js index 9888d207085d..6a74e6fb910a 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00005-NoThreeDSManualCapture.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00005-NoThreeDSManualCapture.cy.js @@ -1,11 +1,6 @@ -import captureBody from "../../fixtures/capture-flow-body.json"; -import confirmBody from "../../fixtures/confirm-body.json"; -import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json"; -import createPaymentBody from "../../fixtures/create-payment-body.json"; -import State from "../../utils/State"; -import getConnectorDetails from "../PaymentUtils/utils"; -import * as utils from "../PaymentUtils/utils"; import * as fixtures from "../../fixtures/imports"; +import State from "../../utils/State"; +import getConnectorDetails, * as utils from "../PaymentUtils/Utils"; let globalState; diff --git a/cypress-tests/cypress/e2e/PaymentTest/00006-VoidPayment.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00006-VoidPayment.cy.js index edb897ce4e6f..9735a74adfd1 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00006-VoidPayment.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00006-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 getConnectorDetails, * as utils from "../PaymentUtils/Utils"; let globalState; diff --git a/cypress-tests/cypress/e2e/PaymentTest/00007-SyncPayment.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00007-SyncPayment.cy.js index 7c259af02b6e..95d86a62278a 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00007-SyncPayment.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00007-SyncPayment.cy.js @@ -1,7 +1,6 @@ -import State from "../../utils/State"; -import getConnectorDetails from "../PaymentUtils/utils"; -import * as utils from "../PaymentUtils/utils"; import * as fixtures from "../../fixtures/imports"; +import State from "../../utils/State"; +import getConnectorDetails, * as utils from "../PaymentUtils/Utils"; let globalState; diff --git a/cypress-tests/cypress/e2e/PaymentTest/00008-RefundPayment.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00008-RefundPayment.cy.js index 39c393a47cb6..5bb39231d9d5 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00008-RefundPayment.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00008-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 getConnectorDetails, * as utils from "../PaymentUtils/Utils"; let globalState; diff --git a/cypress-tests/cypress/e2e/PaymentTest/00009-SyncRefund.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00009-SyncRefund.cy.js index f16e75edb686..617a0e721b94 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00009-SyncRefund.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00009-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 getConnectorDetails, * as utils from "../PaymentUtils/Utils"; let globalState; diff --git a/cypress-tests/cypress/e2e/PaymentTest/00010-CreateSingleuseMandate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00010-CreateSingleuseMandate.cy.js index 52bc315fdeba..85c153831d3e 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00010-CreateSingleuseMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00010-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 getConnectorDetails, * as utils from "../PaymentUtils/Utils"; let globalState; diff --git a/cypress-tests/cypress/e2e/PaymentTest/00011-CreateMultiuseMandate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00011-CreateMultiuseMandate.cy.js index f40b3f770f71..3596af70fe1b 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00011-CreateMultiuseMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00011-CreateMultiuseMandate.cy.js @@ -1,7 +1,6 @@ -import State from "../../utils/State"; -import getConnectorDetails from "../PaymentUtils/utils"; -import * as utils from "../PaymentUtils/utils"; import * as fixtures from "../../fixtures/imports"; +import State from "../../utils/State"; +import getConnectorDetails, * as utils from "../PaymentUtils/Utils"; let globalState; diff --git a/cypress-tests/cypress/e2e/PaymentTest/00012-ListAndRevokeMandate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00012-ListAndRevokeMandate.cy.js index e8712d76ee97..b732f7582f2d 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00012-ListAndRevokeMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00012-ListAndRevokeMandate.cy.js @@ -1,6 +1,6 @@ -import * as utils from "../PaymentUtils/utils"; import * as fixtures from "../../fixtures/imports"; import State from "../../utils/State"; +import * as utils from "../PaymentUtils/Utils"; let globalState; diff --git a/cypress-tests/cypress/e2e/PaymentTest/00013-SaveCardFlow.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00013-SaveCardFlow.cy.js index 9556261d4820..f4d479bbdd6c 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00013-SaveCardFlow.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00013-SaveCardFlow.cy.js @@ -1,7 +1,6 @@ -import getConnectorDetails from "../PaymentUtils/utils"; -import * as utils from "../PaymentUtils/utils"; -import State from "../../utils/State"; import * as fixtures from "../../fixtures/imports"; +import State from "../../utils/State"; +import getConnectorDetails, * as utils from "../PaymentUtils/Utils"; let globalState; @@ -78,7 +77,7 @@ describe("Card - SaveCard payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.saveCardConfirmCallTest( - fixtures.SaveCardConfirmBody, + fixtures.saveCardConfirmBody, req_data, res_data, globalState @@ -155,7 +154,7 @@ describe("Card - SaveCard payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.saveCardConfirmCallTest( - fixtures.SaveCardConfirmBody, + fixtures.saveCardConfirmBody, req_data, res_data, globalState @@ -253,7 +252,7 @@ describe("Card - SaveCard payment flow test", () => { let req_data = data["Request"]; let res_data = data["Response"]; cy.saveCardConfirmCallTest( - fixtures.SaveCardConfirmBody, + fixtures.saveCardConfirmBody, req_data, res_data, globalState diff --git a/cypress-tests/cypress/e2e/PaymentTest/00014-ZeroAuthMandate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00014-ZeroAuthMandate.cy.js index 5078567022dd..a6e085658c64 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00014-ZeroAuthMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00014-ZeroAuthMandate.cy.js @@ -1,7 +1,6 @@ -import State from "../../utils/State"; -import getConnectorDetails from "../PaymentUtils/utils"; -import * as utils from "../PaymentUtils/utils"; import * as fixtures from "../../fixtures/imports"; +import State from "../../utils/State"; +import getConnectorDetails, * as utils from "../PaymentUtils/Utils"; let globalState; diff --git a/cypress-tests/cypress/e2e/PaymentTest/00015-ThreeDSManualCapture.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00015-ThreeDSManualCapture.cy.js index 6f1ed9472a97..3c9fca1428f4 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00015-ThreeDSManualCapture.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00015-ThreeDSManualCapture.cy.js @@ -1,8 +1,7 @@ -import getConnectorDetails from "../PaymentUtils/utils"; -import State from "../../utils/State"; import captureBody from "../../fixtures/capture-flow-body.json"; -import * as utils from "../PaymentUtils/utils"; import * as fixtures from "../../fixtures/imports"; +import State from "../../utils/State"; +import getConnectorDetails, * as utils from "../PaymentUtils/Utils"; let globalState; diff --git a/cypress-tests/cypress/e2e/PaymentTest/00016-BankTransfers.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00016-BankTransfers.cy.js index ba88284dc19d..ee83f1aa4485 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00016-BankTransfers.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00016-BankTransfers.cy.js @@ -1,6 +1,6 @@ -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 "../PaymentUtils/Utils"; let globalState; diff --git a/cypress-tests/cypress/e2e/PaymentTest/00017-BankRedirect.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00017-BankRedirect.cy.js index 1afd13bb69f8..1a355d56e8bd 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00017-BankRedirect.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00017-BankRedirect.cy.js @@ -1,6 +1,6 @@ -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 "../PaymentUtils/Utils"; let globalState; diff --git a/cypress-tests/cypress/e2e/PaymentTest/00018-MandatesUsingPMID.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00018-MandatesUsingPMID.cy.js index bc07af101899..e943b80ffecf 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00018-MandatesUsingPMID.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00018-MandatesUsingPMID.cy.js @@ -1,6 +1,6 @@ -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 "../PaymentUtils/Utils"; let globalState; diff --git a/cypress-tests/cypress/e2e/PaymentTest/00019-UPI.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00019-UPI.cy.js index ad30681801da..72c99d2d19d1 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00019-UPI.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00019-UPI.cy.js @@ -1,6 +1,6 @@ -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 "../PaymentUtils/Utils"; let globalState; diff --git a/cypress-tests/cypress/e2e/PayoutTest/00000-AccountCreate.cy.js b/cypress-tests/cypress/e2e/PayoutTest/00000-AccountCreate.cy.js index 68d0bb458a11..75cc93a49844 100644 --- a/cypress-tests/cypress/e2e/PayoutTest/00000-AccountCreate.cy.js +++ b/cypress-tests/cypress/e2e/PayoutTest/00000-AccountCreate.cy.js @@ -1,5 +1,5 @@ -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/PayoutTest/00001-CustomerCreate.cy.js index 8b42f91c1f2a..cfc55ceef9df 100644 --- a/cypress-tests/cypress/e2e/PayoutTest/00001-CustomerCreate.cy.js +++ b/cypress-tests/cypress/e2e/PayoutTest/00001-CustomerCreate.cy.js @@ -1,5 +1,5 @@ -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/PayoutTest/00002-ConnectorCreate.cy.js index d018ee20491b..0ff3fab06ce7 100644 --- a/cypress-tests/cypress/e2e/PayoutTest/00002-ConnectorCreate.cy.js +++ b/cypress-tests/cypress/e2e/PayoutTest/00002-ConnectorCreate.cy.js @@ -1,5 +1,5 @@ -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/PayoutTest/00003-CardTest.cy.js index eed8cbabf3a2..6d6558897868 100644 --- a/cypress-tests/cypress/e2e/PayoutTest/00003-CardTest.cy.js +++ b/cypress-tests/cypress/e2e/PayoutTest/00003-CardTest.cy.js @@ -1,6 +1,6 @@ -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 "../PayoutUtils/Utils"; let globalState; diff --git a/cypress-tests/cypress/e2e/PayoutTest/00004-BankTransfer.cy.js b/cypress-tests/cypress/e2e/PayoutTest/00004-BankTransfer.cy.js index da7b73a6648b..2d16aed8a3bb 100644 --- a/cypress-tests/cypress/e2e/PayoutTest/00004-BankTransfer.cy.js +++ b/cypress-tests/cypress/e2e/PayoutTest/00004-BankTransfer.cy.js @@ -1,6 +1,6 @@ -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 "../PayoutUtils/Utils"; let globalState; diff --git a/cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.js b/cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.js index 407e13632652..5a8103a0de97 100644 --- a/cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.js +++ b/cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.js @@ -1,6 +1,6 @@ -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 "../PayoutUtils/Utils"; let globalState; let payoutBody; @@ -165,9 +165,7 @@ describe("[Payout] Saved Bank transfer", () => { () => { let should_continue = true; // variable that will be used to skip tests if a previous test fails beforeEach("reset payoutBody", () => { - payoutBody = Cypress._.cloneDeep( - fixtures.createPayoutBody - ); + payoutBody = Cypress._.cloneDeep(fixtures.createPayoutBody); }); it("create customer", () => { diff --git a/cypress-tests/cypress/e2e/RoutingTest/00000-PaymentRoutingTest.cy.js b/cypress-tests/cypress/e2e/RoutingTest/00000-PaymentRoutingTest.cy.js index 235ebbec48e2..16b84462a986 100644 --- a/cypress-tests/cypress/e2e/RoutingTest/00000-PaymentRoutingTest.cy.js +++ b/cypress-tests/cypress/e2e/RoutingTest/00000-PaymentRoutingTest.cy.js @@ -1,6 +1,6 @@ -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 "../RoutingUtils/Utils"; let globalState; diff --git a/cypress-tests/cypress/e2e/RoutingUtils/Common.js b/cypress-tests/cypress/e2e/RoutingUtils/Commons.js similarity index 100% rename from cypress-tests/cypress/e2e/RoutingUtils/Common.js rename to cypress-tests/cypress/e2e/RoutingUtils/Commons.js diff --git a/cypress-tests/cypress/e2e/RoutingUtils/utils.js b/cypress-tests/cypress/e2e/RoutingUtils/utils.js index 5b0c656796ef..9d21338bb5f1 100644 --- a/cypress-tests/cypress/e2e/RoutingUtils/utils.js +++ b/cypress-tests/cypress/e2e/RoutingUtils/utils.js @@ -1,4 +1,4 @@ -import { connectorDetails as commonConnectorDetails } from "./Common.js"; +import { connectorDetails as commonConnectorDetails } from "./Commons.js"; const connectorDetails = { common: commonConnectorDetails, diff --git a/cypress-tests/cypress/fixtures/imports.js b/cypress-tests/cypress/fixtures/imports.js index aba05d6e7ab6..e70e926d8633 100644 --- a/cypress-tests/cypress/fixtures/imports.js +++ b/cypress-tests/cypress/fixtures/imports.js @@ -13,11 +13,10 @@ import listRefundCall from "./list-refund-call-body.json"; import merchantCreateBody from "./merchant-create-body.json"; import refundBody from "./refund-flow-body.json"; import routingConfigBody from "./routing-config-body.json"; -import SaveCardConfirmBody from "./save-card-confirm-body.json"; +import saveCardConfirmBody from "./save-card-confirm-body.json"; import voidBody from "./void-payment-body.json"; export { - SaveCardConfirmBody, apiKeyCreateBody, captureBody, citConfirmBody, @@ -33,5 +32,6 @@ export { pmIdConfirmBody, refundBody, routingConfigBody, + saveCardConfirmBody, voidBody, }; From 2b431ff84b397f9b7308683b20697e1f4129aafa Mon Sep 17 00:00:00 2001 From: PiX <69745008+pixincreate@users.noreply.github.com> Date: Fri, 5 Jul 2024 13:31:13 +0530 Subject: [PATCH 4/4] fix mandates --- .../cypress/e2e/PaymentTest/00012-ListAndRevokeMandate.cy.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress-tests/cypress/e2e/PaymentTest/00012-ListAndRevokeMandate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00012-ListAndRevokeMandate.cy.js index b732f7582f2d..9091135d5396 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00012-ListAndRevokeMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00012-ListAndRevokeMandate.cy.js @@ -1,6 +1,6 @@ import * as fixtures from "../../fixtures/imports"; import State from "../../utils/State"; -import * as utils from "../PaymentUtils/Utils"; +import getConnectorDetails, * as utils from "../PaymentUtils/Utils"; let globalState; @@ -28,7 +28,7 @@ describe("Card - SingleUse Mandates flow test", () => { it("Confirm No 3DS CIT", () => { console.log("confirm -> " + globalState.get("connectorId")); - let data = fixtures.getConnectorDetails(globalState.get("connectorId"))[ + let data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["MandateSingleUseNo3DSAutoCapture"]; let req_data = data["Request"];