Skip to content

Commit

Permalink
chore: auto-format with prettier
Browse files Browse the repository at this point in the history
it is better for reviewers to review based on commit
  • Loading branch information
pixincreate committed May 9, 2024
1 parent 0ef5ac2 commit 7c0c310
Show file tree
Hide file tree
Showing 30 changed files with 3,058 additions and 2,415 deletions.
17 changes: 8 additions & 9 deletions cypress-tests/cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@

let globalState;
module.exports = {
e2e: {
setupNodeEvents(on, config) {
on('task', {
on("task", {
setGlobalState: (val) => {
return (globalState = (val || {}))
return (globalState = val || {});
},
getGlobalState: () => {
return (globalState || {})
return globalState || {};
},
cli_log: (message) => {
console.log("Logging console message from task");
console.log(message);
return null;
}
})
},
});
},
experimentalRunAllSpecs: true
experimentalRunAllSpecs: true,
},
chromeWebSecurity: false
};
chromeWebSecurity: false,
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,21 @@ import State from "../../utils/State";

let globalState;
describe("Account Create flow test", () => {

before("seed global state", () => {

cy.task('getGlobalState').then((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);
})
cy.task("setGlobalState", globalState.data);
});

it("merchant-create-call-test", () => {
cy.merchantCreateCallTest(merchantCreateBody, globalState);
});
it("api-key-create-call-test", () => {
cy.apiKeyCreateTest(apiKeyCreateBody, globalState);
});

});
30 changes: 13 additions & 17 deletions cypress-tests/cypress/e2e/ConnectorTest/00001-CustomerCreate.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,17 @@ import State from "../../utils/State";
let globalState;

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

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);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@ import State from "../../utils/State";

let globalState;
describe("Connector Account Create flow test", () => {

before("seed global state", () => {

cy.task('getGlobalState').then((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);
})
cy.task("setGlobalState", globalState.data);
});

it("connector-create-call-test", () => {
cy.createConnectorCallTest(createConnectorBody, globalState);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,28 @@ import getConnectorDetails from "../ConnectorUtils/utils";
let globalState;

describe("Card - NoThreeDS payment flow test", () => {

before("seed global state", () => {
cy.task('getGlobalState').then((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);
})
cy.task("setGlobalState", globalState.data);
});

context("Card-NoThreeDS payment flow test Create and confirm", () => {

it("create-payment-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];
cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "automatic", globalState);
cy.createPaymentIntentTest(
createPaymentBody,
det,
"no_three_ds",
"automatic",
globalState
);
});

it("payment_methods-call-test", () => {
Expand All @@ -39,19 +43,23 @@ describe("Card - NoThreeDS payment flow test", () => {
it("retrieve-payment-call-test", () => {
cy.retrievePaymentCallTest(globalState);
});

});

context("Card-NoThreeDS payment flow test Create+Confirm", () => {

it("create+confirm-payment-call-test", () => {
console.log("confirm -> " + globalState.get("connectorId"));
let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];
cy.createConfirmPaymentTest(createConfirmPaymentBody, det, "no_three_ds", "automatic", globalState);
cy.createConfirmPaymentTest(
createConfirmPaymentBody,
det,
"no_three_ds",
"automatic",
globalState
);
});

it("retrieve-payment-call-test", () => {
cy.retrievePaymentCallTest(globalState);
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,50 @@ import getConnectorDetails from "../ConnectorUtils/utils";
let globalState;

describe("Card - ThreeDS payment flow test", () => {

before("seed global state", () => {

cy.task('getGlobalState').then((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));
})

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

cy.task("setGlobalState", globalState.data);
cy.task(
"cli_log",
" FLUSHING GLOBAL STATE -> " + JSON.stringify(globalState)
);
});

it("create-payment-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];
cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "automatic", globalState);
cy.createPaymentIntentTest(
createPaymentBody,
det,
"three_ds",
"automatic",
globalState
);
});

it("payment_methods-call-test", () => {
cy.task('cli_log', "PM CALL ");
cy.task("cli_log", "PM CALL ");
cy.paymentMethodsCallTest(globalState);
});

it("Confirm 3DS", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["3DS"];
cy.task('cli_log', "GLOBAL STATE -> " + JSON.stringify(globalState.data));
cy.task("cli_log", "GLOBAL STATE -> " + JSON.stringify(globalState.data));
cy.confirmCallTest(confirmBody, det, true, globalState);
});

it("Handle redirection", () => {
let expected_redirection = confirmBody["return_url"];
cy.handleRedirection(globalState, expected_redirection);
})

});
});
});

0 comments on commit 7c0c310

Please sign in to comment.