diff --git a/cypress-tests/cypress/e2e/PaymentTest/00000-AccountCreate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00000-AccountCreate.cy.js index f58eb194db71..821a22bed3cb 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00000-AccountCreate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00000-AccountCreate.cy.js @@ -7,17 +7,17 @@ describe("Account Create flow test", () => { before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); - console.log("seeding globalState -> " + JSON.stringify(globalState)); }); }); + after("flush global state", () => { - console.log("flushing globalState -> " + JSON.stringify(globalState)); cy.task("setGlobalState", globalState.data); }); it("merchant-create-call-test", () => { cy.merchantCreateCallTest(merchantCreateBody, globalState); }); + it("api-key-create-call-test", () => { cy.apiKeyCreateTest(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 996ec85ee31a..d51a2f78ae95 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00001-CustomerCreate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00001-CustomerCreate.cy.js @@ -7,13 +7,13 @@ describe("Customer Create flow test", () => { before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); - console.log("seeding globalState -> " + JSON.stringify(globalState)); }); }); + after("flush global state", () => { - console.log("flushing globalState -> " + JSON.stringify(globalState)); cy.task("setGlobalState", globalState.data); }); + it("customer-create-call-test", () => { cy.createCustomerCallTest(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 85a908da1a86..439850d4cc29 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00002-ConnectorCreate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00002-ConnectorCreate.cy.js @@ -1,5 +1,6 @@ import createConnectorBody from "../../fixtures/create-connector-body.json"; import State from "../../utils/State"; +import { payment_methods_enabled } from "../PaymentUtils/Commons"; let globalState; describe("Connector Account Create flow test", () => { @@ -14,6 +15,10 @@ describe("Connector Account Create flow test", () => { }); it("connector-create-call-test", () => { - cy.createConnectorCallTest(createConnectorBody, globalState); + cy.createConnectorCallTest( + 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 2dfedbb83d31..2267c1ab591a 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00003-NoThreeDSAutoCapture.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00003-NoThreeDSAutoCapture.cy.js @@ -2,12 +2,13 @@ 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 getConnectorDetails, * as utils from "../PaymentUtils/utils"; let globalState; describe("Card - NoThreeDS payment flow test", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); @@ -18,15 +19,12 @@ describe("Card - NoThreeDS payment flow test", () => { cy.task("setGlobalState", globalState.data); }); + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); context("Card-NoThreeDS payment flow test Create and confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ "PaymentIntent" @@ -39,7 +37,7 @@ describe("Card - NoThreeDS payment flow test", () => { res_data, "no_three_ds", "automatic", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -66,14 +64,6 @@ describe("Card - NoThreeDS payment flow test", () => { }); context("Card-NoThreeDS payment flow test Create+Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("create+confirm-payment-call-test", () => { console.log("confirm -> " + globalState.get("connectorId")); let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ @@ -87,7 +77,7 @@ describe("Card - NoThreeDS payment flow test", () => { res_data, "no_three_ds", "automatic", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00004-ThreeDSAutoCapture.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00004-ThreeDSAutoCapture.cy.js index 7ae900c833a8..c417c0131962 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00004-ThreeDSAutoCapture.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00004-ThreeDSAutoCapture.cy.js @@ -1,26 +1,25 @@ 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 getConnectorDetails, * as utils from "../PaymentUtils/utils"; let globalState; describe("Card - ThreeDS payment flow test", () => { let should_continue = true; // variable that will be used to skip tests if a previous test fails - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); }); }); + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + afterEach("flush global state", () => { cy.task("setGlobalState", globalState.data); }); @@ -37,7 +36,7 @@ describe("Card - ThreeDS payment flow test", () => { res_data, "three_ds", "automatic", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00005-NoThreeDSManualCapture.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00005-NoThreeDSManualCapture.cy.js index 8fa262fd0694..027a04031736 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00005-NoThreeDSManualCapture.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00005-NoThreeDSManualCapture.cy.js @@ -3,12 +3,13 @@ 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 getConnectorDetails, * as utils from "../PaymentUtils/utils"; let globalState; describe("Card - NoThreeDS Manual payment flow test", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); @@ -19,16 +20,14 @@ describe("Card - NoThreeDS Manual payment flow test", () => { cy.task("setGlobalState", globalState.data); }); + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + context("Card - NoThreeDS Manual Full Capture payment flow test", () => { context("payment Create and Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" @@ -41,7 +40,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => { res_data, "no_three_ds", "manual", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -86,14 +85,6 @@ describe("Card - NoThreeDS Manual payment flow test", () => { }); context("Payment Create+Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("create+confirm-payment-call-test", () => { console.log("confirm -> " + globalState.get("connectorId")); let data = getConnectorDetails(globalState.get("connectorId"))[ @@ -108,7 +99,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => { res_data, "no_three_ds", "manual", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -140,14 +131,6 @@ describe("Card - NoThreeDS Manual payment flow test", () => { "Card - NoThreeDS Manual Partial Capture payment flow test - Create and Confirm", () => { context("payment Create and Payment Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" @@ -160,7 +143,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => { res_data, "no_three_ds", "manual", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -183,7 +166,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => { req_data, res_data, true, - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -210,14 +193,6 @@ describe("Card - NoThreeDS Manual payment flow test", () => { }); context("payment + Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("create+confirm-payment-call-test", () => { console.log("confirm -> " + globalState.get("connectorId")); let data = getConnectorDetails(globalState.get("connectorId"))[ @@ -232,7 +207,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => { res_data, "no_three_ds", "manual", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -258,6 +233,6 @@ describe("Card - NoThreeDS Manual payment flow test", () => { cy.retrievePaymentCallTest(globalState); }); }); - }, + } ); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00006-VoidPayment.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00006-VoidPayment.cy.js index dea9d9e54061..e1dd526563e7 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00006-VoidPayment.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00006-VoidPayment.cy.js @@ -2,12 +2,13 @@ import confirmBody from "../../fixtures/confirm-body.json"; import createPaymentBody from "../../fixtures/create-payment-body.json"; import voidBody from "../../fixtures/void-payment-body.json"; 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; describe("Card - NoThreeDS Manual payment flow test", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); @@ -18,15 +19,13 @@ describe("Card - NoThreeDS Manual payment flow test", () => { cy.task("setGlobalState", globalState.data); }); - context("Card - void payment in Requires_capture state flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + context("Card - void payment in Requires_capture state flow test", () => { it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ "PaymentIntent" @@ -39,7 +38,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => { res_data, "no_three_ds", "manual", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -77,14 +76,6 @@ describe("Card - NoThreeDS Manual payment flow test", () => { context( "Card - void payment in Requires_payment_method state flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" @@ -97,7 +88,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => { res_data, "no_three_ds", "manual", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -117,20 +108,12 @@ describe("Card - NoThreeDS Manual payment flow test", () => { if (should_continue) should_continue = utils.should_continue_further(res_data); }); - }, + } ); context( "Card - void payment in Requires_payment_method state flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" @@ -143,7 +126,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => { res_data, "no_three_ds", "manual", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -176,6 +159,6 @@ describe("Card - NoThreeDS Manual payment flow test", () => { 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 06e8b490ede2..bfdbe8d423ef 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00007-SyncPayment.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00007-SyncPayment.cy.js @@ -1,20 +1,13 @@ 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 getConnectorDetails, * as utils from "../PaymentUtils/utils"; let globalState; describe("Card - Sync payment flow test", () => { let should_continue = true; // variable that will be used to skip tests if a previous test fails - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); @@ -24,6 +17,13 @@ describe("Card - Sync payment flow test", () => { after("flush global state", () => { cy.task("setGlobalState", globalState.data); }); + + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ "PaymentIntent" @@ -36,7 +36,7 @@ describe("Card - Sync payment flow test", () => { res_data, "no_three_ds", "automatic", - globalState, + 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 f2d921d80ffc..5d36a1946c3e 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00008-RefundPayment.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00008-RefundPayment.cy.js @@ -4,15 +4,16 @@ 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 refundBody from "../../fixtures/refund-flow-body.json"; import listRefundCall from "../../fixtures/list-refund-call-body.json"; +import refundBody from "../../fixtures/refund-flow-body.json"; 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; describe("Card - Refund flow test", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); @@ -23,15 +24,13 @@ describe("Card - Refund flow test", () => { cy.task("setGlobalState", globalState.data); }); - context("Card - Full Refund flow test for No-3DS", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + context("Card - Full Refund flow test for No-3DS", () => { it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ "PaymentIntent" @@ -44,7 +43,7 @@ describe("Card - Refund flow test", () => { res_data, "no_three_ds", "automatic", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -84,14 +83,6 @@ describe("Card - Refund flow test", () => { }); context("Card - Partial Refund flow test for No-3DS", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ "PaymentIntent" @@ -104,7 +95,7 @@ describe("Card - Refund flow test", () => { res_data, "no_three_ds", "automatic", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -157,14 +148,6 @@ describe("Card - Refund flow test", () => { context( "Fully Refund Card-NoThreeDS payment flow test Create+Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("create+confirm-payment-call-test", () => { console.log("confirm -> " + globalState.get("connectorId")); let data = getConnectorDetails(globalState.get("connectorId"))[ @@ -178,7 +161,7 @@ describe("Card - Refund flow test", () => { res_data, "no_three_ds", "automatic", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -198,20 +181,12 @@ describe("Card - Refund flow test", () => { if (should_continue) should_continue = utils.should_continue_further(res_data); }); - }, + } ); context( "Partially Refund Card-NoThreeDS payment flow test Create+Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("create+confirm-payment-call-test", () => { console.log("confirm -> " + globalState.get("connectorId")); let data = getConnectorDetails(globalState.get("connectorId"))[ @@ -225,7 +200,7 @@ describe("Card - Refund flow test", () => { res_data, "no_three_ds", "automatic", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -267,18 +242,10 @@ describe("Card - Refund flow test", () => { if (should_continue) should_continue = utils.should_continue_further(res_data); }); - }, + } ); context("Card - Full Refund for fully captured No-3DS payment", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ "PaymentIntent" @@ -291,7 +258,7 @@ describe("Card - Refund flow test", () => { res_data, "no_three_ds", "manual", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -358,14 +325,6 @@ describe("Card - Refund flow test", () => { }); context("Card - Partial Refund for fully captured No-3DS payment", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ "PaymentIntent" @@ -378,7 +337,7 @@ describe("Card - Refund flow test", () => { res_data, "no_three_ds", "manual", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -458,14 +417,6 @@ describe("Card - Refund flow test", () => { }); context("Card - Full Refund for partially captured No-3DS payment", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ "PaymentIntent" @@ -478,7 +429,7 @@ describe("Card - Refund flow test", () => { res_data, "no_three_ds", "manual", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -545,14 +496,6 @@ describe("Card - Refund flow test", () => { }); context("Card - partial Refund for partially captured No-3DS payment", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ "PaymentIntent" @@ -565,7 +508,7 @@ describe("Card - Refund flow test", () => { res_data, "no_three_ds", "manual", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -634,14 +577,6 @@ describe("Card - Refund flow test", () => { context( "Card - Full Refund for Create + Confirm Automatic CIT and MIT payment flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("Confirm No 3DS CIT", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" @@ -657,7 +592,7 @@ describe("Card - Refund flow test", () => { true, "automatic", "new_mandate", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -669,7 +604,7 @@ describe("Card - Refund flow test", () => { 7000, true, "automatic", - globalState, + globalState ); }); @@ -679,7 +614,7 @@ describe("Card - Refund flow test", () => { 7000, true, "automatic", - globalState, + globalState ); }); @@ -704,235 +639,99 @@ describe("Card - Refund flow test", () => { if (should_continue) should_continue = utils.should_continue_further(res_data); }); - }, - ); -}); - -context("Card - Full Refund flow test for 3DS", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); } - }); + ); - before("seed global state", () => { - cy.task("getGlobalState").then((state) => { - globalState = new State(state); + context("Card - Full Refund flow test for 3DS", () => { + it("create-payment-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "PaymentIntent" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest( + createPaymentBody, + req_data, + res_data, + "three_ds", + "automatic", + globalState + ); + if (should_continue) + should_continue = utils.should_continue_further(res_data); }); - }); - - afterEach("flush global state", () => { - cy.task("setGlobalState", globalState.data); - }); - - it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PaymentIntent" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( - createPaymentBody, - req_data, - res_data, - "three_ds", - "automatic", - globalState, - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); - }); - - it("payment_methods-call-test", () => { - cy.paymentMethodsCallTest(globalState); - }); - - it("Confirm 3DS", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "3DSAutoCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.confirmCallTest(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"]; - cy.handleRedirection(globalState, expected_redirection); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "Refund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); - }); -}); - -context("Card - Partial Refund flow test for 3DS", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - - it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PaymentIntent" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( - createPaymentBody, - req_data, - res_data, - "three_ds", - "automatic", - globalState, - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); - }); - - it("payment_methods-call-test", () => { - cy.paymentMethodsCallTest(globalState); - }); - - it("Confirm 3DS", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "3DSAutoCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.confirmCallTest(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"]; - cy.handleRedirection(globalState, expected_redirection); - }); - - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); - - it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PartialRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 1200, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); - }); - - it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PartialRefund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 1200, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); - }); -}); - -context("Fully Refund Card-ThreeDS payment flow test Create+Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("create+confirm-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "3DSAutoCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createConfirmPaymentTest( - createConfirmPaymentBody, - req_data, - res_data, - "three_ds", - "automatic", - globalState, - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); - }); - - it("Handle redirection", () => { - let expected_redirection = confirmBody["return_url"]; - cy.handleRedirection(globalState, expected_redirection); - }); + it("payment_methods-call-test", () => { + cy.paymentMethodsCallTest(globalState); + }); - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); + it("Confirm 3DS", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "3DSAutoCapture" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); - it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "Refund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); - }); -}); + it("Handle redirection", () => { + let expected_redirection = confirmBody["return_url"]; + cy.handleRedirection(globalState, expected_redirection); + }); -context( - "Partially Refund Card-ThreeDS payment flow test Create+Confirm", - () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + it("retrieve-payment-call-test", () => { + cy.retrievePaymentCallTest(globalState); + }); - beforeEach(function () { - if (!should_continue) { - this.skip(); - } + it("refund-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "Refund" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState); + if (should_continue) + should_continue = utils.should_continue_further(res_data); }); + }); - it("create+confirm-payment-call-test", () => { + context("Card - Partial Refund flow test for 3DS", () => { + it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "3DSAutoCapture" + "PaymentIntent" ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.createConfirmPaymentTest( - createConfirmPaymentBody, + cy.createPaymentIntentTest( + createPaymentBody, req_data, res_data, "three_ds", "automatic", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); + it("payment_methods-call-test", () => { + cy.paymentMethodsCallTest(globalState); + }); + + it("Confirm 3DS", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "3DSAutoCapture" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.confirmCallTest(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"]; cy.handleRedirection(globalState, expected_redirection); @@ -948,7 +747,7 @@ context( ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 3000, globalState); + cy.refundCallTest(refundBody, req_data, res_data, 1200, globalState); if (should_continue) should_continue = utils.should_continue_further(res_data); }); @@ -959,346 +758,408 @@ context( ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 3000, globalState); + cy.refundCallTest(refundBody, req_data, res_data, 1200, globalState); if (should_continue) should_continue = utils.should_continue_further(res_data); }); + }); - it("sync-refund-call-test", () => { + context("Fully Refund Card-ThreeDS payment flow test Create+Confirm", () => { + it("create+confirm-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "SyncRefund" + "3DSAutoCapture" ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.syncRefundCallTest(req_data, res_data, globalState); + cy.createConfirmPaymentTest( + createConfirmPaymentBody, + req_data, + res_data, + "three_ds", + "automatic", + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); - }, -); - -context("Card - Full Refund for fully captured 3DS payment", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - - it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PaymentIntent" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( - createPaymentBody, - req_data, - res_data, - "three_ds", - "manual", - globalState, - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); - }); - it("payment_methods-call-test", () => { - cy.paymentMethodsCallTest(globalState); - }); + it("Handle redirection", () => { + let expected_redirection = confirmBody["return_url"]; + cy.handleRedirection(globalState, expected_redirection); + }); - it("Confirm 3DS", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "3DSManualCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); - }); + it("retrieve-payment-call-test", () => { + cy.retrievePaymentCallTest(globalState); + }); - it("Handle redirection", () => { - let expected_redirection = confirmBody["return_url"]; - cy.handleRedirection(globalState, expected_redirection); + it("refund-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "Refund" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); }); - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); + context( + "Partially Refund Card-ThreeDS payment flow test Create+Confirm", + () => { + it("create+confirm-payment-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["3DSAutoCapture"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createConfirmPaymentTest( + createConfirmPaymentBody, + req_data, + res_data, + "three_ds", + "automatic", + globalState + ); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); - it("capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "Capture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); - }); + it("Handle redirection", () => { + let expected_redirection = confirmBody["return_url"]; + cy.handleRedirection(globalState, expected_redirection); + }); - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); + it("retrieve-payment-call-test", () => { + cy.retrievePaymentCallTest(globalState); + }); - it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "Refund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); - }); -}); + it("refund-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PartialRefund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 3000, globalState); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); -context("Card - Partial Refund for fully captured 3DS payment", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + it("refund-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PartialRefund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 3000, globalState); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); - beforeEach(function () { - if (!should_continue) { - this.skip(); + it("sync-refund-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["SyncRefund"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.syncRefundCallTest(req_data, res_data, globalState); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); } - }); + ); - it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PaymentIntent" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( - createPaymentBody, - req_data, - res_data, - "three_ds", - "manual", - globalState, - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); - }); + context("Card - Full Refund for fully captured 3DS payment", () => { + it("create-payment-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "PaymentIntent" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest( + createPaymentBody, + req_data, + res_data, + "three_ds", + "manual", + globalState + ); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); - it("payment_methods-call-test", () => { - cy.paymentMethodsCallTest(globalState); - }); + it("payment_methods-call-test", () => { + cy.paymentMethodsCallTest(globalState); + }); - it("Confirm 3DS", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "3DSManualCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); - }); + it("Confirm 3DS", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "3DSManualCapture" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.confirmCallTest(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"]; - cy.handleRedirection(globalState, expected_redirection); - }); + it("Handle redirection", () => { + let expected_redirection = confirmBody["return_url"]; + cy.handleRedirection(globalState, expected_redirection); + }); - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); + it("retrieve-payment-call-test", () => { + cy.retrievePaymentCallTest(globalState); + }); - it("capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "Capture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); - }); + it("capture-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "Capture" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); + it("retrieve-payment-call-test", () => { + cy.retrievePaymentCallTest(globalState); + }); - it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "Refund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 5000, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); - }); - it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "Refund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 1500, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + it("refund-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "Refund" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); }); -}); -context("Card - Full Refund for partially captured 3DS payment", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + context("Card - Partial Refund for fully captured 3DS payment", () => { + it("create-payment-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "PaymentIntent" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest( + createPaymentBody, + req_data, + res_data, + "three_ds", + "manual", + globalState + ); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); + it("payment_methods-call-test", () => { + cy.paymentMethodsCallTest(globalState); + }); - it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PaymentIntent" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( - createPaymentBody, - req_data, - res_data, - "three_ds", - "manual", - globalState, - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); - }); + it("Confirm 3DS", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "3DSManualCapture" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); - it("payment_methods-call-test", () => { - cy.paymentMethodsCallTest(globalState); - }); + it("Handle redirection", () => { + let expected_redirection = confirmBody["return_url"]; + cy.handleRedirection(globalState, expected_redirection); + }); - it("Confirm 3DS", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "3DSManualCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); - }); + it("retrieve-payment-call-test", () => { + cy.retrievePaymentCallTest(globalState); + }); - it("Handle redirection", () => { - let expected_redirection = confirmBody["return_url"]; - cy.handleRedirection(globalState, expected_redirection); - }); + it("capture-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "Capture" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); + it("retrieve-payment-call-test", () => { + cy.retrievePaymentCallTest(globalState); + }); - it("capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PartialCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.captureCallTest(captureBody, req_data, res_data, 100, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + it("refund-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "Refund" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 5000, globalState); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); + it("refund-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "Refund" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 1500, globalState); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); }); - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); + context("Card - Full Refund for partially captured 3DS payment", () => { + it("create-payment-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "PaymentIntent" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest( + createPaymentBody, + req_data, + res_data, + "three_ds", + "manual", + globalState + ); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); - it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "Refund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 100, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); - }); -}); + it("payment_methods-call-test", () => { + cy.paymentMethodsCallTest(globalState); + }); -context("Card - partial Refund for partially captured 3DS payment", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails + it("Confirm 3DS", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "3DSManualCapture" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); + it("Handle redirection", () => { + let expected_redirection = confirmBody["return_url"]; + cy.handleRedirection(globalState, expected_redirection); + }); - it("create-payment-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PaymentIntent" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.createPaymentIntentTest( - createPaymentBody, - req_data, - res_data, - "three_ds", - "manual", - globalState, - ); - if (should_continue) - should_continue = utils.should_continue_further(res_data); - }); + it("retrieve-payment-call-test", () => { + cy.retrievePaymentCallTest(globalState); + }); - it("payment_methods-call-test", () => { - cy.paymentMethodsCallTest(globalState); - }); + it("capture-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "PartialCapture" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.captureCallTest(captureBody, req_data, res_data, 100, globalState); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); - it("Confirm 3DS", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "3DSManualCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - console.log("det -> " + data.card); - cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); - }); + it("retrieve-payment-call-test", () => { + cy.retrievePaymentCallTest(globalState); + }); - it("Handle redirection", () => { - let expected_redirection = confirmBody["return_url"]; - cy.handleRedirection(globalState, expected_redirection); + it("refund-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "Refund" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(refundBody, req_data, res_data, 100, globalState); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); }); - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); + context("Card - partial Refund for partially captured 3DS payment", () => { + it("create-payment-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "PaymentIntent" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest( + createPaymentBody, + req_data, + res_data, + "three_ds", + "manual", + globalState + ); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); - it("capture-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "PartialCapture" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.captureCallTest(captureBody, req_data, res_data, 100, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); - }); + it("payment_methods-call-test", () => { + cy.paymentMethodsCallTest(globalState); + }); - it("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); + it("Confirm 3DS", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "3DSManualCapture" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + console.log("det -> " + data.card); + cy.confirmCallTest(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"]; + cy.handleRedirection(globalState, expected_redirection); + }); - it("refund-call-test", () => { - let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "Refund" - ]; - let req_data = data["Request"]; - let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 50, globalState); - if (should_continue) - should_continue = utils.should_continue_further(res_data); + it("retrieve-payment-call-test", () => { + cy.retrievePaymentCallTest(globalState); + }); + + it("capture-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "PartialCapture" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.captureCallTest(captureBody, req_data, res_data, 100, globalState); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); + + it("retrieve-payment-call-test", () => { + cy.retrievePaymentCallTest(globalState); + }); + + it("refund-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "Refund" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.refundCallTest(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 0f14dad72d66..a66c22b06c0e 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00009-SyncRefund.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00009-SyncRefund.cy.js @@ -2,20 +2,13 @@ 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 from "../PaymentUtils/utils"; -import * as utils from "../PaymentUtils/utils"; +import getConnectorDetails, * as utils from "../PaymentUtils/utils"; let globalState; describe("Card - Sync Refund flow test", () => { let should_continue = true; // variable that will be used to skip tests if a previous test fails - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); @@ -26,6 +19,12 @@ describe("Card - Sync Refund flow test", () => { cy.task("setGlobalState", globalState.data); }); + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ "PaymentIntent" @@ -38,7 +37,7 @@ describe("Card - Sync Refund flow test", () => { res_data, "no_three_ds", "automatic", - globalState, + 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 00faf6dfcba7..bcbdd2527a6f 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00010-CreateSingleuseMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00010-CreateSingleuseMandate.cy.js @@ -2,12 +2,13 @@ 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 getConnectorDetails, * as utils from "../PaymentUtils/utils"; let globalState; describe("Card - SingleUse Mandates flow test", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); @@ -18,17 +19,15 @@ describe("Card - SingleUse Mandates flow test", () => { cy.task("setGlobalState", globalState.data); }); + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + context( "Card - NoThreeDS Create + Confirm Automatic CIT and MIT payment flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("Confirm No 3DS CIT", () => { console.log("confirm -> " + globalState.get("connectorId")); let data = getConnectorDetails(globalState.get("connectorId"))[ @@ -45,7 +44,7 @@ describe("Card - SingleUse Mandates flow test", () => { true, "automatic", "new_mandate", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -57,23 +56,15 @@ describe("Card - SingleUse Mandates flow test", () => { 7000, true, "automatic", - globalState, + globalState ); }); - }, + } ); context( "Card - NoThreeDS Create + Confirm Manual CIT and MIT payment flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("Confirm No 3DS CIT", () => { console.log("confirm -> " + globalState.get("connectorId")); let data = getConnectorDetails(globalState.get("connectorId"))[ @@ -90,7 +81,7 @@ describe("Card - SingleUse Mandates flow test", () => { true, "manual", "new_mandate", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -114,7 +105,7 @@ describe("Card - SingleUse Mandates flow test", () => { 6500, true, "manual", - globalState, + globalState ); }); @@ -133,20 +124,12 @@ describe("Card - SingleUse Mandates flow test", () => { it("list-mandate-call-test", () => { cy.listMandateCallTest(globalState); }); - }, + } ); context( "Card - ThreeDS Create + Confirm Manual CIT and MIT payment flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("Create No 3DS CIT", () => { console.log("confirm -> " + globalState.get("connectorId")); let data = getConnectorDetails(globalState.get("connectorId"))[ @@ -163,7 +146,7 @@ describe("Card - SingleUse Mandates flow test", () => { true, "manual", "new_mandate", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -187,13 +170,13 @@ describe("Card - SingleUse Mandates flow test", () => { 7000, true, "automatic", - globalState, + globalState ); }); it("list-mandate-call-test", () => { cy.listMandateCallTest(globalState); }); - }, + } ); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00011-CreateMultiuseMandate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00011-CreateMultiuseMandate.cy.js index 1dee7ea901f0..b2ee1924c4a0 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00011-CreateMultiuseMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00011-CreateMultiuseMandate.cy.js @@ -2,12 +2,13 @@ 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 getConnectorDetails, * as utils from "../PaymentUtils/utils"; let globalState; describe("Card - MultiUse Mandates flow test", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); @@ -18,17 +19,15 @@ describe("Card - MultiUse Mandates flow test", () => { cy.task("setGlobalState", globalState.data); }); + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + context( "Card - NoThreeDS Create + Confirm Automatic CIT and MIT payment flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("Confirm No 3DS CIT", () => { console.log("confirm -> " + globalState.get("connectorId")); let data = getConnectorDetails(globalState.get("connectorId"))[ @@ -45,7 +44,7 @@ describe("Card - MultiUse Mandates flow test", () => { true, "automatic", "new_mandate", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -57,7 +56,7 @@ describe("Card - MultiUse Mandates flow test", () => { 7000, true, "automatic", - globalState, + globalState ); }); it("Confirm No 3DS MIT", () => { @@ -66,23 +65,15 @@ describe("Card - MultiUse Mandates flow test", () => { 7000, true, "automatic", - globalState, + globalState ); }); - }, + } ); context( "Card - NoThreeDS Create + Confirm Manual CIT and MIT payment flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("Confirm No 3DS CIT", () => { console.log("confirm -> " + globalState.get("connectorId")); let data = getConnectorDetails(globalState.get("connectorId"))[ @@ -99,7 +90,7 @@ describe("Card - MultiUse Mandates flow test", () => { true, "manual", "new_mandate", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -123,7 +114,7 @@ describe("Card - MultiUse Mandates flow test", () => { 6500, true, "manual", - globalState, + globalState ); }); @@ -145,7 +136,7 @@ describe("Card - MultiUse Mandates flow test", () => { 6500, true, "manual", - globalState, + globalState ); }); @@ -160,20 +151,12 @@ describe("Card - MultiUse Mandates flow test", () => { if (should_continue) should_continue = utils.should_continue_further(res_data); }); - }, + } ); context( "Card - ThreeDS Create + Confirm Manual CIT and MIT payment flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("Confirm No 3DS CIT", () => { console.log("confirm -> " + globalState.get("connectorId")); let data = getConnectorDetails(globalState.get("connectorId"))[ @@ -190,7 +173,7 @@ describe("Card - MultiUse Mandates flow test", () => { true, "manual", "new_mandate", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -214,9 +197,9 @@ describe("Card - MultiUse Mandates flow test", () => { 6500, true, "automatic", - globalState, + globalState ); }); - }, + } ); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00012-ListAndRevokeMandate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00012-ListAndRevokeMandate.cy.js index 28ffacb829c8..0f23e3071776 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00012-ListAndRevokeMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00012-ListAndRevokeMandate.cy.js @@ -1,13 +1,14 @@ 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 getConnectorDetails, * as utils from "../PaymentUtils/utils"; import State from "../../utils/State"; let globalState; describe("Card - SingleUse Mandates flow test", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); @@ -18,17 +19,15 @@ describe("Card - SingleUse Mandates flow test", () => { cy.task("setGlobalState", globalState.data); }); + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + context( "Card - NoThreeDS Create + Confirm Automatic CIT and MIT payment flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("Confirm No 3DS CIT", () => { console.log("confirm -> " + globalState.get("connectorId")); let data = getConnectorDetails(globalState.get("connectorId"))[ @@ -45,7 +44,7 @@ describe("Card - SingleUse Mandates flow test", () => { true, "automatic", "new_mandate", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -57,7 +56,7 @@ describe("Card - SingleUse Mandates flow test", () => { 7000, true, "automatic", - globalState, + globalState ); }); @@ -72,6 +71,6 @@ describe("Card - SingleUse Mandates flow test", () => { it("revoke-revoked-mandate-call-test", () => { cy.revokeMandateCallTest(globalState); }); - }, + } ); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00013-SaveCardFlow.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00013-SaveCardFlow.cy.js index c31a24e39318..227144ee9f76 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00013-SaveCardFlow.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00013-SaveCardFlow.cy.js @@ -1,32 +1,30 @@ 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 createPaymentBody from "../../fixtures/create-payment-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 getConnectorDetails, * as utils from "../PaymentUtils/utils"; let globalState; describe("Card - SaveCard payment flow test", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); }); }); + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + context( "Save card for NoThreeDS automatic capture payment- Create+Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("customer-create-call-test", () => { cy.createCustomerCallTest(customerCreateBody, globalState); }); @@ -43,7 +41,7 @@ describe("Card - SaveCard payment flow test", () => { res_data, "no_three_ds", "automatic", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -69,7 +67,7 @@ describe("Card - SaveCard payment flow test", () => { res_data, "no_three_ds", "automatic", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -85,25 +83,17 @@ describe("Card - SaveCard payment flow test", () => { SaveCardConfirmBody, req_data, res_data, - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); - }, + } ); context( "Save card for NoThreeDS manual full capture payment- Create+Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("customer-create-call-test", () => { cy.createCustomerCallTest(customerCreateBody, globalState); }); @@ -120,7 +110,7 @@ describe("Card - SaveCard payment flow test", () => { res_data, "no_three_ds", "automatic", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -146,7 +136,7 @@ describe("Card - SaveCard payment flow test", () => { res_data, "no_three_ds", "manual", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -162,7 +152,7 @@ describe("Card - SaveCard payment flow test", () => { SaveCardConfirmBody, req_data, res_data, - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -182,20 +172,12 @@ describe("Card - SaveCard payment flow test", () => { if (should_continue) should_continue = utils.should_continue_further(res_data); }); - }, + } ); context( "Save card for NoThreeDS manual partial capture payment- Create + Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("customer-create-call-test", () => { cy.createCustomerCallTest(customerCreateBody, globalState); }); @@ -212,7 +194,7 @@ describe("Card - SaveCard payment flow test", () => { res_data, "no_three_ds", "automatic", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -238,7 +220,7 @@ describe("Card - SaveCard payment flow test", () => { res_data, "no_three_ds", "manual", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -254,7 +236,7 @@ describe("Card - SaveCard payment flow test", () => { SaveCardConfirmBody, req_data, res_data, - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -273,6 +255,6 @@ describe("Card - SaveCard payment flow test", () => { 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 d90d86d8c412..e7fdc618ca13 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00014-ZeroAuthMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00014-ZeroAuthMandate.cy.js @@ -1,12 +1,13 @@ 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 getConnectorDetails, * as utils from "../PaymentUtils/utils"; let globalState; describe("Card - SingleUse Mandates flow test", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); @@ -17,17 +18,15 @@ describe("Card - SingleUse Mandates flow test", () => { cy.task("setGlobalState", globalState.data); }); + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + context( "Card - NoThreeDS Create + Confirm Automatic CIT and Single use MIT payment flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("Confirm No 3DS CIT", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" @@ -42,7 +41,7 @@ describe("Card - SingleUse Mandates flow test", () => { true, "automatic", "setup_mandate", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -54,10 +53,10 @@ describe("Card - SingleUse Mandates flow test", () => { 7000, true, "automatic", - globalState, + globalState ); }); - }, + } ); context( "Card - NoThreeDS Create + Confirm Automatic CIT and Multi use MIT payment flow test", @@ -84,7 +83,7 @@ describe("Card - SingleUse Mandates flow test", () => { true, "automatic", "setup_mandate", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -96,7 +95,7 @@ describe("Card - SingleUse Mandates flow test", () => { 7000, true, "automatic", - globalState, + globalState ); }); it("Confirm No 3DS MIT", () => { @@ -105,9 +104,9 @@ describe("Card - SingleUse Mandates flow test", () => { 7000, true, "automatic", - globalState, + globalState ); }); - }, + } ); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00015-ThreeDSManualCapture.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00015-ThreeDSManualCapture.cy.js index 0aa4ad104923..155780dd6db0 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00015-ThreeDSManualCapture.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00015-ThreeDSManualCapture.cy.js @@ -1,14 +1,15 @@ -import createPaymentBody from "../../fixtures/create-payment-body.json"; -import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json"; +import captureBody from "../../fixtures/capture-flow-body.json"; import confirmBody from "../../fixtures/confirm-body.json"; -import getConnectorDetails from "../PaymentUtils/utils"; +import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json"; +import createPaymentBody from "../../fixtures/create-payment-body.json"; import State from "../../utils/State"; -import captureBody from "../../fixtures/capture-flow-body.json"; -import * as utils from "../PaymentUtils/utils"; +import getConnectorDetails, * as utils from "../PaymentUtils/utils"; let globalState; describe("Card - ThreeDS Manual payment flow test", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); @@ -19,16 +20,13 @@ describe("Card - ThreeDS Manual payment flow test", () => { cy.task("setGlobalState", globalState.data); }); + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); context("Card - ThreeDS Manual Full Capture payment flow test", () => { context("payment Create and Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" @@ -41,7 +39,7 @@ describe("Card - ThreeDS Manual payment flow test", () => { res_data, "three_ds", "manual", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -88,14 +86,6 @@ describe("Card - ThreeDS Manual payment flow test", () => { }); context("Payment Create+Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("create+confirm-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" @@ -108,7 +98,7 @@ describe("Card - ThreeDS Manual payment flow test", () => { res_data, "three_ds", "manual", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -144,14 +134,6 @@ describe("Card - ThreeDS Manual payment flow test", () => { "Card - ThreeDS Manual Partial Capture payment flow test - Create and Confirm", () => { context("payment Create and Payment Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" @@ -164,7 +146,7 @@ describe("Card - ThreeDS Manual payment flow test", () => { res_data, "three_ds", "manual", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -185,7 +167,7 @@ describe("Card - ThreeDS Manual payment flow test", () => { req_data, res_data, true, - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -217,14 +199,6 @@ describe("Card - ThreeDS Manual payment flow test", () => { }); context("payment + Confirm", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("create+confirm-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" @@ -237,7 +211,7 @@ describe("Card - ThreeDS Manual payment flow test", () => { res_data, "three_ds", "manual", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -267,6 +241,6 @@ describe("Card - ThreeDS Manual payment flow test", () => { cy.retrievePaymentCallTest(globalState); }); }); - }, + } ); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00016-BankTransfers.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00016-BankTransfers.cy.js index 6e132f5a1b6b..322ef75a4a57 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00016-BankTransfers.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00016-BankTransfers.cy.js @@ -6,6 +6,8 @@ import getConnectorDetails, * as utils from "../PaymentUtils/utils"; let globalState; describe("Bank Transfers", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); @@ -16,15 +18,13 @@ describe("Bank Transfers", () => { cy.task("setGlobalState", globalState.data); }); - context("Bank transfer - Pix forward flow", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + context("Bank transfer - Pix forward flow", () => { it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "bank_transfer_pm" @@ -37,7 +37,7 @@ describe("Bank Transfers", () => { res_data, "three_ds", "automatic", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -58,7 +58,7 @@ describe("Bank Transfers", () => { req_data, res_data, true, - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -70,7 +70,7 @@ describe("Bank Transfers", () => { cy.handleBankTransferRedirection( globalState, payment_method_type, - expected_redirection, + expected_redirection ); }); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00017-BankRedirect.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00017-BankRedirect.cy.js index f031f15140aa..9d2596c295db 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00017-BankRedirect.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00017-BankRedirect.cy.js @@ -6,6 +6,8 @@ import getConnectorDetails, * as utils from "../PaymentUtils/utils"; let globalState; describe("Bank Redirect tests", () => { + let should_continue = true; // variable that will be used to skip tests if a previous test fails + before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); @@ -16,19 +18,17 @@ describe("Bank Redirect tests", () => { cy.task("setGlobalState", globalState.data); }); + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + afterEach("flush global state", () => { cy.task("setGlobalState", globalState.data); }); context("Blik Create and Confirm flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "bank_redirect_pm" @@ -41,7 +41,7 @@ describe("Bank Redirect tests", () => { res_data, "three_ds", "automatic", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -62,7 +62,7 @@ describe("Bank Redirect tests", () => { req_data, res_data, true, - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -70,13 +70,6 @@ describe("Bank Redirect tests", () => { }); context("EPS Create and Confirm flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "bank_redirect_pm" @@ -89,7 +82,7 @@ describe("Bank Redirect tests", () => { res_data, "three_ds", "automatic", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -110,7 +103,7 @@ describe("Bank Redirect tests", () => { req_data, res_data, true, - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -123,20 +116,12 @@ describe("Bank Redirect tests", () => { cy.handleBankRedirectRedirection( globalState, payment_method_type, - expected_redirection, + expected_redirection ); }); }); context("iDEAL Create and Confirm flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "bank_redirect_pm" @@ -149,7 +134,7 @@ describe("Bank Redirect tests", () => { res_data, "three_ds", "automatic", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -170,7 +155,7 @@ describe("Bank Redirect tests", () => { req_data, res_data, true, - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -183,19 +168,12 @@ describe("Bank Redirect tests", () => { cy.handleBankRedirectRedirection( globalState, payment_method_type, - expected_redirection, + expected_redirection ); }); }); context("Giropay Create and Confirm flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "bank_redirect_pm" @@ -208,7 +186,7 @@ describe("Bank Redirect tests", () => { res_data, "three_ds", "automatic", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -229,7 +207,7 @@ describe("Bank Redirect tests", () => { req_data, res_data, true, - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -242,19 +220,12 @@ describe("Bank Redirect tests", () => { cy.handleBankRedirectRedirection( globalState, payment_method_type, - expected_redirection, + expected_redirection ); }); }); context("Sofort Create and Confirm flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "bank_redirect_pm" @@ -267,7 +238,7 @@ describe("Bank Redirect tests", () => { res_data, "three_ds", "automatic", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -288,7 +259,7 @@ describe("Bank Redirect tests", () => { req_data, res_data, true, - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -307,13 +278,6 @@ describe("Bank Redirect tests", () => { }); context("Przelewy24 Create and Confirm flow test", () => { - let should_continue = true; // variable that will be used to skip tests if a previous test fails - - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "bank_redirect_pm" diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Commons.js b/cypress-tests/cypress/e2e/PaymentUtils/Commons.js index e7dd9a85b38e..63ab38f5b898 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Commons.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Commons.js @@ -81,6 +81,133 @@ export const getCustomExchange = (overrides) => { }; }; +export const payment_methods_enabled = [ + { + payment_method: "card", + payment_method_types: [ + { + payment_method_type: "credit", + card_networks: [ + "AmericanExpress", + "Discover", + "Interac", + "JCB", + "Mastercard", + "Visa", + "DinersClub", + "UnionPay", + "RuPay", + ], + minimum_amount: 0, + maximum_amount: 68607706, + recurring_enabled: false, + installment_payment_enabled: true, + }, + { + payment_method_type: "debit", + card_networks: [ + "AmericanExpress", + "Discover", + "Interac", + "JCB", + "Mastercard", + "Visa", + "DinersClub", + "UnionPay", + "RuPay", + ], + minimum_amount: 0, + maximum_amount: 68607706, + recurring_enabled: false, + installment_payment_enabled: true, + }, + ], + }, + { + payment_method: "bank_transfer", + payment_method_types: [ + { + payment_method_type: "pix", + minimum_amount: 0, + maximum_amount: 68607706, + recurring_enabled: false, + installment_payment_enabled: true, + }, + ], + }, + { + payment_method: "bank_redirect", + payment_method_types: [ + { + payment_method_type: "ideal", + payment_experience: null, + card_networks: null, + accepted_currencies: null, + accepted_countries: null, + minimum_amount: 1, + maximum_amount: 68607706, + recurring_enabled: true, + installment_payment_enabled: true, + }, + { + payment_method_type: "giropay", + payment_experience: null, + card_networks: null, + accepted_currencies: null, + accepted_countries: null, + minimum_amount: 1, + maximum_amount: 68607706, + recurring_enabled: true, + installment_payment_enabled: true, + }, + { + payment_method_type: "sofort", + payment_experience: null, + card_networks: null, + accepted_currencies: null, + accepted_countries: null, + minimum_amount: 1, + maximum_amount: 68607706, + recurring_enabled: true, + installment_payment_enabled: true, + }, + { + payment_method_type: "eps", + payment_experience: null, + card_networks: null, + accepted_currencies: null, + accepted_countries: null, + minimum_amount: 1, + maximum_amount: 68607706, + recurring_enabled: true, + installment_payment_enabled: true, + }, + { + payment_method_type: "blik", + payment_experience: null, + card_networks: null, + accepted_currencies: null, + accepted_countries: null, + minimum_amount: 1, + maximum_amount: 68607706, + recurring_enabled: true, + installment_payment_enabled: true, + }, + { + payment_method_type: "przelewy24", + payment_experience: null, + card_networks: null, + accepted_currencies: null, + accepted_countries: null, + minimum_amount: 1, + maximum_amount: 68607706, + recurring_enabled: true, + installment_payment_enabled: true, + }, + ], + }, +]; + export const connectorDetails = { card_pm: { PaymentIntent: getCustomExchange({ diff --git a/cypress-tests/cypress/e2e/PayoutTest/00002-ConnectorCreate.cy.js b/cypress-tests/cypress/e2e/PayoutTest/00002-ConnectorCreate.cy.js index 16292914aa24..e60049af249a 100644 --- a/cypress-tests/cypress/e2e/PayoutTest/00002-ConnectorCreate.cy.js +++ b/cypress-tests/cypress/e2e/PayoutTest/00002-ConnectorCreate.cy.js @@ -6,12 +6,10 @@ describe("Connector Account Create flow test", () => { before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); - console.log("seeding globalState -> " + JSON.stringify(globalState)); }); }); after("flush global state", () => { - console.log("flushing globalState -> " + JSON.stringify(globalState)); cy.task("setGlobalState", globalState.data); }); diff --git a/cypress-tests/cypress/e2e/PayoutTest/00003-CardTest.cy.js b/cypress-tests/cypress/e2e/PayoutTest/00003-CardTest.cy.js index 4f563a689cea..da055d0bbdac 100644 --- a/cypress-tests/cypress/e2e/PayoutTest/00003-CardTest.cy.js +++ b/cypress-tests/cypress/e2e/PayoutTest/00003-CardTest.cy.js @@ -7,30 +7,25 @@ let globalState; describe("Card - Auto Fulfill", () => { let should_continue = true; // variable that will be used to skip tests if a previous test fails - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); - console.log("seeding globalState -> " + JSON.stringify(globalState)); - cy.task( - "cli_log", - "SEEDING GLOBAL STATE -> " + JSON.stringify(globalState), - ); + + // Check if the connector supports card payouts (based on the connector configuration in creds) + if (!globalState.get("payoutsExecution")) { + should_continue = false; + } }); }); + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + afterEach("flush global state", () => { - console.log("flushing globalState -> " + JSON.stringify(globalState)); cy.task("setGlobalState", globalState.data); - cy.task( - "cli_log", - " FLUSHING GLOBAL STATE -> " + JSON.stringify(globalState), - ); }); context("Payout Card with Auto Fulfill", () => { @@ -46,7 +41,7 @@ describe("Card - Auto Fulfill", () => { res_data, true, true, - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -70,7 +65,7 @@ describe("Card - Auto Fulfill", () => { res_data, true, false, - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -105,7 +100,7 @@ describe("Card - Auto Fulfill", () => { res_data, false, false, - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); diff --git a/cypress-tests/cypress/e2e/RoutingTest/00000-AccountCreate.cy.js b/cypress-tests/cypress/e2e/RoutingTest/00000-AccountCreate.cy.js index f58eb194db71..c1b62c883fa0 100644 --- a/cypress-tests/cypress/e2e/RoutingTest/00000-AccountCreate.cy.js +++ b/cypress-tests/cypress/e2e/RoutingTest/00000-AccountCreate.cy.js @@ -7,11 +7,9 @@ describe("Account Create flow test", () => { before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); - console.log("seeding globalState -> " + JSON.stringify(globalState)); }); }); after("flush global state", () => { - console.log("flushing globalState -> " + JSON.stringify(globalState)); cy.task("setGlobalState", globalState.data); }); diff --git a/cypress-tests/cypress/e2e/RoutingTest/00001-CustomerCreate.cy.js b/cypress-tests/cypress/e2e/RoutingTest/00001-CustomerCreate.cy.js index 996ec85ee31a..584296bdaee7 100644 --- a/cypress-tests/cypress/e2e/RoutingTest/00001-CustomerCreate.cy.js +++ b/cypress-tests/cypress/e2e/RoutingTest/00001-CustomerCreate.cy.js @@ -7,11 +7,9 @@ describe("Customer Create flow test", () => { before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); - console.log("seeding globalState -> " + JSON.stringify(globalState)); }); }); after("flush global state", () => { - console.log("flushing globalState -> " + JSON.stringify(globalState)); cy.task("setGlobalState", globalState.data); }); it("customer-create-call-test", () => { diff --git a/cypress-tests/cypress/e2e/RoutingTest/00002-ConnectorMultipleCreate.cy.js b/cypress-tests/cypress/e2e/RoutingTest/00002-ConnectorMultipleCreate.cy.js index a5acdc246548..feea07f39e44 100644 --- a/cypress-tests/cypress/e2e/RoutingTest/00002-ConnectorMultipleCreate.cy.js +++ b/cypress-tests/cypress/e2e/RoutingTest/00002-ConnectorMultipleCreate.cy.js @@ -6,12 +6,10 @@ describe("Connector Account Create flow test", () => { before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); - console.log("seeding globalState -> " + JSON.stringify(globalState)); }); }); after("flush global state", () => { - console.log("flushing globalState -> " + JSON.stringify(globalState)); cy.task("setGlobalState", globalState.data); }); @@ -20,7 +18,7 @@ describe("Connector Account Create flow test", () => { createConnectorBody, "adyen", "payment_processor", - globalState, + globalState ); }); @@ -29,7 +27,7 @@ describe("Connector Account Create flow test", () => { createConnectorBody, "stripe", "payment_processor", - globalState, + globalState ); }); }); diff --git a/cypress-tests/cypress/e2e/RoutingTest/00003-PaymentRoutingTest.cy.js b/cypress-tests/cypress/e2e/RoutingTest/00003-PaymentRoutingTest.cy.js index f176d1f82dbc..0ac586640f3b 100644 --- a/cypress-tests/cypress/e2e/RoutingTest/00003-PaymentRoutingTest.cy.js +++ b/cypress-tests/cypress/e2e/RoutingTest/00003-PaymentRoutingTest.cy.js @@ -1,5 +1,5 @@ -import routingConfigBody from "../../fixtures/routing-config-body.json"; import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json"; +import routingConfigBody from "../../fixtures/routing-config-body.json"; import State from "../../utils/State"; import * as utils from "../RoutingUtils/utils"; @@ -17,21 +17,11 @@ describe("Routing Test", () => { before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); - console.log("seeding globalState -> " + JSON.stringify(globalState)); - cy.task( - "cli_log", - "SEEDING GLOBAL STATE -> " + JSON.stringify(globalState), - ); }); }); afterEach("flush global state", () => { - console.log("flushing globalState -> " + JSON.stringify(globalState)); cy.task("setGlobalState", globalState.data); - cy.task( - "cli_log", - " FLUSHING GLOBAL STATE -> " + JSON.stringify(globalState), - ); }); context("Routing with Stripe as top priority", () => { @@ -59,7 +49,7 @@ describe("Routing Test", () => { res_data, "priority", routing_data, - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); @@ -93,7 +83,7 @@ describe("Routing Test", () => { res_data, "no_three_ds", "automatic", - globalState, + globalState ); if (should_continue) should_continue = utils.should_continue_further(res_data); diff --git a/cypress-tests/cypress/fixtures/create-connector-body.json b/cypress-tests/cypress/fixtures/create-connector-body.json index 8f4b795c9efd..bde183ecd654 100644 --- a/cypress-tests/cypress/fixtures/create-connector-body.json +++ b/cypress-tests/cypress/fixtures/create-connector-body.json @@ -10,132 +10,7 @@ }, "test_mode": true, "disabled": false, - "payment_methods_enabled": [ - { - "payment_method": "card", - "payment_method_types": [ - { - "payment_method_type": "credit", - "card_networks": [ - "AmericanExpress", - "Discover", - "Interac", - "JCB", - "Mastercard", - "Visa", - "DinersClub", - "UnionPay", - "RuPay" - ], - "minimum_amount": 0, - "maximum_amount": 68607706, - "recurring_enabled": false, - "installment_payment_enabled": true - }, - { - "payment_method_type": "debit", - "card_networks": [ - "AmericanExpress", - "Discover", - "Interac", - "JCB", - "Mastercard", - "Visa", - "DinersClub", - "UnionPay", - "RuPay" - ], - "minimum_amount": 0, - "maximum_amount": 68607706, - "recurring_enabled": false, - "installment_payment_enabled": true - } - ] - }, - { - "payment_method": "bank_transfer", - "payment_method_types": [ - { - "payment_method_type": "pix", - "minimum_amount": 0, - "maximum_amount": 68607706, - "recurring_enabled": false, - "installment_payment_enabled": true - } - ] - }, - { - "payment_method": "bank_redirect", - "payment_method_types": [ - { - "payment_method_type": "ideal", - "payment_experience": null, - "card_networks": null, - "accepted_currencies": null, - "accepted_countries": null, - "minimum_amount": 1, - "maximum_amount": 68607706, - "recurring_enabled": true, - "installment_payment_enabled": true - }, - { - "payment_method_type": "giropay", - "payment_experience": null, - "card_networks": null, - "accepted_currencies": null, - "accepted_countries": null, - "minimum_amount": 1, - "maximum_amount": 68607706, - "recurring_enabled": true, - "installment_payment_enabled": true - }, - { - "payment_method_type": "sofort", - "payment_experience": null, - "card_networks": null, - "accepted_currencies": null, - "accepted_countries": null, - "minimum_amount": 1, - "maximum_amount": 68607706, - "recurring_enabled": true, - "installment_payment_enabled": true - }, - { - "payment_method_type": "eps", - "payment_experience": null, - "card_networks": null, - "accepted_currencies": null, - "accepted_countries": null, - "minimum_amount": 1, - "maximum_amount": 68607706, - "recurring_enabled": true, - "installment_payment_enabled": true - }, - { - "payment_method_type": "blik", - "payment_experience": null, - "card_networks": null, - "accepted_currencies": null, - "accepted_countries": null, - "minimum_amount": 1, - "maximum_amount": 68607706, - "recurring_enabled": true, - "installment_payment_enabled": true - }, - { - "payment_method_type": "przelewy24", - "payment_experience": null, - "card_networks": null, - "accepted_currencies": null, - "accepted_countries": null, - "minimum_amount": 1, - "maximum_amount": 68607706, - "recurring_enabled": true, - "installment_payment_enabled": true - } - ] - } - ], + "payment_methods_enabled": [], "metadata": { "city": "NY", "unit": "245", diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js index 15c265324459..adbec2c25fee 100644 --- a/cypress-tests/cypress/support/commands.js +++ b/cypress-tests/cypress/support/commands.js @@ -89,9 +89,10 @@ Cypress.Commands.add("apiKeyCreateTest", (apiKeyCreateBody, globalState) => { Cypress.Commands.add( "createConnectorCallTest", - (createConnectorBody, globalState) => { + (createConnectorBody, payment_methods_enabled, globalState) => { const merchantId = globalState.get("merchantId"); createConnectorBody.connector_name = globalState.get("connectorId"); + createConnectorBody.payment_methods_enabled = payment_methods_enabled; // readFile is used to read the contents of the file and it always returns a promise ([Object Object]) due to its asynchronous nature // it is best to use then() to handle the response within the same block of code cy.readFile(globalState.get("connectorAuthFilePath")).then( @@ -145,6 +146,15 @@ Cypress.Commands.add( JSON.stringify(jsonContent), `${connectorName}_payout`, ); + + // If the connector does not have payout connector creds in creds file, set payoutsExecution to false + if (authDetails === null) { + globalState.set("payoutsExecution", false); + return false; + } else { + globalState.set("payoutsExecution", true); + } + createConnectorBody.connector_account_details = authDetails; cy.request({ method: "POST", diff --git a/cypress-tests/cypress/support/redirectionHandler.js b/cypress-tests/cypress/support/redirectionHandler.js index 67953a0907ad..c290b4ae427f 100644 --- a/cypress-tests/cypress/support/redirectionHandler.js +++ b/cypress-tests/cypress/support/redirectionHandler.js @@ -4,7 +4,7 @@ export function handleRedirection( redirection_type, urls, connectorId, - payment_method_type, + payment_method_type ) { switch (redirection_type) { case "three_ds": @@ -15,7 +15,7 @@ export function handleRedirection( urls.redirection_url, urls.expected_url, connectorId, - payment_method_type, + payment_method_type ); break; case "bank_transfer": @@ -23,7 +23,7 @@ export function handleRedirection( urls.redirection_url, urls.expected_url, connectorId, - payment_method_type, + payment_method_type ); break; default: @@ -35,7 +35,7 @@ function bankTransferRedirection( redirection_url, expected_url, connectorId, - payment_method_type, + payment_method_type ) { cy.request(redirection_url.href).then((response) => { switch (connectorId) { @@ -119,7 +119,7 @@ function bankRedirectRedirection( redirection_url, expected_url, connectorId, - payment_method_type, + payment_method_type ) { let verifyUrl = false; cy.visit(redirection_url.href); @@ -136,7 +136,7 @@ function bankRedirectRedirection( case "ideal": cy.get(":nth-child(4) > td > p").should( "contain.text", - "Your Payment was Authorised/Refused/Cancelled (It may take up to five minutes to show on the Payment List)", + "Your Payment was Authorised/Refused/Cancelled (It may take up to five minutes to show on the Payment List)" ); cy.get(".btnLink").click(); cy.url().should("include", "status=succeeded"); @@ -144,12 +144,12 @@ function bankRedirectRedirection( break; case "giropay": cy.get( - ".rds-cookies-overlay__allow-all-cookies-btn > .rds-button", + ".rds-cookies-overlay__allow-all-cookies-btn > .rds-button" ).click(); cy.wait(5000); cy.get(".normal-3").should( "contain.text", - "Bank suchen ‑ mit giropay zahlen.", + "Bank suchen ‑ mit giropay zahlen." ); cy.get("#bankSearch").type("giropay TestBank{enter}"); cy.get(".normal-2 > div").click(); @@ -186,7 +186,7 @@ function bankRedirectRedirection( .should("contain", "Continue") .click(); } - }, + } ); break; case "trustly": @@ -227,16 +227,16 @@ function bankRedirectRedirection( case "eps": cy.get("._transactionId__header__iXVd_").should( "contain.text", - "Bank suchen ‑ mit eps zahlen.", + "Bank suchen ‑ mit eps zahlen." ); cy.get(".BankSearch_searchInput__uX_9l").type( - "Allgemeine Sparkasse Oberösterreich Bank AG{enter}", + "Allgemeine Sparkasse Oberösterreich Bank AG{enter}" ); cy.get(".BankSearch_searchResultItem__lbcKm").click(); cy.get("._transactionId__primaryButton__nCa0r").click(); cy.get("#loginTitle").should( "contain.text", - "eps Online-Überweisung Login", + "eps Online-Überweisung Login" ); cy.get("#user") .should("be.visible") @@ -248,7 +248,7 @@ function bankRedirectRedirection( case "ideal": cy.get("p").should( "contain.text", - "Choose your iDeal Issuer Bank please", + "Choose your iDeal Issuer Bank please" ); cy.get("#issuerSearchInput").click(); cy.get("#issuerSearchInput").type("ING{enter}"); @@ -257,10 +257,10 @@ function bankRedirectRedirection( case "giropay": cy.get("._transactionId__header__iXVd_").should( "contain.text", - "Bank suchen ‑ mit giropay zahlen.", + "Bank suchen ‑ mit giropay zahlen." ); cy.get(".BankSearch_searchInput__uX_9l").type( - "Volksbank Hildesheim{enter}", + "Volksbank Hildesheim{enter}" ); cy.get(".BankSearch_searchIcon__EcVO7").click(); cy.get(".BankSearch_bankWrapper__R5fUK").click(); @@ -273,7 +273,7 @@ function bankRedirectRedirection( break; default: throw new Error( - `Unsupported payment method type: ${payment_method_type}`, + `Unsupported payment method type: ${payment_method_type}` ); } verifyUrl = false; @@ -297,7 +297,7 @@ function verifyReturnUrl(redirection_url, expected_url, forward_flow) { { args: { expected_url: expected_url.origin } }, ({ expected_url }) => { cy.window().its("location.origin").should("eq", expected_url); - }, + } ); } } @@ -327,7 +327,7 @@ async function fetchAndParseQRCode(url) { const qrCodeData = jsQR( imageData.data, imageData.width, - imageData.height, + imageData.height ); if (qrCodeData) { diff --git a/cypress-tests/readme.md b/cypress-tests/readme.md index 78251ef9c810..dccb66ed0e53 100644 --- a/cypress-tests/readme.md +++ b/cypress-tests/readme.md @@ -17,17 +17,17 @@ Before installing Cypress, ensure you have the following prerequisites installed To run test cases, follow these steps: -1. Install Cypress +1. Clone the repository and switch to the project directory: ```shell - npm install cypress --save-dev + git clone https://github.com/juspay/hyperswitch + cd cypress-tests ``` -2. Clone the repository and switch to the project directory: +2. Install Cypress and its dependencies to `cypress-tests` directory by running the following command: ```shell - git clone https://github.com/juspay/hyperswitch - cd cypress-tests + npm install ``` 3. Set environment variables for cypress @@ -42,18 +42,36 @@ To run test cases, follow these steps: 4. Run Cypress test cases - To run the tests in a browser in interactive mode run the following command + To run the tests in interactive mode run the following command ```shell npm run cypress ``` - To run the tests in headless mode run the following command + To run all the tests in headless mode run the following command ```shell npm run cypress:ci ``` + To run payment tests in headless mode run the following command + + ```shell + npm run cypress:payments + ``` + + To run payout tests in headless mode run the following command + + ```shell + npm run cypress:payouts + ``` + + To run routing tests in headless mode run the following command + + ```shell + npm run cypress:routing + ``` + > [!NOTE] > To learn about how creds file should be structured, refer to the [example.creds.json](#example-credsjson) section below. @@ -65,21 +83,21 @@ The folder structure of this directory is as follows: . # The root directory for the Cypress tests. ├── .gitignore ├── cypress # Contains Cypress-related files and folders. -│   ├── e2e # End-to-end test directory. -│   │   ├── ConnectorTest # Directory for test scenarios related to connectors. -│   │   │   ├── your_testcase1_files_here.cy.js -│   │   │   ├── your_testcase2_files_here.cy.js -│   │   │   └── ... -│   │   └── ConnectorUtils # Directory for utility functions related to connectors. -│   │   ├── connector_detail_files_here.js -│   │   └── utils.js -│   ├── fixtures # Directory for storing test data API request. -│   │   └── your_fixture_files_here.json -│   ├── support # Directory for Cypress support files. -│   │   ├── commands.js # File containing custom Cypress commands and utilities. -│   │   └── e2e.js -│   └── utils -│   └── utility_files_go_here.js +│ ├── e2e # End-to-end test directory. +│ │ ├── ConnectorTest # Directory for test scenarios related to connectors. +│ │ │ ├── your_testcase1_files_here.cy.js +│ │ │ ├── your_testcase2_files_here.cy.js +│ │ │ └── ... +│ │ └── ConnectorUtils # Directory for utility functions related to connectors. +│ │ ├── connector_detail_files_here.js +│ │ └── utils.js +│ ├── fixtures # Directory for storing test data API request. +│ │ └── your_fixture_files_here.json +│ ├── support # Directory for Cypress support files. +│ │ ├── commands.js # File containing custom Cypress commands and utilities. +│ │ └── e2e.js +│ └── utils +│ └── utility_files_go_here.js ├── cypress.config.js # Cypress configuration file. ├── cypress.env.json # File is used to store environment-specific configuration values,such as base URLs, which can be accessed within your Cypress tests. ├── package.json # Node.js package file. @@ -141,7 +159,7 @@ Cypress.Commands.add("listMandateCallTest", (globalState) => { } else { cy.task( "cli_log", - "x-request-id is not available in the response headers", + "x-request-id is not available in the response headers" ); } expect(response.headers["content-type"]).to.include("application/json");