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"; let globalState; describe("Card - SingleUse Mandates flow test", () => { before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); }); }); after("flush global state", () => { cy.task("setGlobalState", globalState.data); }); 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" ]["ZeroAuthMandate"]; let req_data = data["Request"]; let res_data = data["Response"]; cy.citForMandatesCallTest( citConfirmBody, req_data, res_data, 0, true, "automatic", "setup_mandate", globalState, ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); it("Confirm No 3DS MIT", () => { cy.mitForMandatesCallTest( mitConfirmBody, 7000, true, "automatic", globalState, ); }); }, ); context( "Card - NoThreeDS Create + Confirm Automatic CIT and Multi 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" ]["ZeroAuthMandate"]; let req_data = data["Request"]; let res_data = data["Response"]; cy.citForMandatesCallTest( citConfirmBody, req_data, res_data, 0, true, "automatic", "setup_mandate", globalState, ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); it("Confirm No 3DS MIT", () => { cy.mitForMandatesCallTest( mitConfirmBody, 7000, true, "automatic", globalState, ); }); it("Confirm No 3DS MIT", () => { cy.mitForMandatesCallTest( mitConfirmBody, 7000, true, "automatic", globalState, ); }); }, ); });