refactor(cypress): fix payouts not running (#4904)

This commit is contained in:
Pa1NarK
2024-06-11 21:13:26 +05:30
committed by GitHub
parent 88cf904f5b
commit bbcf0340ca
29 changed files with 908 additions and 1205 deletions

View File

@ -89,9 +89,10 @@ Cypress.Commands.add("apiKeyCreateTest", (apiKeyCreateBody, globalState) => {
Cypress.Commands.add(
"createConnectorCallTest",
(createConnectorBody, globalState) => {
(createConnectorBody, payment_methods_enabled, globalState) => {
const merchantId = globalState.get("merchantId");
createConnectorBody.connector_name = globalState.get("connectorId");
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
// it is best to use then() to handle the response within the same block of code
cy.readFile(globalState.get("connectorAuthFilePath")).then(
@ -145,6 +146,15 @@ Cypress.Commands.add(
JSON.stringify(jsonContent),
`${connectorName}_payout`,
);
// If the connector does not have payout connector creds in creds file, set payoutsExecution to false
if (authDetails === null) {
globalState.set("payoutsExecution", false);
return false;
} else {
globalState.set("payoutsExecution", true);
}
createConnectorBody.connector_account_details = authDetails;
cy.request({
method: "POST",