saleor-dashboard/.github/workflows/cypressTestsHelpers/getFailedTests.js
Karolina Rakoczy 36c14bd9a0
3481 if there is more than 20 failed tests add another notification to saleor-qa channel (#3622)
* Add slack notification

* Add correct webhook url

* Create new file with helpers

* add default

* add missing checkout
2023-05-17 10:24:43 +02:00

26 lines
815 B
JavaScript

const core = require("@actions/core");
const { Command } = require("commander");
const { statusAndID } = require("./getTestsResults");
const { failedTestCases } = require("./getTestsResults");
const program = new Command();
program
.name("Get failed test")
.description("Get info if notify on slack if tests failed")
.option("--dashboard_url <dashboard_url>", "Cypress dashboard url")
.action(async options => {
const data = await statusAndID(options.dashboard_url);
let testsStatus = data.status;
if (testsStatus === "FAILED") {
const testCases = await failedTestCases(data.runId);
if (testCases.length >= 20) {
core.setOutput("notifySlack", "true");
}
} else if (testsStatus === "FAILED") {
core.setOutput("notifySlack", "true");
}
})
.parse();