Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

refactor(cypress): correction of cypress tests env variables for Payment method list (#5299)

Prajjwal Kumar1081e38089e3
diff --git a/cypress-tests/cypress/e2e/PaymentMethodListTest/00000-PaymentMethodListTests.cy.js b/cypress-tests/cypress/e2e/PaymentMethodListTest/00000-PaymentMethodListTests.cy.js
index aa28e62d7e..768ad0f7c5 100644
--- a/cypress-tests/cypress/e2e/PaymentMethodListTest/00000-PaymentMethodListTests.cy.js
+++ b/cypress-tests/cypress/e2e/PaymentMethodListTest/00000-PaymentMethodListTests.cy.js
@@ -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:
@@ -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(
@@ -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(
@@ -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(
@@ -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(
@@ -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(
diff --git a/cypress-tests/cypress/e2e/PaymentMethodListUtils/Commons.js b/cypress-tests/cypress/e2e/PaymentMethodListUtils/Commons.js
index bc2813deec..36379fd6f8 100644
--- a/cypress-tests/cypress/e2e/PaymentMethodListUtils/Commons.js
+++ b/cypress-tests/cypress/e2e/PaymentMethodListUtils/Commons.js
@@ -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: "[email protected]",
- setup_future_usage: "",
- metadata: {
- udf1: "value1",
- new_customer: "true",
- login_date: "2019-09-10T10:11:12Z",
- },
- business_label: "default",
-};
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index 953456a471..af7600890b 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -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 {