Skip to content

Commit

Permalink
refactor(cypress): correction of cypress tests env variables for Paym…
Browse files Browse the repository at this point in the history
…ent method list (#5299)
  • Loading branch information
prajjwalkumar17 authored Jul 12, 2024
1 parent 2c32152 commit 1081e38
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ import {
} from "../PaymentMethodListUtils/Commons";
import getConnectorDetails from "../PaymentMethodListUtils/Utils";

// Testing for scenario:
// MCA1 -> Stripe configured with ideal = { country = "NL", currency = "EUR" }
// MCA2 -> Cybersource configured with credit = { currency = "USD" }
// Payment is done with currency as EUR and no billing address
// The resultant Payment Method list should only have ideal with stripe

let globalState;
describe("Payment Method list using Constraint Graph flow tests", () => {
// Testing for scenario:
Expand Down Expand Up @@ -90,7 +84,7 @@ describe("Payment Method list using Constraint Graph flow tests", () => {

// payment method list which should only have ideal with stripe
it("payment-method-list-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
let data = getConnectorDetails("stripe")[
"pm_list"
]["PmListResponse"]["PmListWithStripeForIdeal"];
cy.paymentMethodListTestLessThanEqualToOnePaymentMethod(
Expand Down Expand Up @@ -170,7 +164,7 @@ describe("Payment Method list using Constraint Graph flow tests", () => {

// payment method list which should only have ideal with stripe
it("payment-method-list-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
let data = getConnectorDetails("stripe")[
"pm_list"
]["PmListResponse"]["PmListNull"];
cy.paymentMethodListTestLessThanEqualToOnePaymentMethod(
Expand Down Expand Up @@ -250,7 +244,7 @@ describe("Payment Method list using Constraint Graph flow tests", () => {

// payment method list which should only have credit with Stripe and Cybersource
it("payment-method-list-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
let data = getConnectorDetails("stripe")[
"pm_list"
]["PmListResponse"]["PmListWithCreditTwoConnector"];
cy.paymentMethodListTestTwoConnectorsForOnePaymentMethodCredit(
Expand Down Expand Up @@ -330,7 +324,7 @@ describe("Payment Method list using Constraint Graph flow tests", () => {

// payment method list which shouldn't have anything
it("payment-method-list-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
let data = getConnectorDetails("stripe")[
"pm_list"
]["PmListResponse"]["PmListNull"];
cy.paymentMethodListTestLessThanEqualToOnePaymentMethod(
Expand Down Expand Up @@ -414,7 +408,7 @@ describe("Payment Method list using Constraint Graph flow tests", () => {

// payment method list which should have credit with stripe and cybersource and no ideal
it("payment-method-list-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
let data = getConnectorDetails("stripe")[
"pm_list"
]["PmListResponse"]["PmListWithCreditTwoConnector"];
cy.paymentMethodListTestTwoConnectorsForOnePaymentMethodCredit(
Expand Down
15 changes: 0 additions & 15 deletions cypress-tests/cypress/e2e/PaymentMethodListUtils/Commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,18 +162,3 @@ export const create_payment_body_with_currency = (currency) => ({
},
business_label: "default",
});

export const create_payment_body_in_USD = {
currency: "USD",
amount: 6500,
authentication_type: "three_ds",
description: "Joseph First Crypto",
email: "hyperswitch_sdk_demo_id@gmail.com",
setup_future_usage: "",
metadata: {
udf1: "value1",
new_customer: "true",
login_date: "2019-09-10T10:11:12Z",
},
business_label: "default",
};
8 changes: 5 additions & 3 deletions cypress-tests/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,11 @@ Cypress.Commands.add(
.slice()
.sort();
}
for (let i = 0; i < getPaymentMethodType(response.body).length; i++) {
expect(getPaymentMethodType(res_data)[i]).to.equal(
getPaymentMethodType(response.body)[i]
let config_payment_method_type = getPaymentMethodType(res_data);
let response_payment_method_type = getPaymentMethodType(response.body);
for (let i = 0; i < response_payment_method_type.length; i++) {
expect(config_payment_method_type[i]).to.equal(
response_payment_method_type[i]
);
}
} else {
Expand Down

0 comments on commit 1081e38

Please sign in to comment.