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(cypress): Trustpay collection fix #4410

Open
wants to merge 14 commits into
base: refactor-cypress-for-more-control
Choose a base branch
from
7 changes: 6 additions & 1 deletion cypress-tests/cypress/fixtures/errors.js
Expand Up @@ -72,7 +72,12 @@ export const paymentMethodCAErrors = {
"type": "invalid_request",
"message": "Payment method does not exist in our records",
"code": "HE_02"
}
},
"tokenOrMethodDataMissing": {
"type": "invalid_request",
"message": "A payment token or payment method data is required",
"code": "IR_06"
},
};

export const paymentErrors = {
Expand Down
9 changes: 6 additions & 3 deletions cypress-tests/cypress/support/commands.js
Expand Up @@ -25,7 +25,7 @@
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })

// commands.js or your custom support file
import ConnectorAuthDetails from "../../../.github/secrets/creds.json";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pixincreate We can add the path as env then everyone would just export the path instead of updating it here!
We can take up that change in this pr may be?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@likhinbopanna is the change mentioned above is done?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have just reverted the connectorAuthDetails and that is done

import ConnectorAuthDetails from "/Users/likhin.bopanna/Desktop/creds.json";
import * as Errors from "../fixtures/errors";
import * as RequestBodyUtils from "../utils/RequestBodyUtils";

Expand Down Expand Up @@ -664,8 +664,11 @@ Cypress.Commands.add("mitForMandatesCallTest", (requestBody, amount, confirm, ca
}
}
else if(response.body.error.type === "invalid_request") {
if(response.body.error.message === "Payment method type not supported") {
expect(response.body.error).to.deep.equal(Errors.paymentMethodErrors.paymentMethodDoesNotExist);
if(response.body.error.message === Errors.paymentMethodCAErrors.paymentMethodDoesNotExist["message"]) {
expect(response.body.error).to.deep.equal(Errors.paymentMethodCAErrors.paymentMethodDoesNotExist);
} else if (response.body.error.message === Errors.paymentMethodCAErrors.tokenOrMethodDataMissing["message"]) {
expect(response.body.error).to.deep.equal(Errors.paymentMethodCAErrors.tokenOrMethodDataMissing)

}
}
});
Expand Down