refactor(cypress): fix payouts not running (#4904)

This commit is contained in:
Pa1NarK
2024-06-11 21:13:26 +05:30
committed by GitHub
parent 88cf904f5b
commit bbcf0340ca
29 changed files with 908 additions and 1205 deletions

View File

@ -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);
});

View File

@ -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);
});

View File

@ -1,5 +1,6 @@
import createConnectorBody from "../../fixtures/create-connector-body.json";
import State from "../../utils/State";
import { payment_methods_enabled } from "../PaymentUtils/Commons";
let globalState;
describe("Connector Account Create flow test", () => {
@ -14,6 +15,10 @@ describe("Connector Account Create flow test", () => {
});
it("connector-create-call-test", () => {
cy.createConnectorCallTest(createConnectorBody, globalState);
cy.createConnectorCallTest(
createConnectorBody,
payment_methods_enabled,
globalState
);
});
});

View File

@ -2,12 +2,13 @@ import confirmBody from "../../fixtures/confirm-body.json";
import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json";
import createPaymentBody from "../../fixtures/create-payment-body.json";
import State from "../../utils/State";
import getConnectorDetails from "../PaymentUtils/utils";
import * as utils from "../PaymentUtils/utils";
import getConnectorDetails, * as utils from "../PaymentUtils/utils";
let globalState;
describe("Card - NoThreeDS payment flow test", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
@ -18,15 +19,12 @@ describe("Card - NoThreeDS payment flow test", () => {
cy.task("setGlobalState", globalState.data);
});
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
context("Card-NoThreeDS payment flow test Create and confirm", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("create-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
"PaymentIntent"
@ -39,7 +37,7 @@ describe("Card - NoThreeDS payment flow test", () => {
res_data,
"no_three_ds",
"automatic",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -66,14 +64,6 @@ describe("Card - NoThreeDS payment flow test", () => {
});
context("Card-NoThreeDS payment flow test Create+Confirm", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("create+confirm-payment-call-test", () => {
console.log("confirm -> " + globalState.get("connectorId"));
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
@ -87,7 +77,7 @@ describe("Card - NoThreeDS payment flow test", () => {
res_data,
"no_three_ds",
"automatic",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);

View File

@ -1,26 +1,25 @@
import confirmBody from "../../fixtures/confirm-body.json";
import createPaymentBody from "../../fixtures/create-payment-body.json";
import State from "../../utils/State";
import getConnectorDetails from "../PaymentUtils/utils";
import * as utils from "../PaymentUtils/utils";
import getConnectorDetails, * as utils from "../PaymentUtils/utils";
let globalState;
describe("Card - ThreeDS payment flow test", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
});
});
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
afterEach("flush global state", () => {
cy.task("setGlobalState", globalState.data);
});
@ -37,7 +36,7 @@ describe("Card - ThreeDS payment flow test", () => {
res_data,
"three_ds",
"automatic",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);

View File

@ -3,12 +3,13 @@ import confirmBody from "../../fixtures/confirm-body.json";
import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json";
import createPaymentBody from "../../fixtures/create-payment-body.json";
import State from "../../utils/State";
import getConnectorDetails from "../PaymentUtils/utils";
import * as utils from "../PaymentUtils/utils";
import getConnectorDetails, * as utils from "../PaymentUtils/utils";
let globalState;
describe("Card - NoThreeDS Manual payment flow test", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
@ -19,16 +20,14 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
cy.task("setGlobalState", globalState.data);
});
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
context("Card - NoThreeDS Manual Full Capture payment flow test", () => {
context("payment Create and Confirm", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("create-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
@ -41,7 +40,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
res_data,
"no_three_ds",
"manual",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -86,14 +85,6 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
});
context("Payment Create+Confirm", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("create+confirm-payment-call-test", () => {
console.log("confirm -> " + globalState.get("connectorId"));
let data = getConnectorDetails(globalState.get("connectorId"))[
@ -108,7 +99,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
res_data,
"no_three_ds",
"manual",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -140,14 +131,6 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
"Card - NoThreeDS Manual Partial Capture payment flow test - Create and Confirm",
() => {
context("payment Create and Payment Confirm", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("create-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
@ -160,7 +143,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
res_data,
"no_three_ds",
"manual",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -183,7 +166,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
req_data,
res_data,
true,
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -210,14 +193,6 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
});
context("payment + Confirm", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("create+confirm-payment-call-test", () => {
console.log("confirm -> " + globalState.get("connectorId"));
let data = getConnectorDetails(globalState.get("connectorId"))[
@ -232,7 +207,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
res_data,
"no_three_ds",
"manual",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -258,6 +233,6 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
cy.retrievePaymentCallTest(globalState);
});
});
},
}
);
});

View File

@ -2,12 +2,13 @@ import confirmBody from "../../fixtures/confirm-body.json";
import createPaymentBody from "../../fixtures/create-payment-body.json";
import voidBody from "../../fixtures/void-payment-body.json";
import State from "../../utils/State";
import getConnectorDetails from "../PaymentUtils/utils";
import * as utils from "../PaymentUtils/utils";
import getConnectorDetails, * as utils from "../PaymentUtils/utils";
let globalState;
describe("Card - NoThreeDS Manual payment flow test", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
@ -18,15 +19,13 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
cy.task("setGlobalState", globalState.data);
});
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"
@ -39,7 +38,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
res_data,
"no_three_ds",
"manual",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -77,14 +76,6 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
context(
"Card - void payment in Requires_payment_method state flow test",
() => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("create-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
@ -97,7 +88,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
res_data,
"no_three_ds",
"manual",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -117,20 +108,12 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});
},
}
);
context(
"Card - void payment in Requires_payment_method state flow test",
() => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("create-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
@ -143,7 +126,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
res_data,
"no_three_ds",
"manual",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -176,6 +159,6 @@ describe("Card - NoThreeDS Manual payment flow test", () => {
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});
},
}
);
});

View File

@ -1,20 +1,13 @@
import confirmBody from "../../fixtures/confirm-body.json";
import createPaymentBody from "../../fixtures/create-payment-body.json";
import State from "../../utils/State";
import getConnectorDetails from "../PaymentUtils/utils";
import * as utils from "../PaymentUtils/utils";
import getConnectorDetails, * as utils from "../PaymentUtils/utils";
let globalState;
describe("Card - Sync payment flow test", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
@ -24,6 +17,13 @@ describe("Card - Sync payment flow test", () => {
after("flush global state", () => {
cy.task("setGlobalState", globalState.data);
});
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("create-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
"PaymentIntent"
@ -36,7 +36,7 @@ describe("Card - Sync payment flow test", () => {
res_data,
"no_three_ds",
"automatic",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);

File diff suppressed because it is too large Load Diff

View File

@ -2,20 +2,13 @@ import confirmBody from "../../fixtures/confirm-body.json";
import createPaymentBody from "../../fixtures/create-payment-body.json";
import refundBody from "../../fixtures/refund-flow-body.json";
import State from "../../utils/State";
import getConnectorDetails from "../PaymentUtils/utils";
import * as utils from "../PaymentUtils/utils";
import getConnectorDetails, * as utils from "../PaymentUtils/utils";
let globalState;
describe("Card - Sync Refund flow test", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
@ -26,6 +19,12 @@ describe("Card - Sync Refund flow test", () => {
cy.task("setGlobalState", globalState.data);
});
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("create-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
"PaymentIntent"
@ -38,7 +37,7 @@ describe("Card - Sync Refund flow test", () => {
res_data,
"no_three_ds",
"automatic",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);

View File

@ -2,12 +2,13 @@ import captureBody from "../../fixtures/capture-flow-body.json";
import citConfirmBody from "../../fixtures/create-mandate-cit.json";
import mitConfirmBody from "../../fixtures/create-mandate-mit.json";
import State from "../../utils/State";
import getConnectorDetails from "../PaymentUtils/utils";
import * as utils from "../PaymentUtils/utils";
import getConnectorDetails, * as utils from "../PaymentUtils/utils";
let globalState;
describe("Card - SingleUse Mandates flow test", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
@ -18,17 +19,15 @@ describe("Card - SingleUse Mandates flow test", () => {
cy.task("setGlobalState", globalState.data);
});
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
context(
"Card - NoThreeDS Create + Confirm Automatic CIT and MIT payment flow test",
() => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("Confirm No 3DS CIT", () => {
console.log("confirm -> " + globalState.get("connectorId"));
let data = getConnectorDetails(globalState.get("connectorId"))[
@ -45,7 +44,7 @@ describe("Card - SingleUse Mandates flow test", () => {
true,
"automatic",
"new_mandate",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -57,23 +56,15 @@ describe("Card - SingleUse Mandates flow test", () => {
7000,
true,
"automatic",
globalState,
globalState
);
});
},
}
);
context(
"Card - NoThreeDS Create + Confirm Manual CIT and MIT payment flow test",
() => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("Confirm No 3DS CIT", () => {
console.log("confirm -> " + globalState.get("connectorId"));
let data = getConnectorDetails(globalState.get("connectorId"))[
@ -90,7 +81,7 @@ describe("Card - SingleUse Mandates flow test", () => {
true,
"manual",
"new_mandate",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -114,7 +105,7 @@ describe("Card - SingleUse Mandates flow test", () => {
6500,
true,
"manual",
globalState,
globalState
);
});
@ -133,20 +124,12 @@ describe("Card - SingleUse Mandates flow test", () => {
it("list-mandate-call-test", () => {
cy.listMandateCallTest(globalState);
});
},
}
);
context(
"Card - ThreeDS Create + Confirm Manual CIT and MIT payment flow test",
() => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("Create No 3DS CIT", () => {
console.log("confirm -> " + globalState.get("connectorId"));
let data = getConnectorDetails(globalState.get("connectorId"))[
@ -163,7 +146,7 @@ describe("Card - SingleUse Mandates flow test", () => {
true,
"manual",
"new_mandate",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -187,13 +170,13 @@ describe("Card - SingleUse Mandates flow test", () => {
7000,
true,
"automatic",
globalState,
globalState
);
});
it("list-mandate-call-test", () => {
cy.listMandateCallTest(globalState);
});
},
}
);
});

View File

@ -2,12 +2,13 @@ import captureBody from "../../fixtures/capture-flow-body.json";
import citConfirmBody from "../../fixtures/create-mandate-cit.json";
import mitConfirmBody from "../../fixtures/create-mandate-mit.json";
import State from "../../utils/State";
import getConnectorDetails from "../PaymentUtils/utils";
import * as utils from "../PaymentUtils/utils";
import getConnectorDetails, * as utils from "../PaymentUtils/utils";
let globalState;
describe("Card - MultiUse Mandates flow test", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
@ -18,17 +19,15 @@ describe("Card - MultiUse Mandates flow test", () => {
cy.task("setGlobalState", globalState.data);
});
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
context(
"Card - NoThreeDS Create + Confirm Automatic CIT and MIT payment flow test",
() => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("Confirm No 3DS CIT", () => {
console.log("confirm -> " + globalState.get("connectorId"));
let data = getConnectorDetails(globalState.get("connectorId"))[
@ -45,7 +44,7 @@ describe("Card - MultiUse Mandates flow test", () => {
true,
"automatic",
"new_mandate",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -57,7 +56,7 @@ describe("Card - MultiUse Mandates flow test", () => {
7000,
true,
"automatic",
globalState,
globalState
);
});
it("Confirm No 3DS MIT", () => {
@ -66,23 +65,15 @@ describe("Card - MultiUse Mandates flow test", () => {
7000,
true,
"automatic",
globalState,
globalState
);
});
},
}
);
context(
"Card - NoThreeDS Create + Confirm Manual CIT and MIT payment flow test",
() => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("Confirm No 3DS CIT", () => {
console.log("confirm -> " + globalState.get("connectorId"));
let data = getConnectorDetails(globalState.get("connectorId"))[
@ -99,7 +90,7 @@ describe("Card - MultiUse Mandates flow test", () => {
true,
"manual",
"new_mandate",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -123,7 +114,7 @@ describe("Card - MultiUse Mandates flow test", () => {
6500,
true,
"manual",
globalState,
globalState
);
});
@ -145,7 +136,7 @@ describe("Card - MultiUse Mandates flow test", () => {
6500,
true,
"manual",
globalState,
globalState
);
});
@ -160,20 +151,12 @@ describe("Card - MultiUse Mandates flow test", () => {
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});
},
}
);
context(
"Card - ThreeDS Create + Confirm Manual CIT and MIT payment flow test",
() => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("Confirm No 3DS CIT", () => {
console.log("confirm -> " + globalState.get("connectorId"));
let data = getConnectorDetails(globalState.get("connectorId"))[
@ -190,7 +173,7 @@ describe("Card - MultiUse Mandates flow test", () => {
true,
"manual",
"new_mandate",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -214,9 +197,9 @@ describe("Card - MultiUse Mandates flow test", () => {
6500,
true,
"automatic",
globalState,
globalState
);
});
},
}
);
});

View File

@ -1,13 +1,14 @@
import citConfirmBody from "../../fixtures/create-mandate-cit.json";
import mitConfirmBody from "../../fixtures/create-mandate-mit.json";
import getConnectorDetails from "../PaymentUtils/utils";
import * as utils from "../PaymentUtils/utils";
import getConnectorDetails, * as utils from "../PaymentUtils/utils";
import State from "../../utils/State";
let globalState;
describe("Card - SingleUse Mandates flow test", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
@ -18,17 +19,15 @@ describe("Card - SingleUse Mandates flow test", () => {
cy.task("setGlobalState", globalState.data);
});
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
context(
"Card - NoThreeDS Create + Confirm Automatic CIT and MIT payment flow test",
() => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("Confirm No 3DS CIT", () => {
console.log("confirm -> " + globalState.get("connectorId"));
let data = getConnectorDetails(globalState.get("connectorId"))[
@ -45,7 +44,7 @@ describe("Card - SingleUse Mandates flow test", () => {
true,
"automatic",
"new_mandate",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -57,7 +56,7 @@ describe("Card - SingleUse Mandates flow test", () => {
7000,
true,
"automatic",
globalState,
globalState
);
});
@ -72,6 +71,6 @@ describe("Card - SingleUse Mandates flow test", () => {
it("revoke-revoked-mandate-call-test", () => {
cy.revokeMandateCallTest(globalState);
});
},
}
);
});

View File

@ -1,32 +1,30 @@
import captureBody from "../../fixtures/capture-flow-body.json";
import confirmBody from "../../fixtures/confirm-body.json";
import createPaymentBody from "../../fixtures/create-payment-body.json";
import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json";
import customerCreateBody from "../../fixtures/create-customer-body.json";
import createPaymentBody from "../../fixtures/create-payment-body.json";
import SaveCardConfirmBody from "../../fixtures/save-card-confirm-body.json";
import getConnectorDetails from "../PaymentUtils/utils";
import * as utils from "../PaymentUtils/utils";
import State from "../../utils/State";
import getConnectorDetails, * as utils from "../PaymentUtils/utils";
let globalState;
describe("Card - SaveCard payment flow test", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
});
});
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
context(
"Save card for NoThreeDS automatic capture payment- Create+Confirm",
() => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("customer-create-call-test", () => {
cy.createCustomerCallTest(customerCreateBody, globalState);
});
@ -43,7 +41,7 @@ describe("Card - SaveCard payment flow test", () => {
res_data,
"no_three_ds",
"automatic",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -69,7 +67,7 @@ describe("Card - SaveCard payment flow test", () => {
res_data,
"no_three_ds",
"automatic",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -85,25 +83,17 @@ describe("Card - SaveCard payment flow test", () => {
SaveCardConfirmBody,
req_data,
res_data,
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});
},
}
);
context(
"Save card for NoThreeDS manual full capture payment- Create+Confirm",
() => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("customer-create-call-test", () => {
cy.createCustomerCallTest(customerCreateBody, globalState);
});
@ -120,7 +110,7 @@ describe("Card - SaveCard payment flow test", () => {
res_data,
"no_three_ds",
"automatic",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -146,7 +136,7 @@ describe("Card - SaveCard payment flow test", () => {
res_data,
"no_three_ds",
"manual",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -162,7 +152,7 @@ describe("Card - SaveCard payment flow test", () => {
SaveCardConfirmBody,
req_data,
res_data,
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -182,20 +172,12 @@ describe("Card - SaveCard payment flow test", () => {
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});
},
}
);
context(
"Save card for NoThreeDS manual partial capture payment- Create + Confirm",
() => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("customer-create-call-test", () => {
cy.createCustomerCallTest(customerCreateBody, globalState);
});
@ -212,7 +194,7 @@ describe("Card - SaveCard payment flow test", () => {
res_data,
"no_three_ds",
"automatic",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -238,7 +220,7 @@ describe("Card - SaveCard payment flow test", () => {
res_data,
"no_three_ds",
"manual",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -254,7 +236,7 @@ describe("Card - SaveCard payment flow test", () => {
SaveCardConfirmBody,
req_data,
res_data,
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -273,6 +255,6 @@ describe("Card - SaveCard payment flow test", () => {
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});
},
}
);
});

View File

@ -1,12 +1,13 @@
import citConfirmBody from "../../fixtures/create-mandate-cit.json";
import mitConfirmBody from "../../fixtures/create-mandate-mit.json";
import State from "../../utils/State";
import getConnectorDetails from "../PaymentUtils/utils";
import * as utils from "../PaymentUtils/utils";
import getConnectorDetails, * as utils from "../PaymentUtils/utils";
let globalState;
describe("Card - SingleUse Mandates flow test", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
@ -17,17 +18,15 @@ describe("Card - SingleUse Mandates flow test", () => {
cy.task("setGlobalState", globalState.data);
});
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
context(
"Card - NoThreeDS Create + Confirm Automatic CIT and Single use MIT payment flow test",
() => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("Confirm No 3DS CIT", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
@ -42,7 +41,7 @@ describe("Card - SingleUse Mandates flow test", () => {
true,
"automatic",
"setup_mandate",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -54,10 +53,10 @@ describe("Card - SingleUse Mandates flow test", () => {
7000,
true,
"automatic",
globalState,
globalState
);
});
},
}
);
context(
"Card - NoThreeDS Create + Confirm Automatic CIT and Multi use MIT payment flow test",
@ -84,7 +83,7 @@ describe("Card - SingleUse Mandates flow test", () => {
true,
"automatic",
"setup_mandate",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -96,7 +95,7 @@ describe("Card - SingleUse Mandates flow test", () => {
7000,
true,
"automatic",
globalState,
globalState
);
});
it("Confirm No 3DS MIT", () => {
@ -105,9 +104,9 @@ describe("Card - SingleUse Mandates flow test", () => {
7000,
true,
"automatic",
globalState,
globalState
);
});
},
}
);
});

View File

@ -1,14 +1,15 @@
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 captureBody from "../../fixtures/capture-flow-body.json";
import * as utils from "../PaymentUtils/utils";
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";
let globalState;
describe("Card - ThreeDS Manual payment flow test", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
@ -19,16 +20,13 @@ describe("Card - ThreeDS Manual payment flow test", () => {
cy.task("setGlobalState", globalState.data);
});
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
context("Card - ThreeDS Manual Full Capture payment flow test", () => {
context("payment Create and Confirm", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("create-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
@ -41,7 +39,7 @@ describe("Card - ThreeDS Manual payment flow test", () => {
res_data,
"three_ds",
"manual",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -88,14 +86,6 @@ describe("Card - ThreeDS Manual payment flow test", () => {
});
context("Payment Create+Confirm", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("create+confirm-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
@ -108,7 +98,7 @@ describe("Card - ThreeDS Manual payment flow test", () => {
res_data,
"three_ds",
"manual",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -144,14 +134,6 @@ describe("Card - ThreeDS Manual payment flow test", () => {
"Card - ThreeDS Manual Partial Capture payment flow test - Create and Confirm",
() => {
context("payment Create and Payment Confirm", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("create-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
@ -164,7 +146,7 @@ describe("Card - ThreeDS Manual payment flow test", () => {
res_data,
"three_ds",
"manual",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -185,7 +167,7 @@ describe("Card - ThreeDS Manual payment flow test", () => {
req_data,
res_data,
true,
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -217,14 +199,6 @@ describe("Card - ThreeDS Manual payment flow test", () => {
});
context("payment + Confirm", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("create+confirm-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
@ -237,7 +211,7 @@ describe("Card - ThreeDS Manual payment flow test", () => {
res_data,
"three_ds",
"manual",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -267,6 +241,6 @@ describe("Card - ThreeDS Manual payment flow test", () => {
cy.retrievePaymentCallTest(globalState);
});
});
},
}
);
});

View File

@ -6,6 +6,8 @@ import getConnectorDetails, * as utils from "../PaymentUtils/utils";
let globalState;
describe("Bank Transfers", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
@ -16,15 +18,13 @@ describe("Bank Transfers", () => {
cy.task("setGlobalState", globalState.data);
});
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"
@ -37,7 +37,7 @@ describe("Bank Transfers", () => {
res_data,
"three_ds",
"automatic",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -58,7 +58,7 @@ describe("Bank Transfers", () => {
req_data,
res_data,
true,
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -70,7 +70,7 @@ describe("Bank Transfers", () => {
cy.handleBankTransferRedirection(
globalState,
payment_method_type,
expected_redirection,
expected_redirection
);
});
});

View File

@ -6,6 +6,8 @@ import getConnectorDetails, * as utils from "../PaymentUtils/utils";
let globalState;
describe("Bank Redirect tests", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
@ -16,19 +18,17 @@ describe("Bank Redirect tests", () => {
cy.task("setGlobalState", globalState.data);
});
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
afterEach("flush global state", () => {
cy.task("setGlobalState", globalState.data);
});
context("Blik Create and Confirm flow test", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("create-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"bank_redirect_pm"
@ -41,7 +41,7 @@ describe("Bank Redirect tests", () => {
res_data,
"three_ds",
"automatic",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -62,7 +62,7 @@ describe("Bank Redirect tests", () => {
req_data,
res_data,
true,
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -70,13 +70,6 @@ describe("Bank Redirect tests", () => {
});
context("EPS Create and Confirm flow test", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("create-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"bank_redirect_pm"
@ -89,7 +82,7 @@ describe("Bank Redirect tests", () => {
res_data,
"three_ds",
"automatic",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -110,7 +103,7 @@ describe("Bank Redirect tests", () => {
req_data,
res_data,
true,
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -123,20 +116,12 @@ describe("Bank Redirect tests", () => {
cy.handleBankRedirectRedirection(
globalState,
payment_method_type,
expected_redirection,
expected_redirection
);
});
});
context("iDEAL Create and Confirm flow test", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("create-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"bank_redirect_pm"
@ -149,7 +134,7 @@ describe("Bank Redirect tests", () => {
res_data,
"three_ds",
"automatic",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -170,7 +155,7 @@ describe("Bank Redirect tests", () => {
req_data,
res_data,
true,
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -183,19 +168,12 @@ describe("Bank Redirect tests", () => {
cy.handleBankRedirectRedirection(
globalState,
payment_method_type,
expected_redirection,
expected_redirection
);
});
});
context("Giropay Create and Confirm flow test", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("create-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"bank_redirect_pm"
@ -208,7 +186,7 @@ describe("Bank Redirect tests", () => {
res_data,
"three_ds",
"automatic",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -229,7 +207,7 @@ describe("Bank Redirect tests", () => {
req_data,
res_data,
true,
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -242,19 +220,12 @@ describe("Bank Redirect tests", () => {
cy.handleBankRedirectRedirection(
globalState,
payment_method_type,
expected_redirection,
expected_redirection
);
});
});
context("Sofort Create and Confirm flow test", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("create-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"bank_redirect_pm"
@ -267,7 +238,7 @@ describe("Bank Redirect tests", () => {
res_data,
"three_ds",
"automatic",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -288,7 +259,7 @@ describe("Bank Redirect tests", () => {
req_data,
res_data,
true,
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -307,13 +278,6 @@ describe("Bank Redirect tests", () => {
});
context("Przelewy24 Create and Confirm flow test", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
it("create-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"bank_redirect_pm"

View File

@ -81,6 +81,133 @@ export const getCustomExchange = (overrides) => {
};
};
export const payment_methods_enabled = [
{
payment_method: "card",
payment_method_types: [
{
payment_method_type: "credit",
card_networks: [
"AmericanExpress",
"Discover",
"Interac",
"JCB",
"Mastercard",
"Visa",
"DinersClub",
"UnionPay",
"RuPay",
],
minimum_amount: 0,
maximum_amount: 68607706,
recurring_enabled: false,
installment_payment_enabled: true,
},
{
payment_method_type: "debit",
card_networks: [
"AmericanExpress",
"Discover",
"Interac",
"JCB",
"Mastercard",
"Visa",
"DinersClub",
"UnionPay",
"RuPay",
],
minimum_amount: 0,
maximum_amount: 68607706,
recurring_enabled: false,
installment_payment_enabled: true,
},
],
},
{
payment_method: "bank_transfer",
payment_method_types: [
{
payment_method_type: "pix",
minimum_amount: 0,
maximum_amount: 68607706,
recurring_enabled: false,
installment_payment_enabled: true,
},
],
},
{
payment_method: "bank_redirect",
payment_method_types: [
{
payment_method_type: "ideal",
payment_experience: null,
card_networks: null,
accepted_currencies: null,
accepted_countries: null,
minimum_amount: 1,
maximum_amount: 68607706,
recurring_enabled: true,
installment_payment_enabled: true,
},
{
payment_method_type: "giropay",
payment_experience: null,
card_networks: null,
accepted_currencies: null,
accepted_countries: null,
minimum_amount: 1,
maximum_amount: 68607706,
recurring_enabled: true,
installment_payment_enabled: true,
},
{
payment_method_type: "sofort",
payment_experience: null,
card_networks: null,
accepted_currencies: null,
accepted_countries: null,
minimum_amount: 1,
maximum_amount: 68607706,
recurring_enabled: true,
installment_payment_enabled: true,
},
{
payment_method_type: "eps",
payment_experience: null,
card_networks: null,
accepted_currencies: null,
accepted_countries: null,
minimum_amount: 1,
maximum_amount: 68607706,
recurring_enabled: true,
installment_payment_enabled: true,
},
{
payment_method_type: "blik",
payment_experience: null,
card_networks: null,
accepted_currencies: null,
accepted_countries: null,
minimum_amount: 1,
maximum_amount: 68607706,
recurring_enabled: true,
installment_payment_enabled: true,
},
{
payment_method_type: "przelewy24",
payment_experience: null,
card_networks: null,
accepted_currencies: null,
accepted_countries: null,
minimum_amount: 1,
maximum_amount: 68607706,
recurring_enabled: true,
installment_payment_enabled: true,
},
],
},
];
export const connectorDetails = {
card_pm: {
PaymentIntent: getCustomExchange({

View File

@ -6,12 +6,10 @@ describe("Connector Account Create flow test", () => {
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
console.log("seeding globalState -> " + JSON.stringify(globalState));
});
});
after("flush global state", () => {
console.log("flushing globalState -> " + JSON.stringify(globalState));
cy.task("setGlobalState", globalState.data);
});

View File

@ -7,30 +7,25 @@ let globalState;
describe("Card - Auto Fulfill", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
// Check if the connector supports card payouts (based on the connector configuration in creds)
if (!globalState.get("payoutsExecution")) {
should_continue = false;
}
});
});
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
console.log("seeding globalState -> " + JSON.stringify(globalState));
cy.task(
"cli_log",
"SEEDING GLOBAL STATE -> " + JSON.stringify(globalState),
);
});
});
afterEach("flush global state", () => {
console.log("flushing globalState -> " + JSON.stringify(globalState));
cy.task("setGlobalState", globalState.data);
cy.task(
"cli_log",
" FLUSHING GLOBAL STATE -> " + JSON.stringify(globalState),
);
});
context("Payout Card with Auto Fulfill", () => {
@ -46,7 +41,7 @@ describe("Card - Auto Fulfill", () => {
res_data,
true,
true,
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -70,7 +65,7 @@ describe("Card - Auto Fulfill", () => {
res_data,
true,
false,
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -105,7 +100,7 @@ describe("Card - Auto Fulfill", () => {
res_data,
false,
false,
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);

View File

@ -7,11 +7,9 @@ describe("Account Create flow test", () => {
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
console.log("seeding globalState -> " + JSON.stringify(globalState));
});
});
after("flush global state", () => {
console.log("flushing globalState -> " + JSON.stringify(globalState));
cy.task("setGlobalState", globalState.data);
});

View File

@ -7,11 +7,9 @@ describe("Customer Create flow test", () => {
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
console.log("seeding globalState -> " + JSON.stringify(globalState));
});
});
after("flush global state", () => {
console.log("flushing globalState -> " + JSON.stringify(globalState));
cy.task("setGlobalState", globalState.data);
});
it("customer-create-call-test", () => {

View File

@ -6,12 +6,10 @@ describe("Connector Account Create flow test", () => {
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
console.log("seeding globalState -> " + JSON.stringify(globalState));
});
});
after("flush global state", () => {
console.log("flushing globalState -> " + JSON.stringify(globalState));
cy.task("setGlobalState", globalState.data);
});
@ -20,7 +18,7 @@ describe("Connector Account Create flow test", () => {
createConnectorBody,
"adyen",
"payment_processor",
globalState,
globalState
);
});
@ -29,7 +27,7 @@ describe("Connector Account Create flow test", () => {
createConnectorBody,
"stripe",
"payment_processor",
globalState,
globalState
);
});
});

View File

@ -1,5 +1,5 @@
import routingConfigBody from "../../fixtures/routing-config-body.json";
import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json";
import routingConfigBody from "../../fixtures/routing-config-body.json";
import State from "../../utils/State";
import * as utils from "../RoutingUtils/utils";
@ -17,21 +17,11 @@ describe("Routing Test", () => {
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
console.log("seeding globalState -> " + JSON.stringify(globalState));
cy.task(
"cli_log",
"SEEDING GLOBAL STATE -> " + JSON.stringify(globalState),
);
});
});
afterEach("flush global state", () => {
console.log("flushing globalState -> " + JSON.stringify(globalState));
cy.task("setGlobalState", globalState.data);
cy.task(
"cli_log",
" FLUSHING GLOBAL STATE -> " + JSON.stringify(globalState),
);
});
context("Routing with Stripe as top priority", () => {
@ -59,7 +49,7 @@ describe("Routing Test", () => {
res_data,
"priority",
routing_data,
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
@ -93,7 +83,7 @@ describe("Routing Test", () => {
res_data,
"no_three_ds",
"automatic",
globalState,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);

View File

@ -10,132 +10,7 @@
},
"test_mode": true,
"disabled": false,
"payment_methods_enabled": [
{
"payment_method": "card",
"payment_method_types": [
{
"payment_method_type": "credit",
"card_networks": [
"AmericanExpress",
"Discover",
"Interac",
"JCB",
"Mastercard",
"Visa",
"DinersClub",
"UnionPay",
"RuPay"
],
"minimum_amount": 0,
"maximum_amount": 68607706,
"recurring_enabled": false,
"installment_payment_enabled": true
},
{
"payment_method_type": "debit",
"card_networks": [
"AmericanExpress",
"Discover",
"Interac",
"JCB",
"Mastercard",
"Visa",
"DinersClub",
"UnionPay",
"RuPay"
],
"minimum_amount": 0,
"maximum_amount": 68607706,
"recurring_enabled": false,
"installment_payment_enabled": true
}
]
},
{
"payment_method": "bank_transfer",
"payment_method_types": [
{
"payment_method_type": "pix",
"minimum_amount": 0,
"maximum_amount": 68607706,
"recurring_enabled": false,
"installment_payment_enabled": true
}
]
},
{
"payment_method": "bank_redirect",
"payment_method_types": [
{
"payment_method_type": "ideal",
"payment_experience": null,
"card_networks": null,
"accepted_currencies": null,
"accepted_countries": null,
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true
},
{
"payment_method_type": "giropay",
"payment_experience": null,
"card_networks": null,
"accepted_currencies": null,
"accepted_countries": null,
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true
},
{
"payment_method_type": "sofort",
"payment_experience": null,
"card_networks": null,
"accepted_currencies": null,
"accepted_countries": null,
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true
},
{
"payment_method_type": "eps",
"payment_experience": null,
"card_networks": null,
"accepted_currencies": null,
"accepted_countries": null,
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true
},
{
"payment_method_type": "blik",
"payment_experience": null,
"card_networks": null,
"accepted_currencies": null,
"accepted_countries": null,
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true
},
{
"payment_method_type": "przelewy24",
"payment_experience": null,
"card_networks": null,
"accepted_currencies": null,
"accepted_countries": null,
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true
}
]
}
],
"payment_methods_enabled": [],
"metadata": {
"city": "NY",
"unit": "245",

View File

@ -89,9 +89,10 @@ Cypress.Commands.add("apiKeyCreateTest", (apiKeyCreateBody, globalState) => {
Cypress.Commands.add(
"createConnectorCallTest",
(createConnectorBody, globalState) => {
(createConnectorBody, payment_methods_enabled, globalState) => {
const merchantId = globalState.get("merchantId");
createConnectorBody.connector_name = globalState.get("connectorId");
createConnectorBody.payment_methods_enabled = payment_methods_enabled;
// readFile is used to read the contents of the file and it always returns a promise ([Object Object]) due to its asynchronous nature
// it is best to use then() to handle the response within the same block of code
cy.readFile(globalState.get("connectorAuthFilePath")).then(
@ -145,6 +146,15 @@ Cypress.Commands.add(
JSON.stringify(jsonContent),
`${connectorName}_payout`,
);
// If the connector does not have payout connector creds in creds file, set payoutsExecution to false
if (authDetails === null) {
globalState.set("payoutsExecution", false);
return false;
} else {
globalState.set("payoutsExecution", true);
}
createConnectorBody.connector_account_details = authDetails;
cy.request({
method: "POST",

View File

@ -4,7 +4,7 @@ export function handleRedirection(
redirection_type,
urls,
connectorId,
payment_method_type,
payment_method_type
) {
switch (redirection_type) {
case "three_ds":
@ -15,7 +15,7 @@ export function handleRedirection(
urls.redirection_url,
urls.expected_url,
connectorId,
payment_method_type,
payment_method_type
);
break;
case "bank_transfer":
@ -23,7 +23,7 @@ export function handleRedirection(
urls.redirection_url,
urls.expected_url,
connectorId,
payment_method_type,
payment_method_type
);
break;
default:
@ -35,7 +35,7 @@ function bankTransferRedirection(
redirection_url,
expected_url,
connectorId,
payment_method_type,
payment_method_type
) {
cy.request(redirection_url.href).then((response) => {
switch (connectorId) {
@ -119,7 +119,7 @@ function bankRedirectRedirection(
redirection_url,
expected_url,
connectorId,
payment_method_type,
payment_method_type
) {
let verifyUrl = false;
cy.visit(redirection_url.href);
@ -136,7 +136,7 @@ function bankRedirectRedirection(
case "ideal":
cy.get(":nth-child(4) > td > p").should(
"contain.text",
"Your Payment was Authorised/Refused/Cancelled (It may take up to five minutes to show on the Payment List)",
"Your Payment was Authorised/Refused/Cancelled (It may take up to five minutes to show on the Payment List)"
);
cy.get(".btnLink").click();
cy.url().should("include", "status=succeeded");
@ -144,12 +144,12 @@ function bankRedirectRedirection(
break;
case "giropay":
cy.get(
".rds-cookies-overlay__allow-all-cookies-btn > .rds-button",
".rds-cookies-overlay__allow-all-cookies-btn > .rds-button"
).click();
cy.wait(5000);
cy.get(".normal-3").should(
"contain.text",
"Bank suchen mit giropay zahlen.",
"Bank suchen mit giropay zahlen."
);
cy.get("#bankSearch").type("giropay TestBank{enter}");
cy.get(".normal-2 > div").click();
@ -186,7 +186,7 @@ function bankRedirectRedirection(
.should("contain", "Continue")
.click();
}
},
}
);
break;
case "trustly":
@ -227,16 +227,16 @@ function bankRedirectRedirection(
case "eps":
cy.get("._transactionId__header__iXVd_").should(
"contain.text",
"Bank suchen mit eps zahlen.",
"Bank suchen mit eps zahlen."
);
cy.get(".BankSearch_searchInput__uX_9l").type(
"Allgemeine Sparkasse Oberösterreich Bank AG{enter}",
"Allgemeine Sparkasse Oberösterreich Bank AG{enter}"
);
cy.get(".BankSearch_searchResultItem__lbcKm").click();
cy.get("._transactionId__primaryButton__nCa0r").click();
cy.get("#loginTitle").should(
"contain.text",
"eps Online-Überweisung Login",
"eps Online-Überweisung Login"
);
cy.get("#user")
.should("be.visible")
@ -248,7 +248,7 @@ function bankRedirectRedirection(
case "ideal":
cy.get("p").should(
"contain.text",
"Choose your iDeal Issuer Bank please",
"Choose your iDeal Issuer Bank please"
);
cy.get("#issuerSearchInput").click();
cy.get("#issuerSearchInput").type("ING{enter}");
@ -257,10 +257,10 @@ function bankRedirectRedirection(
case "giropay":
cy.get("._transactionId__header__iXVd_").should(
"contain.text",
"Bank suchen mit giropay zahlen.",
"Bank suchen mit giropay zahlen."
);
cy.get(".BankSearch_searchInput__uX_9l").type(
"Volksbank Hildesheim{enter}",
"Volksbank Hildesheim{enter}"
);
cy.get(".BankSearch_searchIcon__EcVO7").click();
cy.get(".BankSearch_bankWrapper__R5fUK").click();
@ -273,7 +273,7 @@ function bankRedirectRedirection(
break;
default:
throw new Error(
`Unsupported payment method type: ${payment_method_type}`,
`Unsupported payment method type: ${payment_method_type}`
);
}
verifyUrl = false;
@ -297,7 +297,7 @@ function verifyReturnUrl(redirection_url, expected_url, forward_flow) {
{ args: { expected_url: expected_url.origin } },
({ expected_url }) => {
cy.window().its("location.origin").should("eq", expected_url);
},
}
);
}
}
@ -327,7 +327,7 @@ async function fetchAndParseQRCode(url) {
const qrCodeData = jsQR(
imageData.data,
imageData.width,
imageData.height,
imageData.height
);
if (qrCodeData) {

View File

@ -17,19 +17,19 @@ Before installing Cypress, ensure you have the following prerequisites installed
To run test cases, follow these steps:
1. Install Cypress
```shell
npm install cypress --save-dev
```
2. Clone the repository and switch to the project directory:
1. Clone the repository and switch to the project directory:
```shell
git clone https://github.com/juspay/hyperswitch
cd cypress-tests
```
2. Install Cypress and its dependencies to `cypress-tests` directory by running the following command:
```shell
npm install
```
3. Set environment variables for cypress
```shell
@ -42,18 +42,36 @@ To run test cases, follow these steps:
4. Run Cypress test cases
To run the tests in a browser in interactive mode run the following command
To run the tests in interactive mode run the following command
```shell
npm run cypress
```
To run the tests in headless mode run the following command
To run all the tests in headless mode run the following command
```shell
npm run cypress:ci
```
To run payment tests in headless mode run the following command
```shell
npm run cypress:payments
```
To run payout tests in headless mode run the following command
```shell
npm run cypress:payouts
```
To run routing tests in headless mode run the following command
```shell
npm run cypress:routing
```
> [!NOTE]
> To learn about how creds file should be structured, refer to the [example.creds.json](#example-credsjson) section below.
@ -65,21 +83,21 @@ The folder structure of this directory is as follows:
. # The root directory for the Cypress tests.
├── .gitignore
├── cypress # Contains Cypress-related files and folders.
   ├── e2e # End-to-end test directory.
   │   ├── ConnectorTest # Directory for test scenarios related to connectors.
   │   │   ├── your_testcase1_files_here.cy.js
   │   │   ├── your_testcase2_files_here.cy.js
   │   │   └── ...
   │   └── ConnectorUtils # Directory for utility functions related to connectors.
   │   ├── connector_detail_files_here.js
   │   └── utils.js
   ├── fixtures # Directory for storing test data API request.
   │   └── your_fixture_files_here.json
   ├── support # Directory for Cypress support files.
   │   ├── commands.js # File containing custom Cypress commands and utilities.
   │   └── e2e.js
   └── utils
   └── utility_files_go_here.js
├── e2e # End-to-end test directory.
├── ConnectorTest # Directory for test scenarios related to connectors.
│ │ ├── your_testcase1_files_here.cy.js
│ │ ├── your_testcase2_files_here.cy.js
│ │ └── ...
└── ConnectorUtils # Directory for utility functions related to connectors.
├── connector_detail_files_here.js
└── utils.js
├── fixtures # Directory for storing test data API request.
└── your_fixture_files_here.json
├── support # Directory for Cypress support files.
├── commands.js # File containing custom Cypress commands and utilities.
└── e2e.js
└── utils
└── utility_files_go_here.js
├── cypress.config.js # Cypress configuration file.
├── cypress.env.json # File is used to store environment-specific configuration values,such as base URLs, which can be accessed within your Cypress tests.
├── package.json # Node.js package file.
@ -141,7 +159,7 @@ Cypress.Commands.add("listMandateCallTest", (globalState) => {
} else {
cy.task(
"cli_log",
"x-request-id is not available in the response headers",
"x-request-id is not available in the response headers"
);
}
expect(response.headers["content-type"]).to.include("application/json");