Files
hyperswitch/cypress-tests/cypress/e2e/PaymentTest/00003-ConnectorCreate.cy.js
Pa1NarK 64383915bd feat(cypress): add multiple creds and flags support (#6588)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
2024-12-03 10:48:29 +00:00

54 lines
1.6 KiB
JavaScript

import * as fixtures from "../../fixtures/imports";
import State from "../../utils/State";
import { payment_methods_enabled } from "../PaymentUtils/Commons";
let globalState;
describe("Connector Account Create flow test", () => {
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
});
});
after("flush global state", () => {
cy.task("setGlobalState", globalState.data);
});
it("connector-create-call-test", () => {
cy.createConnectorCallTest(
"payment_processor",
fixtures.createConnectorBody,
payment_methods_enabled,
globalState
);
});
it("check and create multiple connectors", () => {
const multiple_connectors = Cypress.env("MULTIPLE_CONNECTORS");
// multiple_connectors will be undefined if not set in the env
if (multiple_connectors?.status) {
// Create multiple connectors based on the count
// The first connector is already created when creating merchant account, so start from 1
for (let i = 1; i < multiple_connectors.count; i++) {
cy.createBusinessProfileTest(
fixtures.businessProfile.bpCreate,
globalState,
"profile" + i
);
cy.createConnectorCallTest(
"payment_processor",
fixtures.createConnectorBody,
payment_methods_enabled,
globalState,
`profile${i}`,
`merchantConnector${i}`
);
}
} else {
cy.log(
"Multiple connectors not enabled. Skipping creation of multiple profiles and respective MCAs"
);
}
});
});