refactor(cypress): make connector_label configurable in cypress (#5547)

This commit is contained in:
Pa1NarK
2024-08-07 18:36:52 +05:30
committed by GitHub
parent 0a4b2c35e1
commit 8881e9774e
7 changed files with 546 additions and 527 deletions

View File

@ -48,7 +48,8 @@ describe("Payment Method list using Constraint Graph flow tests", () => {
createConnectorBody, createConnectorBody,
bank_redirect_ideal_enabled, bank_redirect_ideal_enabled,
globalState, globalState,
"stripe" "stripe",
"stripe_US_default"
); );
}); });
@ -59,7 +60,8 @@ describe("Payment Method list using Constraint Graph flow tests", () => {
createConnectorBody, createConnectorBody,
card_credit_enabled, card_credit_enabled,
globalState, globalState,
"cybersource" "cybersource",
"cybersource_US_default"
); );
}); });
@ -126,7 +128,8 @@ describe("Payment Method list using Constraint Graph flow tests", () => {
createConnectorBody, createConnectorBody,
bank_redirect_ideal_enabled, bank_redirect_ideal_enabled,
globalState, globalState,
"stripe" "stripe",
"stripe_US_default"
); );
}); });
@ -137,7 +140,8 @@ describe("Payment Method list using Constraint Graph flow tests", () => {
createConnectorBody, createConnectorBody,
card_credit_enabled_in_USD, card_credit_enabled_in_USD,
globalState, globalState,
"cybersource" "cybersource",
"cybersource_US_default"
); );
}); });
@ -204,7 +208,8 @@ describe("Payment Method list using Constraint Graph flow tests", () => {
createConnectorBody, createConnectorBody,
card_credit_enabled_in_US, card_credit_enabled_in_US,
globalState, globalState,
"stripe" "stripe",
"stripe_US_default"
); );
}); });
@ -215,7 +220,8 @@ describe("Payment Method list using Constraint Graph flow tests", () => {
createConnectorBody, createConnectorBody,
card_credit_enabled_in_US, card_credit_enabled_in_US,
globalState, globalState,
"cybersource" "cybersource",
"cybersource_US_default"
); );
}); });
@ -282,7 +288,8 @@ describe("Payment Method list using Constraint Graph flow tests", () => {
createConnectorBody, createConnectorBody,
bank_redirect_ideal_enabled, bank_redirect_ideal_enabled,
globalState, globalState,
"stripe" "stripe",
"stripe_US_default"
); );
}); });
@ -293,7 +300,8 @@ describe("Payment Method list using Constraint Graph flow tests", () => {
createConnectorBody, createConnectorBody,
bank_redirect_ideal_enabled, bank_redirect_ideal_enabled,
globalState, globalState,
"cybersource" "cybersource",
"cybersource_US_default"
); );
}); });
@ -362,7 +370,8 @@ describe("Payment Method list using Constraint Graph flow tests", () => {
createConnectorBody, createConnectorBody,
card_credit_enabled, card_credit_enabled,
globalState, globalState,
"stripe" "stripe",
"stripe_US_default"
); );
}); });
@ -373,7 +382,8 @@ describe("Payment Method list using Constraint Graph flow tests", () => {
createConnectorBody, createConnectorBody,
bank_redirect_ideal_and_credit_enabled, bank_redirect_ideal_and_credit_enabled,
globalState, globalState,
"cybersource" "cybersource",
"cybersource_US_default"
); );
}); });
@ -441,7 +451,8 @@ describe("Payment Method list using Constraint Graph flow tests", () => {
createConnectorBody, createConnectorBody,
card_credit_enabled, card_credit_enabled,
globalState, globalState,
"stripe" "stripe",
"stripe_US_default"
); );
}); });
@ -452,7 +463,8 @@ describe("Payment Method list using Constraint Graph flow tests", () => {
createConnectorBody, createConnectorBody,
card_credit_enabled, card_credit_enabled,
globalState, globalState,
"cybersource" "cybersource",
"cybersource_US_default"
); );
}); });
@ -519,7 +531,8 @@ describe("Payment Method list using Constraint Graph flow tests", () => {
createConnectorBody, createConnectorBody,
bank_redirect_ideal_enabled, bank_redirect_ideal_enabled,
globalState, globalState,
"stripe" "stripe",
"stripe_US_default"
); );
}); });
@ -530,7 +543,8 @@ describe("Payment Method list using Constraint Graph flow tests", () => {
createConnectorBody, createConnectorBody,
card_credit_enabled, card_credit_enabled,
globalState, globalState,
"cybersource" "cybersource",
"cybersource_US_default"
); );
}); });

View File

@ -15,7 +15,7 @@ function normalise(input) {
bankofamerica: "Bank of America", bankofamerica: "Bank of America",
cybersource: "Cybersource", cybersource: "Cybersource",
paypal: "Paypal", paypal: "Paypal",
wellsfargo: "Wellsfargo" wellsfargo: "Wellsfargo",
// Add more known exceptions here // Add more known exceptions here
}; };

View File

@ -28,7 +28,7 @@ const connectorDetails = {
stripe: stripeConnectorDetails, stripe: stripeConnectorDetails,
trustpay: trustpayConnectorDetails, trustpay: trustpayConnectorDetails,
datatrans: datatransConnectorDetails, datatrans: datatransConnectorDetails,
wellsfargo: wellsfargoConnectorDetails wellsfargo: wellsfargoConnectorDetails,
}; };
export default function getConnectorDetails(connectorId) { export default function getConnectorDetails(connectorId) {

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,7 @@ function normalise(input) {
const exceptions = { const exceptions = {
adyenplatform: "Adyenplatform", adyenplatform: "Adyenplatform",
wise: "Wise", wise: "Wise",
wellsfargo: "Wellsfargo" wellsfargo: "Wellsfargo",
// Add more known exceptions here // Add more known exceptions here
}; };

View File

@ -79,7 +79,6 @@ Cypress.Commands.add("merchantRetrieveCall", (globalState) => {
expect(response.headers["content-type"]).to.include("application/json"); expect(response.headers["content-type"]).to.include("application/json");
expect(response.body.merchant_id).to.equal(merchant_id); expect(response.body.merchant_id).to.equal(merchant_id);
expect(response.body.amount).to.equal(globalState.get("paymentAmount"));
expect(response.body.payment_response_hash_key).to.not.be.empty; expect(response.body.payment_response_hash_key).to.not.be.empty;
expect(response.body.publishable_key).to.not.be.empty; expect(response.body.publishable_key).to.not.be.empty;
expect(response.body.default_profile).to.not.be.empty; expect(response.body.default_profile).to.not.be.empty;
@ -282,11 +281,13 @@ Cypress.Commands.add(
createConnectorBody, createConnectorBody,
payment_methods_enabled, payment_methods_enabled,
globalState, globalState,
connectorName connectorName,
connectorLabel
) => { ) => {
const merchantId = globalState.get("merchantId"); const merchantId = globalState.get("merchantId");
createConnectorBody.connector_type = connectorType; createConnectorBody.connector_type = connectorType;
createConnectorBody.connector_name = connectorName; createConnectorBody.connector_name = connectorName;
createConnectorBody.connector_label = connectorLabel;
createConnectorBody.payment_methods_enabled = payment_methods_enabled; 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 // 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 // it is best to use then() to handle the response within the same block of code

View File

@ -295,7 +295,11 @@ function threeDsRedirection(redirection_url, expected_url, connectorId) {
cy.get('input[type="password"]').type("password"); cy.get('input[type="password"]').type("password");
cy.get("#buttonSubmit").click(); cy.get("#buttonSubmit").click();
}); });
} else if (connectorId === "bankofamerica" || connectorId === "cybersource" || connectorId === "wellsfargo"){ } else if (
connectorId === "bankofamerica" ||
connectorId === "cybersource" ||
connectorId === "wellsfargo"
) {
cy.get("iframe", { timeout: TIMEOUT }) cy.get("iframe", { timeout: TIMEOUT })
.its("0.contentDocument.body") .its("0.contentDocument.body")
.within((body) => { .within((body) => {