From 973ecbf84ec62d05556ccd568992243e460f8b10 Mon Sep 17 00:00:00 2001 From: Pa1NarK <69745008+pixincreate@users.noreply.github.com> Date: Thu, 20 Jun 2024 15:27:25 +0530 Subject: [PATCH] fix(cypress): address cypress skipping tests (#5046) --- cypress-tests/.gitignore | 1 + .../00003-NoThreeDSAutoCapture.cy.js | 26 +- .../00004-ThreeDSAutoCapture.cy.js | 15 +- .../00005-NoThreeDSManualCapture.cy.js | 43 +- .../e2e/PaymentTest/00006-VoidPayment.cy.js | 35 +- .../e2e/PaymentTest/00007-SyncPayment.cy.js | 16 +- .../e2e/PaymentTest/00008-RefundPayment.cy.js | 1081 ++++++++++------- .../e2e/PaymentTest/00009-SyncRefund.cy.js | 15 +- .../00010-CreateSingleuseMandate.cy.js | 35 +- .../00011-CreateMultiuseMandate.cy.js | 35 +- .../00012-ListAndRevokeMandate.cy.js | 19 +- .../e2e/PaymentTest/00013-SaveCardFlow.cy.js | 38 +- .../PaymentTest/00014-ZeroAuthMandate.cy.js | 19 +- .../00015-ThreeDSManualCapture.cy.js | 48 +- .../e2e/PaymentTest/00016-BankTransfers.cy.js | 16 +- .../e2e/PaymentTest/00017-BankRedirect.cy.js | 52 +- .../e2e/PayoutTest/00005-SavePayout.cy.js | 2 +- 17 files changed, 903 insertions(+), 593 deletions(-) diff --git a/cypress-tests/.gitignore b/cypress-tests/.gitignore index 85a05e1a6a..969d019bc1 100644 --- a/cypress-tests/.gitignore +++ b/cypress-tests/.gitignore @@ -1,2 +1,3 @@ creds.json screenshots +run_all.sh diff --git a/cypress-tests/cypress/e2e/PaymentTest/00003-NoThreeDSAutoCapture.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00003-NoThreeDSAutoCapture.cy.js index 2267c1ab59..49250e68d6 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00003-NoThreeDSAutoCapture.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00003-NoThreeDSAutoCapture.cy.js @@ -2,13 +2,12 @@ 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, * as utils from "../PaymentUtils/utils"; +import getConnectorDetails from "../PaymentUtils/utils"; +import * 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); @@ -19,12 +18,15 @@ 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" @@ -64,6 +66,14 @@ 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"][ diff --git a/cypress-tests/cypress/e2e/PaymentTest/00004-ThreeDSAutoCapture.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00004-ThreeDSAutoCapture.cy.js index c417c01319..c9fb1339b1 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00004-ThreeDSAutoCapture.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00004-ThreeDSAutoCapture.cy.js @@ -1,25 +1,26 @@ import confirmBody from "../../fixtures/confirm-body.json"; import createPaymentBody from "../../fixtures/create-payment-body.json"; import State from "../../utils/State"; -import getConnectorDetails, * as utils from "../PaymentUtils/utils"; +import getConnectorDetails from "../PaymentUtils/utils"; +import * 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 - before("seed global state", () => { - cy.task("getGlobalState").then((state) => { - globalState = new State(state); - }); - }); - beforeEach(function () { if (!should_continue) { this.skip(); } }); + before("seed global state", () => { + cy.task("getGlobalState").then((state) => { + globalState = new State(state); + }); + }); + afterEach("flush global state", () => { cy.task("setGlobalState", globalState.data); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00005-NoThreeDSManualCapture.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00005-NoThreeDSManualCapture.cy.js index 027a040317..bcd65753ac 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00005-NoThreeDSManualCapture.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00005-NoThreeDSManualCapture.cy.js @@ -3,13 +3,12 @@ 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, * as utils from "../PaymentUtils/utils"; +import getConnectorDetails from "../PaymentUtils/utils"; +import * 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); @@ -20,14 +19,16 @@ 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" @@ -85,6 +86,14 @@ 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"))[ @@ -131,6 +140,14 @@ 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" @@ -193,6 +210,14 @@ 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"))[ diff --git a/cypress-tests/cypress/e2e/PaymentTest/00006-VoidPayment.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00006-VoidPayment.cy.js index e1dd526563..98ff9c5c15 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00006-VoidPayment.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00006-VoidPayment.cy.js @@ -2,13 +2,12 @@ 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, * as utils from "../PaymentUtils/utils"; +import getConnectorDetails from "../PaymentUtils/utils"; +import * 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,13 +18,15 @@ describe("Card - NoThreeDS Manual payment flow test", () => { cy.task("setGlobalState", globalState.data); }); - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - 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(); + } + }); + it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ "PaymentIntent" @@ -76,6 +77,14 @@ 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" @@ -114,6 +123,14 @@ 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" diff --git a/cypress-tests/cypress/e2e/PaymentTest/00007-SyncPayment.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00007-SyncPayment.cy.js index bfdbe8d423..2d6174efbb 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00007-SyncPayment.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00007-SyncPayment.cy.js @@ -1,13 +1,20 @@ import confirmBody from "../../fixtures/confirm-body.json"; import createPaymentBody from "../../fixtures/create-payment-body.json"; import State from "../../utils/State"; -import getConnectorDetails, * as utils from "../PaymentUtils/utils"; +import getConnectorDetails from "../PaymentUtils/utils"; +import * 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); @@ -17,13 +24,6 @@ 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" diff --git a/cypress-tests/cypress/e2e/PaymentTest/00008-RefundPayment.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00008-RefundPayment.cy.js index 5d36a1946c..eadab2bb43 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00008-RefundPayment.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00008-RefundPayment.cy.js @@ -4,16 +4,15 @@ import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json"; import citConfirmBody from "../../fixtures/create-mandate-cit.json"; import mitConfirmBody from "../../fixtures/create-mandate-mit.json"; import createPaymentBody from "../../fixtures/create-payment-body.json"; -import listRefundCall from "../../fixtures/list-refund-call-body.json"; import refundBody from "../../fixtures/refund-flow-body.json"; +import listRefundCall from "../../fixtures/list-refund-call-body.json"; import State from "../../utils/State"; -import getConnectorDetails, * as utils from "../PaymentUtils/utils"; +import getConnectorDetails from "../PaymentUtils/utils"; +import * 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); @@ -24,13 +23,15 @@ describe("Card - Refund flow test", () => { cy.task("setGlobalState", globalState.data); }); - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - 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(); + } + }); + it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ "PaymentIntent" @@ -83,6 +84,14 @@ 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" @@ -148,6 +157,14 @@ 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"))[ @@ -187,6 +204,14 @@ describe("Card - Refund flow test", () => { 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"))[ @@ -246,6 +271,14 @@ describe("Card - Refund flow test", () => { ); 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" @@ -325,6 +358,14 @@ 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" @@ -417,6 +458,14 @@ 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" @@ -496,6 +545,14 @@ 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" @@ -577,6 +634,14 @@ 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" @@ -641,130 +706,215 @@ describe("Card - Refund flow test", () => { }); } ); +}); - 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); - }); +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 - it("payment_methods-call-test", () => { - cy.paymentMethodsCallTest(globalState); - }); + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); - 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); + before("seed global state", () => { + cy.task("getGlobalState").then((state) => { + globalState = new State(state); }); }); - context("Card - Partial 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); - }); - - 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); - }); + afterEach("flush global state", () => { + cy.task("setGlobalState", globalState.data); }); - context("Fully Refund Card-ThreeDS payment flow test Create+Confirm", () => { + 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("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( + "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 + + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + it("create+confirm-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ "3DSAutoCapture" @@ -794,372 +944,361 @@ describe("Card - Refund flow test", () => { it("refund-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "Refund" + "PartialRefund" ]; let req_data = data["Request"]; let res_data = data["Response"]; - cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState); + cy.refundCallTest(refundBody, req_data, res_data, 3000, globalState); if (should_continue) should_continue = utils.should_continue_further(res_data); }); - }); - 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("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); + }); - it("Handle redirection", () => { - let expected_redirection = confirmBody["return_url"]; - cy.handleRedirection(globalState, expected_redirection); - }); + 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("retrieve-payment-call-test", () => { - cy.retrievePaymentCallTest(globalState); - }); +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 - 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); - }); - - 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); - }); - - 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); - }); + beforeEach(function () { + if (!should_continue) { + this.skip(); } - ); - - 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("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("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("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 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("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("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("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("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 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("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("Handle redirection", () => { - let expected_redirection = confirmBody["return_url"]; - cy.handleRedirection(globalState, expected_redirection); - }); - - 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, 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", () => { - 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("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); - }); + 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 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("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("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("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); + }); +}); + +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 + + 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("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("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, 100, globalState); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); +}); + +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 + + 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("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("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 a66c22b06c..630f8e7070 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00009-SyncRefund.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00009-SyncRefund.cy.js @@ -2,13 +2,20 @@ import confirmBody from "../../fixtures/confirm-body.json"; import createPaymentBody from "../../fixtures/create-payment-body.json"; import refundBody from "../../fixtures/refund-flow-body.json"; import State from "../../utils/State"; -import getConnectorDetails, * as utils from "../PaymentUtils/utils"; +import getConnectorDetails from "../PaymentUtils/utils"; +import * 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); @@ -19,12 +26,6 @@ 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" diff --git a/cypress-tests/cypress/e2e/PaymentTest/00010-CreateSingleuseMandate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00010-CreateSingleuseMandate.cy.js index bcbdd2527a..1f37b061ec 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00010-CreateSingleuseMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00010-CreateSingleuseMandate.cy.js @@ -2,13 +2,12 @@ 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, * as utils from "../PaymentUtils/utils"; +import getConnectorDetails from "../PaymentUtils/utils"; +import * 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); @@ -19,15 +18,17 @@ 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"))[ @@ -65,6 +66,14 @@ describe("Card - SingleUse Mandates flow test", () => { 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"))[ @@ -130,6 +139,14 @@ describe("Card - SingleUse Mandates flow test", () => { 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"))[ diff --git a/cypress-tests/cypress/e2e/PaymentTest/00011-CreateMultiuseMandate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00011-CreateMultiuseMandate.cy.js index b2ee1924c4..b7ca7b1493 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00011-CreateMultiuseMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00011-CreateMultiuseMandate.cy.js @@ -2,13 +2,12 @@ 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, * as utils from "../PaymentUtils/utils"; +import getConnectorDetails from "../PaymentUtils/utils"; +import * 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); @@ -19,15 +18,17 @@ 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"))[ @@ -74,6 +75,14 @@ describe("Card - MultiUse Mandates flow test", () => { 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"))[ @@ -157,6 +166,14 @@ describe("Card - MultiUse Mandates flow test", () => { 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"))[ diff --git a/cypress-tests/cypress/e2e/PaymentTest/00012-ListAndRevokeMandate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00012-ListAndRevokeMandate.cy.js index 0f23e30717..29327cc039 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00012-ListAndRevokeMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00012-ListAndRevokeMandate.cy.js @@ -1,14 +1,13 @@ import citConfirmBody from "../../fixtures/create-mandate-cit.json"; import mitConfirmBody from "../../fixtures/create-mandate-mit.json"; -import getConnectorDetails, * as utils from "../PaymentUtils/utils"; +import getConnectorDetails from "../PaymentUtils/utils"; +import * 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); @@ -19,15 +18,17 @@ 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"))[ diff --git a/cypress-tests/cypress/e2e/PaymentTest/00013-SaveCardFlow.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00013-SaveCardFlow.cy.js index 227144ee9f..ef9f47d262 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00013-SaveCardFlow.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00013-SaveCardFlow.cy.js @@ -1,30 +1,32 @@ 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); }); @@ -94,6 +96,14 @@ describe("Card - SaveCard payment flow test", () => { 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); }); @@ -178,6 +188,14 @@ describe("Card - SaveCard payment flow test", () => { 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); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00014-ZeroAuthMandate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00014-ZeroAuthMandate.cy.js index e7fdc618ca..af3aff9408 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00014-ZeroAuthMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00014-ZeroAuthMandate.cy.js @@ -1,13 +1,12 @@ import citConfirmBody from "../../fixtures/create-mandate-cit.json"; import mitConfirmBody from "../../fixtures/create-mandate-mit.json"; import State from "../../utils/State"; -import getConnectorDetails, * as utils from "../PaymentUtils/utils"; +import getConnectorDetails from "../PaymentUtils/utils"; +import * 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,15 +17,17 @@ 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" diff --git a/cypress-tests/cypress/e2e/PaymentTest/00015-ThreeDSManualCapture.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00015-ThreeDSManualCapture.cy.js index 155780dd6d..2d11186247 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00015-ThreeDSManualCapture.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00015-ThreeDSManualCapture.cy.js @@ -1,15 +1,14 @@ -import captureBody from "../../fixtures/capture-flow-body.json"; -import confirmBody from "../../fixtures/confirm-body.json"; -import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json"; import createPaymentBody from "../../fixtures/create-payment-body.json"; +import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json"; +import confirmBody from "../../fixtures/confirm-body.json"; +import getConnectorDetails from "../PaymentUtils/utils"; import State from "../../utils/State"; -import getConnectorDetails, * as utils from "../PaymentUtils/utils"; +import captureBody from "../../fixtures/capture-flow-body.json"; +import * 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); @@ -20,13 +19,16 @@ 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" @@ -86,6 +88,14 @@ 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" @@ -134,6 +144,14 @@ 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" @@ -199,6 +217,14 @@ 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" diff --git a/cypress-tests/cypress/e2e/PaymentTest/00016-BankTransfers.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00016-BankTransfers.cy.js index 322ef75a4a..0ff9eceda6 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00016-BankTransfers.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00016-BankTransfers.cy.js @@ -6,8 +6,6 @@ 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); @@ -18,13 +16,15 @@ describe("Bank Transfers", () => { cy.task("setGlobalState", globalState.data); }); - beforeEach(function () { - if (!should_continue) { - this.skip(); - } - }); - 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(); + } + }); + it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "bank_transfer_pm" diff --git a/cypress-tests/cypress/e2e/PaymentTest/00017-BankRedirect.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00017-BankRedirect.cy.js index 9d2596c295..9fb1052aa6 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00017-BankRedirect.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00017-BankRedirect.cy.js @@ -6,8 +6,6 @@ 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); @@ -18,17 +16,19 @@ 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" @@ -70,6 +70,13 @@ 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" @@ -122,6 +129,14 @@ describe("Bank Redirect tests", () => { }); 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" @@ -174,6 +189,13 @@ describe("Bank Redirect tests", () => { }); 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" @@ -226,6 +248,13 @@ describe("Bank Redirect tests", () => { }); 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" @@ -278,6 +307,13 @@ 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/PayoutTest/00005-SavePayout.cy.js b/cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.js index c5af6e5e06..222ecc57ba 100644 --- a/cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.js +++ b/cypress-tests/cypress/e2e/PayoutTest/00005-SavePayout.cy.js @@ -32,7 +32,7 @@ describe("[Payout] Saved Card", () => { context("[Payout] [Card] Onboard customer prior to transaction", () => { let should_continue = true; // variable that will be used to skip tests if a previous test fails - + // This is needed to get customer payment methods beforeEach("seed global state", () => { createPayoutBody = Cypress._.cloneDeep(initialCreatePayoutBody);