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

updated to provide report link and indentation #246

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions sanity-report-dev11.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const fs = require("fs");
const dotenv = require("dotenv");
const cheerio = require("cheerio");
const fetch = require("node-fetch");

dotenv.config();

Expand Down Expand Up @@ -28,13 +29,17 @@ const resultMessage =
? `:white_check_mark: Success (${passedTests} / ${totalTests} Passed)`
: `:x: Failure (${passedTests} / ${totalTests} Passed)`;

const pipelineName = process.env.GOCD_PIPELINE_NAME;
const buildNumber = process.env.GOCD_PIPELINE_LABEL;
const goCdServer = process.env.GOCD_SERVER;

const reportUrl = `http://${goCdServer}/go/files/${pipelineName}/${buildNumber}/sanity/1/sanity/test-results/tap-html.html`;

const slackMessage = {
text: `
*Dev11, CDA SDK Full Sanity*
Result: ${resultMessage}
Failed Tests: *${totalFail}*
View Report: <file://${process.cwd()}/mochawesome-report/sanity-report.html>
`,
text: `Dev11, CDA SDK Full Sanity
*Result:* ${resultMessage}
*Failed Tests:* ${totalFail}
<${reportUrl}|View Report>`,
};

const slackWebhookUrl = process.env.SLACK_WEBHOOK_URL;
Expand Down Expand Up @@ -62,4 +67,5 @@ const sendSlackMessage = async (message) => {
console.error("Error:", error);
}
};

sendSlackMessage(slackMessage.text);
Loading