Skip to content

Commit

Permalink
refactor(cypress): fix payouts not running (#4904)
Browse files Browse the repository at this point in the history
  • Loading branch information
pixincreate committed Jun 11, 2024
1 parent 88cf904 commit bbcf034
Show file tree
Hide file tree
Showing 29 changed files with 872 additions and 1,169 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -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", () => {
Expand All @@ -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
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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"
Expand All @@ -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);
Expand All @@ -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"][
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
});
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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"
Expand All @@ -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);
Expand Down Expand Up @@ -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"))[
Expand All @@ -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);
Expand Down Expand Up @@ -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"
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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"))[
Expand All @@ -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);
Expand All @@ -258,6 +233,6 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
cy.retrievePaymentCallTest(globalState);
});
});
},
}
);
});
Loading

0 comments on commit bbcf034

Please sign in to comment.