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

ci(cypressV2): update cypress v2 framework to accommodate hyperswitch v2 changes #6493

Merged
merged 16 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions cypress-tests-v2/cypress/e2e/configs/Payment/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,3 @@ export function defaultErrorHandler(response, response_data) {
expect(response.body.error).to.include(response_data.body.error);
}
}

export function isoTimeTomorrow() {
const now = new Date();

// Create a new date object for tomorrow
const tomorrow = new Date(now);
tomorrow.setDate(now.getDate() + 1);

// Convert to ISO string format
const isoStringTomorrow = tomorrow.toISOString();
return isoStringTomorrow;
}
15 changes: 13 additions & 2 deletions cypress-tests-v2/cypress/e2e/configs/Payment/_Reusable.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,23 @@ function normalise(input) {
paybox: "Paybox",
paypal: "Paypal",
wellsfargo: "Wellsfargo",
fiuu: "Fiuu",
// Add more known exceptions here
};

if (typeof input !== "string") {
const spec_name = Cypress.spec.name.split("-")[1].split(".")[0];
return `${spec_name}`;
const specName = Cypress.spec.name;

if (specName.includes("-")) {
const parts = specName.split("-");

if (parts.length > 1 && parts[1].includes(".")) {
return parts[1].split(".")[0];
}
}

// Fallback
return `${specName}`;
}

const lowerCaseInput = input.toLowerCase();
Expand Down
132 changes: 132 additions & 0 deletions cypress-tests-v2/cypress/e2e/spec/Payment/0001-[No3DS]Payments.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
/*
No 3DS Auto capture with Confirm True
No 3DS Auto capture with Confirm False
No 3DS Manual capture with Confirm True
No 3DS Manual capture with Confirm False
No 3DS Manual multiple capture with Confirm True
No 3DS Manual multiple capture with Confirm False
*/

import * as fixtures from "../../../fixtures/imports";
import State from "../../../utils/State";
import getConnectorDetails from "../../configs/Payment/Utils";

let globalState;

// Below is an example of a test that is skipped just because it is not implemented yet
describe("[Payment] [No 3DS] [Payment Method: Card]", () => {
context("[Payment] [No 3DS] [Capture: Automatic] [Confirm: True]", () => {
let should_continue = true;

before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
});
});
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});

after("flush global state", () => {
cy.task("setGlobalState", globalState.data);
});

it.skip("Create payment intent", () => {
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
"PaymentIntent"
];
let req_data = data["Request"];
let res_data = data["Response"];
cy.paymentIntentCreateCall(
fixtures.createPaymentBody,
req_data,
res_data,
"no_three_ds",
"automatic",
globalState
);
});

it.skip("List payment methods", () => {
cy.paymentMethodsListCall(globalState);
});

it.skip("Confirm payment intent", () => {
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
"No3DSAutoCapture"
];
let req_data = data["Request"];
let res_data = data["Response"];
cy.paymentIntentConfirmCall(
fixtures.confirmBody,
req_data,
res_data,
true,
globalState
);
});

it.skip("Retrieve payment intent", () => {
cy.paymentIntentRetrieveCall(globalState);
});
});
context("[Payment] [No 3DS] [Capture: Automatic] [Confirm: False]", () => {
let should_continue = true;

before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
});
});
beforeEach(function () {
if (!should_continue) {
this.skip();
}
});

after("flush global state", () => {
cy.task("setGlobalState", globalState.data);
});

it.skip("Create Payment Intent", () => {
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
"PaymentIntent"
];
let req_data = data["Request"];
let res_data = data["Response"];
cy.paymentIntentCreateCall(
fixtures.createPaymentBody,
req_data,
res_data,
"no_three_ds",
"automatic",
globalState
);
});

it.skip("Payment Methods", () => {
cy.paymentMethodsCallTest(globalState);
});

it.skip("Confirm No 3DS", () => {
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
"No3DSAutoCapture"
];
let req_data = data["Request"];
let res_data = data["Response"];
cy.paymentIntentConfirmCall(
fixtures.confirmBody,
req_data,
res_data,
true,
globalState
);
});

it.skip("Retrieve payment intent", () => {
cy.paymentIntentRetrieveCall(globalState);
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
3DS Auto capture with Confirm True
3DS Auto capture with Confirm False
3DS Manual capture with Confirm True
3DS Manual capture with Confirm False
3DS Manual multiple capture with Confirm True
3DS Manual multiple capture with Confirm False
*/
2 changes: 1 addition & 1 deletion cypress-tests-v2/cypress/fixtures/organization.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"org_create": {
"organization_name": "Hyperswitch Organization"
"organization_name": "Hyperswitch"
},
"org_update": {
"organization_name": "Hyperswitch",
Expand Down
Loading
Loading