Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(cypress): fix payouts not running #4904

Merged
merged 11 commits into from
Jun 11, 2024
Merged
Prev Previous commit
refactor(cypress): Re-use beforeEach instead of just copy pasting. …
…A bit of correction
  • Loading branch information
pixincreate committed Jun 11, 2024
commit 24217d132f87c31ecb2a44ac6340425d26750a5f
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ describe("Account Create flow test", () => {
globalState = new State(state);
});
});

after("flush global state", () => {
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 @@ -9,9 +9,11 @@ describe("Customer Create flow test", () => {
globalState = new State(state);
});
});

after("flush global state", () => {
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
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);
});
});
},
}
);
});
45 changes: 14 additions & 31 deletions cypress-tests/cypress/e2e/PaymentTest/00006-VoidPayment.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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"
Expand All @@ -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);
Expand Down Expand Up @@ -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"
Expand All @@ -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);
Expand All @@ -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"
Expand All @@ -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);
Expand Down Expand Up @@ -176,6 +159,6 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});
},
}
);
});
Loading
Loading