playwright-slack-report 1.1.25 → 1.1.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -1
- package/dist/cli.js +113 -0
- package/dist/src/LayoutGenerator.js +1 -0
- package/dist/src/LayoutGenerator.js.map +1 -0
- package/dist/src/ResultsParser.d.ts +14 -3
- package/dist/src/ResultsParser.js +127 -1
- package/dist/src/ResultsParser.js.map +1 -0
- package/dist/src/SlackClient.d.ts +1 -1
- package/dist/src/SlackClient.js +1 -0
- package/dist/src/SlackClient.js.map +1 -0
- package/dist/src/SlackReporter.js +7 -3
- package/dist/src/SlackReporter.js.map +1 -0
- package/dist/src/SlackWebhookClient.js +1 -0
- package/dist/src/SlackWebhookClient.js.map +1 -0
- package/dist/src/cli/cli_pre_checks.d.ts +9 -0
- package/dist/src/cli/cli_pre_checks.js +82 -0
- package/dist/src/cli/cli_pre_checks.js.map +1 -0
- package/dist/src/cli/cli_schema.d.ts +130 -0
- package/dist/src/cli/cli_schema.js +38 -0
- package/dist/src/cli/cli_schema.js.map +1 -0
- package/dist/src/index.d.ts +192 -2
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -0
- package/package.json +14 -6
- package/dist/src/custom_block/my_block.d.ts +0 -4
- package/dist/src/custom_block/my_block.js +0 -87
- package/dist/src/custom_block/simple.d.ts +0 -3
- package/dist/src/custom_block/simple.js +0 -16
- package/dist/src/custom_block/simple_with_meta.d.ts +0 -3
- package/dist/src/custom_block/simple_with_meta.js +0 -30
package/README.md
CHANGED
|
@@ -11,6 +11,7 @@ Publish your Playwright test results to your favorite Slack channel(s).
|
|
|
11
11
|
## 🚀 Features
|
|
12
12
|
|
|
13
13
|
- 💌 Send results your Playwright test results to one or more Slack channels
|
|
14
|
+
- 🎚️ Leverage JSON results created by Playwright and seamlessly post them on Slack
|
|
14
15
|
- 📊 Conditionally send results to Slack channels based on test results
|
|
15
16
|
- 📄 Include additional meta information into your test summary e.g. Branch, BuildId etc
|
|
16
17
|
- 🧑🎨 Define your own custom Slack message layout!
|
|
@@ -70,7 +71,7 @@ You will most likely need to have Slack administrator rights to perform the step
|
|
|
70
71
|
### Note II:
|
|
71
72
|
Sending failure details in a thread is not supported when using webhooks. You will need to use Option B below.
|
|
72
73
|
|
|
73
|
-
# Option B
|
|
74
|
+
# Option B - send your results via a Slack bot user
|
|
74
75
|
Run your tests by providing your `SLACK_BOT_USER_OAUTH_TOKEN` as an environment variable or specifying `slackOAuthToken` option in the config:
|
|
75
76
|
|
|
76
77
|
`SLACK_BOT_USER_OAUTH_TOKEN=[your Slack bot user OAUTH token] npx playwright test`
|
|
@@ -122,6 +123,53 @@ The final step will be to copy the generated Bot User OAuth Token aka `SLACK_BOT
|
|
|
122
123
|
</details>
|
|
123
124
|
|
|
124
125
|
---
|
|
126
|
+
# Option C - send your JSON results via CLI
|
|
127
|
+
|
|
128
|
+
Playwright now provides a nice way to [merge multiple reports from multiple shards](https://playwright.dev/docs/test-sharding#merging-reports-from-multiple-shards). You can use this feature to generate a single JSON report and then send it to Slack, alleviating the need to have separate messages sent per shard:
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
`npx playwright merge-reports --reporter json ./all-blob-reports`
|
|
132
|
+
|
|
133
|
+
^ It is important that you set the `--reporter` to `json` otherwise the report will not be generated in the correct format.
|
|
134
|
+
|
|
135
|
+
Next, you will need to configure the cli. See example below:
|
|
136
|
+
|
|
137
|
+
*cli_config.json:*
|
|
138
|
+
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"sendResults": "always",
|
|
142
|
+
"slackLogLevel": "error",
|
|
143
|
+
"sendUsingBot": {
|
|
144
|
+
"channels": ["demo"]
|
|
145
|
+
},
|
|
146
|
+
"showInThread": true,
|
|
147
|
+
"meta": [
|
|
148
|
+
{ "key": "build", "value" : "1.0.0"},
|
|
149
|
+
{ "key": "branch", "value" : "master"},
|
|
150
|
+
{ "key": "commit", "value" : "1234567890"},
|
|
151
|
+
{ "key": "results", "value" : "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png"}
|
|
152
|
+
],
|
|
153
|
+
"maxNumberOfFailures": 4,
|
|
154
|
+
"disableUnfurl": true
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
The config file also supports the follow extra options for using a proxy and sending results via a webhook:
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
```json
|
|
161
|
+
...
|
|
162
|
+
"proxy": "http://proxy.mycompany.com:8080",
|
|
163
|
+
"sendUsingWebhook": {
|
|
164
|
+
"webhookUrl": "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"
|
|
165
|
+
},
|
|
166
|
+
...
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Once you have generated the JSON report and defined your config file, you can send it to Slack using the following command:
|
|
170
|
+
|
|
171
|
+
`SLACK_BOT_USER_OAUTH_TOKEN=[your Slack bot user OAUTH token] npx playwright-slack-report -c cli_config.json -j ./merged_tests_results.json`
|
|
172
|
+
|
|
125
173
|
|
|
126
174
|
# ⚙️ Configuration
|
|
127
175
|
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
/* eslint-disable no-console */
|
|
8
|
+
const commander_1 = require("commander");
|
|
9
|
+
const web_api_1 = require("@slack/web-api");
|
|
10
|
+
const https_proxy_agent_1 = require("https-proxy-agent");
|
|
11
|
+
const webhook_1 = require("@slack/webhook");
|
|
12
|
+
const ResultsParser_1 = __importDefault(require("./src/ResultsParser"));
|
|
13
|
+
const SlackClient_1 = __importDefault(require("./src/SlackClient"));
|
|
14
|
+
const cli_pre_checks_1 = __importDefault(require("./src/cli/cli_pre_checks"));
|
|
15
|
+
const SlackWebhookClient_1 = __importDefault(require("./src/SlackWebhookClient"));
|
|
16
|
+
const program = new commander_1.Command();
|
|
17
|
+
program
|
|
18
|
+
.name('playwright-slack-report - cli')
|
|
19
|
+
.version('1.0.0')
|
|
20
|
+
.description('📦 Send Playwright json results to directly Slack ')
|
|
21
|
+
.option('-c, --config <path>', 'Configuration file for the CLI app e.g ./config.json')
|
|
22
|
+
.option('-j, --json-results <path>', 'Generated Playwright json results file e.g. ./results.json')
|
|
23
|
+
.action(async (options) => {
|
|
24
|
+
const preCheckResult = await (0, cli_pre_checks_1.default)(options.jsonResults, options.config);
|
|
25
|
+
const config = preCheckResult.config;
|
|
26
|
+
if (preCheckResult.status === 'error') {
|
|
27
|
+
console.error(`❌ ${preCheckResult.message}`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
const agent = config.proxy ? new https_proxy_agent_1.HttpsProxyAgent(config.proxy) : undefined;
|
|
31
|
+
const resultsParser = new ResultsParser_1.default();
|
|
32
|
+
const resultSummary = await resultsParser.parseFromJsonFile(preCheckResult.jsonPath);
|
|
33
|
+
if (config.sendUsingBot) {
|
|
34
|
+
const slackClient = new SlackClient_1.default(new web_api_1.WebClient(process.env.SLACK_BOT_USER_OAUTH_TOKEN, {
|
|
35
|
+
logLevel: config.slackLogLevel,
|
|
36
|
+
agent,
|
|
37
|
+
}));
|
|
38
|
+
const success = await sendResultsUsingBot({
|
|
39
|
+
resultSummary,
|
|
40
|
+
slackClient,
|
|
41
|
+
config,
|
|
42
|
+
});
|
|
43
|
+
if (!success) {
|
|
44
|
+
console.error('❌ Failed to send results to Slack');
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
console.log('✅ Results sent to Slack');
|
|
49
|
+
process.exit(0);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (config.sendUsingWebhook) {
|
|
53
|
+
const webhook = new webhook_1.IncomingWebhook(config.sendUsingWebhook.webhookUrl, {
|
|
54
|
+
agent,
|
|
55
|
+
});
|
|
56
|
+
const slackWebhookClient = new SlackWebhookClient_1.default(webhook);
|
|
57
|
+
const webhookResult = await slackWebhookClient.sendMessage({
|
|
58
|
+
customLayout: undefined,
|
|
59
|
+
customLayoutAsync: undefined,
|
|
60
|
+
maxNumberOfFailures: config.maxNumberOfFailures,
|
|
61
|
+
disableUnfurl: config.disableUnfurl,
|
|
62
|
+
summaryResults: resultSummary,
|
|
63
|
+
});
|
|
64
|
+
// eslint-disable-next-line no-console
|
|
65
|
+
console.log(JSON.stringify(webhookResult, null, 2));
|
|
66
|
+
console.log('✅ Results sent to Slack');
|
|
67
|
+
process.exit(0);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
program.parse();
|
|
71
|
+
async function sendResultsUsingBot({ resultSummary, slackClient, config, }) {
|
|
72
|
+
if (config.slackLogLevel === web_api_1.LogLevel.DEBUG) {
|
|
73
|
+
console.log({ config });
|
|
74
|
+
}
|
|
75
|
+
if (resultSummary.failures.length === 0
|
|
76
|
+
&& config.sendResults === 'on-failure') {
|
|
77
|
+
console.log('⏩ Slack CLI reporter - no failures found');
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
let summaryResults = resultSummary;
|
|
81
|
+
summaryResults = { ...resultSummary, meta: config.meta };
|
|
82
|
+
if (config.sendUsingBot) {
|
|
83
|
+
const result = await slackClient.sendMessage({
|
|
84
|
+
options: {
|
|
85
|
+
channelIds: config.sendUsingBot.channels,
|
|
86
|
+
customLayout: undefined,
|
|
87
|
+
customLayoutAsync: undefined,
|
|
88
|
+
maxNumberOfFailures: config.maxNumberOfFailures,
|
|
89
|
+
disableUnfurl: config.disableUnfurl,
|
|
90
|
+
summaryResults,
|
|
91
|
+
showInThread: config.showInThread,
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
if (config.showInThread && resultSummary.failures.length > 0) {
|
|
95
|
+
for (let i = 0; i < result.length; i += 1) {
|
|
96
|
+
// eslint-disable-next-line no-await-in-loop
|
|
97
|
+
await slackClient.attachDetailsToThread({
|
|
98
|
+
channelIds: [result[i].channel],
|
|
99
|
+
ts: result[i].ts,
|
|
100
|
+
summaryResults: resultSummary,
|
|
101
|
+
maxNumberOfFailures: config.maxNumberOfFailures,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (result.filter((r) => !r.outcome.includes('✅ Message sent to')).length
|
|
106
|
+
!== 0) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
throw new Error('sendUsingBot config is not set');
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -74,3 +74,4 @@ const generateFailures = async (summaryResults, maxNumberOfFailures) => {
|
|
|
74
74
|
exports.generateFailures = generateFailures;
|
|
75
75
|
const generateFallbackText = (summaryResults) => `✅ ${summaryResults.passed} ❌ ${summaryResults.failed} ${summaryResults.flaky !== undefined ? ` 🟡 ${summaryResults.flaky} ` : ' '}⏩ ${summaryResults.skipped}`;
|
|
76
76
|
exports.generateFallbackText = generateFallbackText;
|
|
77
|
+
//# sourceMappingURL=LayoutGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LayoutGenerator.js","sourceRoot":"","sources":["../../src/LayoutGenerator.ts"],"names":[],"mappings":";;;AAGA,MAAM,cAAc,GAAG,KAAK,EAC1B,cAA8B,EAC9B,mBAA2B,EACS,EAAE;IACtC,MAAM,IAAI,GAAG,EAAE,CAAC;IAChB,MAAM,MAAM,GAAG;QACb,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,yBAAyB;SAChC;KACF,CAAC;IACF,MAAM,OAAO,GAAG;QACd,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,MAAM,c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C,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC3D,MAAM,gBAAgB,GAAG,aAAa;aACnC,SAAS,CAAC,CAAC,EAAE,wBAAwB,CAAC;aACtC,KAAK,CAAC,IAAI,CAAC;aACX,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;aACnB,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,KAAK,CAAC,IAAI,CAAC;YACT,IAAI,EAAE,SAAS;YACf,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,IAAI,IAAI;YACV,gBAAgB,EAAE;aACvB;SACF,CAAC,CAAC;KACJ;IAED,IAAI,cAAc,CAAC,QAAQ,CAAC,MAAM,GAAG,mBAAmB,EAAE;QACxD,KAAK,CAAC,IAAI,CAAC;YACT,IAAI,EAAE,SAAS;YACf,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,gDAAgD,KAAK,CAAC,MAAM,WAAW,cAAc,CAAC,QAAQ,CAAC,MAAM,kBAAkB;aAC9H;SACF,CAAC,CAAC;KACJ;IACD,OAAO;QACL;YACE,IAAI,EAAE,SAAS;SAChB;QACD,GAAG,KAAK;KACT,CAAC;AACJ,CAAC,CAAC;AAMuB,4CAAgB;AAJzC,MAAM,oBAAoB,GAAG,CAAC,cAA8B,EAAU,EAAE,CAAC,KAAK,cAAc,CAAC,MAAM,MAAM,cAAc,CAAC,MAAM,IAC5H,cAAc,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,cAAc,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,GACxE,KAAK,cAAc,CAAC,OAAO,EAAE,CAAC;AAEa,oDAAoB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { TestCase } from '@playwright/test/reporter';
|
|
3
|
-
import { failure, SummaryResults } from '.';
|
|
4
|
-
export
|
|
3
|
+
import { failure, Spec, SummaryResults } from '.';
|
|
4
|
+
export type testResult = {
|
|
5
5
|
suiteName: string;
|
|
6
6
|
name: string;
|
|
7
7
|
browser?: string;
|
|
@@ -19,7 +19,7 @@ export declare type testResult = {
|
|
|
19
19
|
path: string;
|
|
20
20
|
}[];
|
|
21
21
|
};
|
|
22
|
-
export
|
|
22
|
+
export type testSuite = {
|
|
23
23
|
testSuite: {
|
|
24
24
|
title: string;
|
|
25
25
|
tests: testResult[];
|
|
@@ -29,12 +29,23 @@ export declare type testSuite = {
|
|
|
29
29
|
export default class ResultsParser {
|
|
30
30
|
private result;
|
|
31
31
|
constructor();
|
|
32
|
+
parseFromJsonFile(filePath: string): Promise<SummaryResults>;
|
|
33
|
+
parseTestSuite(suites: any, retries: number, suiteIndex?: number): Promise<void>;
|
|
34
|
+
parseTests(suiteName: any, specs: any, retries: number): Promise<testResult[]>;
|
|
35
|
+
getFailure(snippet: string, stack: string): string;
|
|
32
36
|
getParsedResults(allTests: Array<TestCase>): Promise<SummaryResults>;
|
|
33
37
|
getFailures(): Promise<Array<failure>>;
|
|
34
38
|
static getTestName(failedTest: any): any;
|
|
35
39
|
updateResults(data: {
|
|
36
40
|
testSuite: any;
|
|
37
41
|
}): void;
|
|
42
|
+
addTestResultFromJson({ suiteName, spec, testCase, projectBrowserMapping, retries, }: {
|
|
43
|
+
suiteName: any;
|
|
44
|
+
spec: Spec;
|
|
45
|
+
testCase: any;
|
|
46
|
+
projectBrowserMapping: any;
|
|
47
|
+
retries: number;
|
|
48
|
+
}): void;
|
|
38
49
|
addTestResult(suiteName: any, testCase: any, projectBrowserMapping: any): void;
|
|
39
50
|
safelyDetermineFailure(result: {
|
|
40
51
|
errors: any[];
|
|
@@ -5,18 +5,118 @@
|
|
|
5
5
|
/* eslint-disable no-control-regex */
|
|
6
6
|
/* eslint-disable class-methods-use-this */
|
|
7
7
|
/* eslint-disable no-param-reassign */
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
|
+
if (mod && mod.__esModule) return mod;
|
|
26
|
+
var result = {};
|
|
27
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
28
|
+
__setModuleDefault(result, mod);
|
|
29
|
+
return result;
|
|
30
|
+
};
|
|
8
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
const fs = __importStar(require("fs"));
|
|
9
33
|
class ResultsParser {
|
|
10
34
|
result;
|
|
11
35
|
constructor() {
|
|
12
36
|
this.result = [];
|
|
13
37
|
}
|
|
38
|
+
async parseFromJsonFile(filePath) {
|
|
39
|
+
const data = fs.readFileSync(filePath, 'utf-8');
|
|
40
|
+
const parsedData = JSON.parse(data);
|
|
41
|
+
const { retries } = parsedData.config.projects[0];
|
|
42
|
+
await this.parseTestSuite(parsedData.suites, retries);
|
|
43
|
+
const failures = await this.getFailures();
|
|
44
|
+
const summary = {
|
|
45
|
+
passed: parsedData.stats.expected,
|
|
46
|
+
failed: parsedData.stats.unexpected,
|
|
47
|
+
flaky: parsedData.stats.flaky,
|
|
48
|
+
skipped: parsedData.stats.skipped,
|
|
49
|
+
failures,
|
|
50
|
+
tests: [],
|
|
51
|
+
};
|
|
52
|
+
for (const suite of this.result) {
|
|
53
|
+
summary.tests = summary.tests.concat(suite.testSuite.tests);
|
|
54
|
+
}
|
|
55
|
+
// console.log('🚀~ summary:', JSON.stringify(summary, null, 2));
|
|
56
|
+
return summary;
|
|
57
|
+
}
|
|
58
|
+
async parseTestSuite(suites, retries, suiteIndex = 0) {
|
|
59
|
+
let testResults = [];
|
|
60
|
+
if (suites[0].suites?.length > 0) {
|
|
61
|
+
testResults = await this.parseTests(suites[0].title, suites[0].specs, retries);
|
|
62
|
+
this.updateResults({
|
|
63
|
+
testSuite: {
|
|
64
|
+
title: suites[0].title,
|
|
65
|
+
tests: testResults,
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
await this.parseTestSuite(suites[suiteIndex].suites, retries, (suiteIndex += 1));
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
testResults = await this.parseTests(suites[0].title, suites[0].specs, retries);
|
|
72
|
+
this.updateResults({
|
|
73
|
+
testSuite: {
|
|
74
|
+
title: suites[0].title,
|
|
75
|
+
tests: testResults,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
// eslint-disable-next-line no-useless-return
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async parseTests(suiteName, specs, retries) {
|
|
83
|
+
const testResults = [];
|
|
84
|
+
for (const spec of specs) {
|
|
85
|
+
for (const test of spec.tests) {
|
|
86
|
+
for (const result of test.results) {
|
|
87
|
+
testResults.push({
|
|
88
|
+
suiteName,
|
|
89
|
+
name: spec.title,
|
|
90
|
+
status: result.status === 'unexpected' ? 'failed' : result.status,
|
|
91
|
+
browser: test.projectName,
|
|
92
|
+
projectName: test.projectName,
|
|
93
|
+
retry: result.retry,
|
|
94
|
+
retries,
|
|
95
|
+
startedAt: result.startTime,
|
|
96
|
+
endedAt: new Date(new Date(result.startTime).getTime() + result.duration).toISOString(),
|
|
97
|
+
reason: result.error
|
|
98
|
+
? this.getFailure(result.error.snippet, result.error.stack)
|
|
99
|
+
: '',
|
|
100
|
+
attachments: result.attachments,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return testResults;
|
|
106
|
+
}
|
|
107
|
+
getFailure(snippet, stack) {
|
|
108
|
+
const fullError = `${snippet}\r\n${stack || ''}`;
|
|
109
|
+
return this.cleanseReason(fullError);
|
|
110
|
+
}
|
|
14
111
|
async getParsedResults(allTests) {
|
|
15
112
|
const failures = await this.getFailures();
|
|
16
113
|
// use Playwright recommended way of extracting test stats:
|
|
17
114
|
// https://github.com/microsoft/playwright/issues/27498#issuecomment-1766766335
|
|
18
115
|
const stats = {
|
|
19
|
-
expected: 0,
|
|
116
|
+
expected: 0,
|
|
117
|
+
skipped: 0,
|
|
118
|
+
unexpected: 0,
|
|
119
|
+
flaky: 0,
|
|
20
120
|
};
|
|
21
121
|
// eslint-disable-next-line no-plusplus
|
|
22
122
|
for (const test of allTests)
|
|
@@ -66,6 +166,31 @@ class ResultsParser {
|
|
|
66
166
|
this.result.push(data);
|
|
67
167
|
}
|
|
68
168
|
}
|
|
169
|
+
addTestResultFromJson({ suiteName, spec, testCase, projectBrowserMapping, retries, }) {
|
|
170
|
+
const testResults = [];
|
|
171
|
+
const projectSettings = this.determineBrowser(projectBrowserMapping[0].projectName, projectBrowserMapping);
|
|
172
|
+
for (const result of testCase.results) {
|
|
173
|
+
testResults.push({
|
|
174
|
+
suiteName,
|
|
175
|
+
name: spec.title,
|
|
176
|
+
status: result.status,
|
|
177
|
+
browser: projectSettings.browser,
|
|
178
|
+
projectName: projectSettings.projectName,
|
|
179
|
+
retry: result.retry,
|
|
180
|
+
retries,
|
|
181
|
+
startedAt: new Date(result.startTime).toISOString(),
|
|
182
|
+
endedAt: new Date(new Date(result.startTime).getTime() + result.duration).toISOString(),
|
|
183
|
+
reason: this.safelyDetermineFailure(result),
|
|
184
|
+
attachments: result.attachments,
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
this.updateResults({
|
|
188
|
+
testSuite: {
|
|
189
|
+
title: suiteName,
|
|
190
|
+
tests: testResults,
|
|
191
|
+
},
|
|
192
|
+
});
|
|
193
|
+
}
|
|
69
194
|
addTestResult(suiteName, testCase, projectBrowserMapping) {
|
|
70
195
|
const testResults = [];
|
|
71
196
|
const projectSettings = this.determineBrowser(testCase._projectId, projectBrowserMapping);
|
|
@@ -125,3 +250,4 @@ class ResultsParser {
|
|
|
125
250
|
}
|
|
126
251
|
}
|
|
127
252
|
exports.default = ResultsParser;
|
|
253
|
+
//# sourceMappingURL=ResultsParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResultsParser.js","sourceRoot":"","sources":["../../src/ResultsParser.ts"],"names":[],"mappings":";AAAA,8BAA8B;AAC9B,yCAAyC;AACzC,sCAAsC;AACtC,qCAAqC;AACrC,2CAA2C;AAC3C,sCAAsC;;;;;;;;;;;;;;;;;;;;;;;;;AAEtC,uCAAyB;AAkCzB,MAAqB,aAAa;IACxB,MAAM,CAAc;IAE5B;QACE,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,QAAgB;QACtC,MAAM,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAChD,MAAM,UAAU,GAAe,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEhD,MAAM,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAClD,MAAM,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAEtD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAC1C,MAAM,OAAO,GAAmB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CACN,iEAAiE,EACjE,EAAE,CACH;aACA,OAAO,CACN,mEAAmE,EACnE,EAAE,CACH;aACA,OAAO,CACN,iEAAiE,EACjE,EAAE,CACH,CAAC;QACJ,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,gBAAgB,CACd,WAAmB,EACnB,eAA2D;QAK3D,MAAM,cAAc,GAAG,eAAe,CAAC,IAAI,CACzC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,KAAK,WAAW,CACjD,CAAC;QACF,IAAI,cAAc,EAAE;YAClB,OAAO;gBACL,WAAW,EAAE,cAAc,CAAC,WAAW;gBACvC,OAAO,EAAE,cAAc,CAAC,OAAO;aAChC,CAAC;SACH;QACD,OAAO;YACL,WAAW,EAAE,EAAE;YACf,OAAO,EAAE,EAAE;SACZ,CAAC;IACJ,CAAC;CACF;AA1SD,gCA0SC"}
|
package/dist/src/SlackClient.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlackClient.js","sourceRoot":"","sources":["../../src/SlackClient.ts"],"names":[],"mappings":";;AAYA,uDAI2B;AAI3B,MAAqB,WAAW;IACtB,cAAc,CAAY;IAElC,YAAY,WAAsB;QAChC,IAAI,CAAC,cAAc,GAAG,WAAW,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,EAChB,OAAO,GAcR;QACC,IAAI,MAA8B,CAAC;QACnC,IAAI,OAAO,CAAC,YAAY,EAAE;YACxB,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;SACvD;aAAM,IAAI,OAAO,CAAC,iBAAiB,EAAE;YACpC,MAAM,GAAG,MAAM,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;SAClE;aAAM,IAAI,OAAO,CAAC,YAAY,EAAE;YAC/B,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,C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,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,aAAa,CACxB,cAAyB,EACzB,OAAe,EACf,YAAoB,EACpB,MAAiC,EACjC,MAAe,EACf,eAAwB;QAExB,MAAM,YAAY,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC;YACzD,OAAO;YACP,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,MAAM;YACnB,MAAM;YACN,SAAS,EAAE,eAAe;SAC3B,CAAC,CAAC;QACH,OAAO,YAAY,CAAC;IACtB,CAAC;CACF;AA1JD,8BA0JC"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
const web_api_1 = require("@slack/web-api");
|
|
4
7
|
const https_proxy_agent_1 = require("https-proxy-agent");
|
|
5
8
|
const webhook_1 = require("@slack/webhook");
|
|
6
|
-
const ResultsParser_1 = require("./ResultsParser");
|
|
7
|
-
const SlackClient_1 = require("./SlackClient");
|
|
8
|
-
const SlackWebhookClient_1 = require("./SlackWebhookClient");
|
|
9
|
+
const ResultsParser_1 = __importDefault(require("./ResultsParser"));
|
|
10
|
+
const SlackClient_1 = __importDefault(require("./SlackClient"));
|
|
11
|
+
const SlackWebhookClient_1 = __importDefault(require("./SlackWebhookClient"));
|
|
9
12
|
class SlackReporter {
|
|
10
13
|
customLayout;
|
|
11
14
|
customLayoutAsync;
|
|
@@ -183,3 +186,4 @@ class SlackReporter {
|
|
|
183
186
|
}
|
|
184
187
|
}
|
|
185
188
|
exports.default = SlackReporter;
|
|
189
|
+
//# sourceMappingURL=SlackReporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlackReporter.js","sourceRoot":"","sources":["../../src/SlackReporter.ts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ChE,OAAO;gBACL,WAAW,EAAE,KAAK;gBAClB,OAAO,EAAE,mCAAmC;aAC7C,CAAC;SACH;QAED,IACE,IAAI,CAAC,iBAAiB;eACnB,OAAO,IAAI,CAAC,iBAAiB,KAAK,UAAU,EAC/C;YACA,OAAO;gBACL,WAAW,EAAE,KAAK;gBAClB,OAAO,EAAE,uCAAuC;aACjD,CAAC;SACH;QAED,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YAC1C,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,wBAAwB,EAAE,CAAC;SAClE;QACD,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IAC/B,CAAC;IAED,GAAG,CAAC,OAA2B;QAC7B,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACrB,IAAI,OAAO,EAAE;YACX,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACzB;IACH,CAAC;IAED,kDAAkD;IAClD,aAAa;QACX,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AACD,kBAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlackWebhookClient.js","sourceRoot":"","sources":["../../src/SlackWebhookClient.ts"],"names":[],"mappings":";;AAGA,uDAAmD;AAEnD,MAAqB,kBAAkB;IAC7B,OAAO,CAAkB;IAEjC,YAAY,OAAwB;QAClC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,EAChB,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,aAAa,GAOd;QACC,IAAI,MAA8B,CAAC;QACnC,IAAI,YAAY,EAAE;YAChB,MAAM,GAAG,YAAY,CAAC,cAAc,CAAC,CAAC;SACvC;aAAM,IAAI,iBAAiB,EAAE;YAC5B,MAAM,GAAG,MAAM,iBAAiB,CAAC,cAAc,CAAC,CAAC;SAClD;aAAM;YACL,MAAM,GAAG,MAAM,IAAA,gCAAc,EAAC,cAAc,EAAE,mBAAmB,CAAC,CAAC;SACpE;QACD,IAAI,MAA6B,CAAC;QAClC,IAAI;YACF,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;gBAC/B,MAAM;gBACN,YAAY,EAAE,CAAC,aAAa;aAC7B,CAAC,CAAC;SACJ;QAAC,OAAO,KAAK,EAAE;YACd,OAAO;gBACL,OAAO,EAAE,UAAU,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE;aACpD,CAAC;SACH;QACD,IAAI,MAAM,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI,EAAE;YAClC,OAAO;gBACL,OAAO,EAAE,MAAM,CAAC,IAAI;aACrB,CAAC;SACH;QACD,OAAO;YACL,OAAO,EACL,qEAAqE;SACxE,CAAC;IACJ,CAAC;CACF;AAjDD,qCAiDC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ICliConfig } from './cli_schema';
|
|
2
|
+
export declare const doPreChecks: (jsonResultsPath: string, configFile: string) => Promise<{
|
|
3
|
+
status: 'error' | 'ok';
|
|
4
|
+
message?: string;
|
|
5
|
+
jsonPath?: string;
|
|
6
|
+
configPath?: string;
|
|
7
|
+
config?: ICliConfig;
|
|
8
|
+
}>;
|
|
9
|
+
export default doPreChecks;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.doPreChecks = void 0;
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const cli_schema_1 = require("./cli_schema");
|
|
10
|
+
const doPreChecks = async (jsonResultsPath, configFile) => {
|
|
11
|
+
if (!fileExists(jsonResultsPath)) {
|
|
12
|
+
return {
|
|
13
|
+
status: 'error',
|
|
14
|
+
message: `JSON results file does not exist: ${jsonResultsPath}:
|
|
15
|
+
Use --json-results <path> e.g. --json-results="./results.json"`,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
if (!fileExists(configFile)) {
|
|
19
|
+
return {
|
|
20
|
+
status: 'error',
|
|
21
|
+
message: `Config file does not exist: ${configFile}`,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const parseResult = { success: false, error: undefined, data: undefined };
|
|
25
|
+
let config;
|
|
26
|
+
try {
|
|
27
|
+
config = getConfig(configFile);
|
|
28
|
+
parseResult.data = cli_schema_1.ZodCliSchema.parse(config);
|
|
29
|
+
parseResult.success = true;
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
parseResult.success = false;
|
|
33
|
+
parseResult.error = error;
|
|
34
|
+
}
|
|
35
|
+
if (!parseResult.success) {
|
|
36
|
+
return {
|
|
37
|
+
status: 'error',
|
|
38
|
+
message: `Config file is not valid: ${parseResult.error.message ?? JSON.stringify(parseResult.error, null, 2)}`,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
if (config.sendUsingWebhook && config.sendUsingBot) {
|
|
42
|
+
return {
|
|
43
|
+
status: 'error',
|
|
44
|
+
message: 'It is not possible to use both sendUsingWebhook and sendUsingBot, choose a single method',
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
if (!config.sendUsingWebhook && !config.sendUsingBot) {
|
|
48
|
+
return {
|
|
49
|
+
status: 'error',
|
|
50
|
+
message: 'You must specify either sendUsingWebhook or sendUsingBot in the config file',
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
if (config.sendUsingBot && !process.env.SLACK_BOT_USER_OAUTH_TOKEN) {
|
|
54
|
+
return {
|
|
55
|
+
status: 'error',
|
|
56
|
+
message: 'Missing the SLACK_BOT_USER_OAUTH_TOKEN env variable',
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
status: 'ok',
|
|
61
|
+
jsonPath: path_1.default.resolve(jsonResultsPath),
|
|
62
|
+
configPath: path_1.default.resolve(configFile),
|
|
63
|
+
config: parseResult.data,
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
exports.doPreChecks = doPreChecks;
|
|
67
|
+
function fileExists(filePath) {
|
|
68
|
+
let absolutePath;
|
|
69
|
+
try {
|
|
70
|
+
absolutePath = path_1.default.resolve(filePath);
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
return (0, fs_1.existsSync)(absolutePath);
|
|
76
|
+
}
|
|
77
|
+
function getConfig(configPath) {
|
|
78
|
+
const config = (0, fs_1.readFileSync)(path_1.default.resolve(path_1.default.resolve(configPath)), 'utf-8');
|
|
79
|
+
return JSON.parse(config);
|
|
80
|
+
}
|
|
81
|
+
exports.default = exports.doPreChecks;
|
|
82
|
+
//# sourceMappingURL=cli_pre_checks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli_pre_checks.js","sourceRoot":"","sources":["../../../src/cli/cli_pre_checks.ts"],"names":[],"mappings":";;;;;;AAAA,2BAAwD;AACxD,gDAAwB;AACxB,6CAAwD;AAEjD,MAAM,WAAW,GAAG,KAAK,EAC9B,eAAuB,EACvB,UAAkB,EAOjB,EAAE;IACH,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE;QAChC,OAAO;YACL,MAAM,EAAE,OAAO;YACf,OAAO,EAAE,qCAAqC,eAAe;qEACE;SAChE,CAAC;KACH;IAED,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;QAC3B,OAAO;YACL,MAAM,EAAE,OAAO;YACf,OAAO,EAAE,+BAA+B,UAAU,EAAE;SACrD,CAAC;KACH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,CAAC,UAAU,CAAC;QACpC,MAAM,EAAE,WAAW,CAAC,IAAI;KACzB,CAAC;AACJ,CAAC,CAAC;AA1EW,QAAA,WAAW,eA0EtB;AAEF,SAAS,UAAU,CAAC,QAAgB;IAClC,IAAI,YAAsB,CAAC;IAC3B,IAAI;QACF,YAAY,GAAG,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;KACvC;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,KAAK,CAAC;KACd;IACD,OAAO,IAAA,eAAU,EAAC,YAAY,CAAC,CAAC;AAClC,CAAC;AAED,SAAS,SAAS,CAAC,UAAkB;IACnC,MAAM,MAAM,GAAG,IAAA,iBAAY,EAAC,cAAI,CAAC,OAAO,CAAC,cAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAC7E,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC;AACD,kBAAe,mBAAW,CAAC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { LogLevel } from '@slack/web-api';
|
|
3
|
+
export declare const ZodCliSchema: z.ZodObject<{
|
|
4
|
+
sendResults: z.ZodEnum<["always", "on-failure"]>;
|
|
5
|
+
sendUsingBot: z.ZodOptional<z.ZodObject<{
|
|
6
|
+
channels: z.ZodArray<z.ZodString, "atleastone">;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
channels?: [string, ...string[]];
|
|
9
|
+
}, {
|
|
10
|
+
channels?: [string, ...string[]];
|
|
11
|
+
}>>;
|
|
12
|
+
sendUsingWebhook: z.ZodOptional<z.ZodObject<{
|
|
13
|
+
webhookUrl: z.ZodString;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
webhookUrl?: string;
|
|
16
|
+
}, {
|
|
17
|
+
webhookUrl?: string;
|
|
18
|
+
}>>;
|
|
19
|
+
customLayout: z.ZodOptional<z.ZodObject<{
|
|
20
|
+
functionName: z.ZodString;
|
|
21
|
+
source: z.ZodString;
|
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
functionName?: string;
|
|
24
|
+
source?: string;
|
|
25
|
+
}, {
|
|
26
|
+
functionName?: string;
|
|
27
|
+
source?: string;
|
|
28
|
+
}>>;
|
|
29
|
+
customLayoutAsync: z.ZodOptional<z.ZodObject<{
|
|
30
|
+
functionName: z.ZodString;
|
|
31
|
+
source: z.ZodString;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
functionName?: string;
|
|
34
|
+
source?: string;
|
|
35
|
+
}, {
|
|
36
|
+
functionName?: string;
|
|
37
|
+
source?: string;
|
|
38
|
+
}>>;
|
|
39
|
+
slackLogLevel: z.ZodNativeEnum<typeof LogLevel>;
|
|
40
|
+
maxNumberOfFailures: z.ZodDefault<z.ZodNumber>;
|
|
41
|
+
disableUnfurl: z.ZodDefault<z.ZodBoolean>;
|
|
42
|
+
showInThread: z.ZodDefault<z.ZodBoolean>;
|
|
43
|
+
proxy: z.ZodOptional<z.ZodString>;
|
|
44
|
+
meta: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
45
|
+
key: z.ZodString;
|
|
46
|
+
value: z.ZodString;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
key?: string;
|
|
49
|
+
value?: string;
|
|
50
|
+
}, {
|
|
51
|
+
key?: string;
|
|
52
|
+
value?: string;
|
|
53
|
+
}>, "many">>;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
sendResults?: "always" | "on-failure";
|
|
56
|
+
sendUsingBot?: {
|
|
57
|
+
channels?: [string, ...string[]];
|
|
58
|
+
};
|
|
59
|
+
sendUsingWebhook?: {
|
|
60
|
+
webhookUrl?: string;
|
|
61
|
+
};
|
|
62
|
+
customLayout?: {
|
|
63
|
+
functionName?: string;
|
|
64
|
+
source?: string;
|
|
65
|
+
};
|
|
66
|
+
customLayoutAsync?: {
|
|
67
|
+
functionName?: string;
|
|
68
|
+
source?: string;
|
|
69
|
+
};
|
|
70
|
+
slackLogLevel?: LogLevel;
|
|
71
|
+
maxNumberOfFailures?: number;
|
|
72
|
+
disableUnfurl?: boolean;
|
|
73
|
+
showInThread?: boolean;
|
|
74
|
+
proxy?: string;
|
|
75
|
+
meta?: {
|
|
76
|
+
key?: string;
|
|
77
|
+
value?: string;
|
|
78
|
+
}[];
|
|
79
|
+
}, {
|
|
80
|
+
sendResults?: "always" | "on-failure";
|
|
81
|
+
sendUsingBot?: {
|
|
82
|
+
channels?: [string, ...string[]];
|
|
83
|
+
};
|
|
84
|
+
sendUsingWebhook?: {
|
|
85
|
+
webhookUrl?: string;
|
|
86
|
+
};
|
|
87
|
+
customLayout?: {
|
|
88
|
+
functionName?: string;
|
|
89
|
+
source?: string;
|
|
90
|
+
};
|
|
91
|
+
customLayoutAsync?: {
|
|
92
|
+
functionName?: string;
|
|
93
|
+
source?: string;
|
|
94
|
+
};
|
|
95
|
+
slackLogLevel?: LogLevel;
|
|
96
|
+
maxNumberOfFailures?: number;
|
|
97
|
+
disableUnfurl?: boolean;
|
|
98
|
+
showInThread?: boolean;
|
|
99
|
+
proxy?: string;
|
|
100
|
+
meta?: {
|
|
101
|
+
key?: string;
|
|
102
|
+
value?: string;
|
|
103
|
+
}[];
|
|
104
|
+
}>;
|
|
105
|
+
export interface ICliConfig {
|
|
106
|
+
sendResults: 'always' | 'on-failure';
|
|
107
|
+
sendUsingBot?: {
|
|
108
|
+
channels: string[];
|
|
109
|
+
};
|
|
110
|
+
sendUsingWebhook?: {
|
|
111
|
+
webhookUrl: string;
|
|
112
|
+
};
|
|
113
|
+
slackLogLevel: LogLevel;
|
|
114
|
+
customLayout?: {
|
|
115
|
+
functionName: string;
|
|
116
|
+
source: string;
|
|
117
|
+
};
|
|
118
|
+
customLayoutAsync?: {
|
|
119
|
+
functionName: string;
|
|
120
|
+
source: string;
|
|
121
|
+
};
|
|
122
|
+
maxNumberOfFailures: number;
|
|
123
|
+
disableUnfurl: boolean;
|
|
124
|
+
showInThread: boolean;
|
|
125
|
+
proxy?: string;
|
|
126
|
+
meta?: Array<{
|
|
127
|
+
key: string;
|
|
128
|
+
value: string;
|
|
129
|
+
}>;
|
|
130
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZodCliSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const web_api_1 = require("@slack/web-api");
|
|
6
|
+
const LogLevelEnum = zod_1.z.nativeEnum(web_api_1.LogLevel);
|
|
7
|
+
exports.ZodCliSchema = zod_1.z.object({
|
|
8
|
+
sendResults: zod_1.z.enum(['always', 'on-failure']),
|
|
9
|
+
sendUsingBot: zod_1.z
|
|
10
|
+
.object({
|
|
11
|
+
channels: zod_1.z.array(zod_1.z.string()).nonempty(),
|
|
12
|
+
})
|
|
13
|
+
.optional(),
|
|
14
|
+
sendUsingWebhook: zod_1.z
|
|
15
|
+
.object({
|
|
16
|
+
webhookUrl: zod_1.z.string().url(),
|
|
17
|
+
})
|
|
18
|
+
.optional(),
|
|
19
|
+
customLayout: zod_1.z
|
|
20
|
+
.object({
|
|
21
|
+
functionName: zod_1.z.string(),
|
|
22
|
+
source: zod_1.z.string(),
|
|
23
|
+
})
|
|
24
|
+
.optional(),
|
|
25
|
+
customLayoutAsync: zod_1.z
|
|
26
|
+
.object({
|
|
27
|
+
functionName: zod_1.z.string(),
|
|
28
|
+
source: zod_1.z.string(),
|
|
29
|
+
})
|
|
30
|
+
.optional(),
|
|
31
|
+
slackLogLevel: LogLevelEnum,
|
|
32
|
+
maxNumberOfFailures: zod_1.z.number().default(5),
|
|
33
|
+
disableUnfurl: zod_1.z.boolean().default(false),
|
|
34
|
+
showInThread: zod_1.z.boolean().default(false),
|
|
35
|
+
proxy: zod_1.z.string().url().optional(),
|
|
36
|
+
meta: zod_1.z.array(zod_1.z.object({ key: zod_1.z.string(), value: zod_1.z.string() })).optional(),
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=cli_schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli_schema.js","sourceRoot":"","sources":["../../../src/cli/cli_schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,4CAA0C;AAE1C,MAAM,YAAY,GAAG,OAAC,CAAC,UAAU,CAAC,kBAAQ,CAAC,CAAC;AAC/B,QAAA,YAAY,GAAG,OAAC,CAAC,MAAM,CAAC;IACnC,WAAW,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IAC7C,YAAY,EAAE,OAAC;SACZ,MAAM,CAAC;QACN,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;KACzC,CAAC;SACD,QAAQ,EAAE;IACb,gBAAgB,EAAE,OAAC;SAChB,MAAM,CAAC;QACN,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;KAC7B,CAAC;SACD,QAAQ,EAAE;IACb,YAAY,EAAE,OAAC;SACZ,MAAM,CAAC;QACN,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE;QACxB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;KACnB,CAAC;SACD,QAAQ,EAAE;IACb,iBAAiB,EAAE,OAAC;SACjB,MAAM,CAAC;QACN,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE;QACxB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;KACnB,CAAC;SACD,QAAQ,EAAE;IACb,aAAa,EAAE,YAAY;IAC3B,mBAAmB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1C,aAAa,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACzC,YAAY,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACxC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAClC,IAAI,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE;CAC3E,CAAC,CAAC"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
export
|
|
2
|
+
export type SummaryResults = {
|
|
3
3
|
passed: number;
|
|
4
4
|
failed: number;
|
|
5
5
|
flaky: number | undefined;
|
|
@@ -27,7 +27,197 @@ export declare type SummaryResults = {
|
|
|
27
27
|
}[];
|
|
28
28
|
}>;
|
|
29
29
|
};
|
|
30
|
-
export
|
|
30
|
+
export type failure = {
|
|
31
31
|
test: string;
|
|
32
32
|
failureReason: string;
|
|
33
33
|
};
|
|
34
|
+
export interface JSONResult {
|
|
35
|
+
config: Config;
|
|
36
|
+
suites: Suite[];
|
|
37
|
+
errors: any[];
|
|
38
|
+
stats: Stats;
|
|
39
|
+
}
|
|
40
|
+
export interface Config {
|
|
41
|
+
configFile: string;
|
|
42
|
+
rootDir: string;
|
|
43
|
+
forbidOnly: boolean;
|
|
44
|
+
fullyParallel: boolean;
|
|
45
|
+
globalSetup: any;
|
|
46
|
+
globalTeardown: any;
|
|
47
|
+
globalTimeout: number;
|
|
48
|
+
grep: Grep;
|
|
49
|
+
grepInvert: any;
|
|
50
|
+
maxFailures: number;
|
|
51
|
+
metadata: Metadata;
|
|
52
|
+
preserveOutput: string;
|
|
53
|
+
reporter: [string, any][];
|
|
54
|
+
reportSlowTests: ReportSlowTests;
|
|
55
|
+
quiet: boolean;
|
|
56
|
+
projects: Project[];
|
|
57
|
+
shard: any;
|
|
58
|
+
updateSnapshots: string;
|
|
59
|
+
version: string;
|
|
60
|
+
workers: number;
|
|
61
|
+
webServer: any;
|
|
62
|
+
}
|
|
63
|
+
export interface Grep {
|
|
64
|
+
}
|
|
65
|
+
export interface Metadata {
|
|
66
|
+
actualWorkers: number;
|
|
67
|
+
}
|
|
68
|
+
export interface ReportSlowTests {
|
|
69
|
+
max: number;
|
|
70
|
+
threshold: number;
|
|
71
|
+
}
|
|
72
|
+
export interface Project {
|
|
73
|
+
outputDir: string;
|
|
74
|
+
repeatEach: number;
|
|
75
|
+
retries: number;
|
|
76
|
+
id: string;
|
|
77
|
+
name: string;
|
|
78
|
+
testDir: string;
|
|
79
|
+
testIgnore: any[];
|
|
80
|
+
testMatch: string[];
|
|
81
|
+
timeout: number;
|
|
82
|
+
}
|
|
83
|
+
export interface Suite {
|
|
84
|
+
title: string;
|
|
85
|
+
file: string;
|
|
86
|
+
column: number;
|
|
87
|
+
line: number;
|
|
88
|
+
specs: Spec[];
|
|
89
|
+
suites: Suites[];
|
|
90
|
+
}
|
|
91
|
+
export interface Spec {
|
|
92
|
+
title: string;
|
|
93
|
+
ok: boolean;
|
|
94
|
+
tags: any[];
|
|
95
|
+
tests: Test[];
|
|
96
|
+
id: string;
|
|
97
|
+
file: string;
|
|
98
|
+
line: number;
|
|
99
|
+
column: number;
|
|
100
|
+
}
|
|
101
|
+
export interface Test {
|
|
102
|
+
timeout: number;
|
|
103
|
+
annotations: any[];
|
|
104
|
+
expectedStatus: string;
|
|
105
|
+
projectId: string;
|
|
106
|
+
projectName: string;
|
|
107
|
+
results: Result[];
|
|
108
|
+
status: string;
|
|
109
|
+
}
|
|
110
|
+
export interface Result {
|
|
111
|
+
workerIndex: number;
|
|
112
|
+
status: string;
|
|
113
|
+
duration: number;
|
|
114
|
+
errors: Error[];
|
|
115
|
+
stdout: any[];
|
|
116
|
+
stderr: any[];
|
|
117
|
+
retry: number;
|
|
118
|
+
startTime: string;
|
|
119
|
+
attachments: Attachment[];
|
|
120
|
+
error?: {
|
|
121
|
+
message: string;
|
|
122
|
+
stack: string;
|
|
123
|
+
location: {
|
|
124
|
+
file: string;
|
|
125
|
+
column: number;
|
|
126
|
+
line: number;
|
|
127
|
+
};
|
|
128
|
+
snippet: string;
|
|
129
|
+
};
|
|
130
|
+
errorLocation?: ErrorLocation;
|
|
131
|
+
}
|
|
132
|
+
export interface Error {
|
|
133
|
+
location: Location;
|
|
134
|
+
message: string;
|
|
135
|
+
}
|
|
136
|
+
export interface Location {
|
|
137
|
+
file: string;
|
|
138
|
+
column: number;
|
|
139
|
+
line: number;
|
|
140
|
+
}
|
|
141
|
+
export interface Attachment {
|
|
142
|
+
name: string;
|
|
143
|
+
contentType: string;
|
|
144
|
+
path: string;
|
|
145
|
+
}
|
|
146
|
+
export interface ErrorLocation {
|
|
147
|
+
file: string;
|
|
148
|
+
column: number;
|
|
149
|
+
line: number;
|
|
150
|
+
}
|
|
151
|
+
export interface Suites {
|
|
152
|
+
title: string;
|
|
153
|
+
file: string;
|
|
154
|
+
line: number;
|
|
155
|
+
column: number;
|
|
156
|
+
specs: Specs[];
|
|
157
|
+
}
|
|
158
|
+
export interface Specs {
|
|
159
|
+
title: string;
|
|
160
|
+
ok: boolean;
|
|
161
|
+
tags: any[];
|
|
162
|
+
tests: Tests[];
|
|
163
|
+
id: string;
|
|
164
|
+
file: string;
|
|
165
|
+
line: number;
|
|
166
|
+
column: number;
|
|
167
|
+
}
|
|
168
|
+
export interface Tests {
|
|
169
|
+
timeout: number;
|
|
170
|
+
annotations: any[];
|
|
171
|
+
expectedStatus: string;
|
|
172
|
+
projectId: string;
|
|
173
|
+
projectName: string;
|
|
174
|
+
results: Results[];
|
|
175
|
+
status: string;
|
|
176
|
+
}
|
|
177
|
+
export interface Results {
|
|
178
|
+
workerIndex: number;
|
|
179
|
+
status: string;
|
|
180
|
+
duration: number;
|
|
181
|
+
error: {
|
|
182
|
+
message: string;
|
|
183
|
+
stack: string;
|
|
184
|
+
location: {
|
|
185
|
+
file: string;
|
|
186
|
+
column: number;
|
|
187
|
+
line: number;
|
|
188
|
+
};
|
|
189
|
+
snippet: string;
|
|
190
|
+
};
|
|
191
|
+
errors: Errors[];
|
|
192
|
+
stdout: any[];
|
|
193
|
+
stderr: any[];
|
|
194
|
+
retry: number;
|
|
195
|
+
startTime: string;
|
|
196
|
+
attachments: Attachments[];
|
|
197
|
+
errorLocation: {
|
|
198
|
+
file: string;
|
|
199
|
+
column: number;
|
|
200
|
+
line: number;
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
export interface Errors {
|
|
204
|
+
location: {
|
|
205
|
+
file: string;
|
|
206
|
+
column: number;
|
|
207
|
+
line: number;
|
|
208
|
+
};
|
|
209
|
+
message: string;
|
|
210
|
+
}
|
|
211
|
+
export interface Attachments {
|
|
212
|
+
name: string;
|
|
213
|
+
contentType: string;
|
|
214
|
+
path: string;
|
|
215
|
+
}
|
|
216
|
+
export interface Stats {
|
|
217
|
+
startTime: string;
|
|
218
|
+
duration: number;
|
|
219
|
+
expected: number;
|
|
220
|
+
skipped: number;
|
|
221
|
+
unexpected: number;
|
|
222
|
+
flaky: number;
|
|
223
|
+
}
|
package/dist/src/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
"dependencies": {
|
|
3
3
|
"@slack/web-api": "^6.9.1",
|
|
4
4
|
"@slack/webhook": "^7.0.1",
|
|
5
|
-
"
|
|
5
|
+
"commander": "^11.1.0",
|
|
6
|
+
"https-proxy-agent": "^7.0.1",
|
|
7
|
+
"ts-node": "^10.9.1",
|
|
8
|
+
"zod": "^3.22.4"
|
|
6
9
|
},
|
|
7
10
|
"devDependencies": {
|
|
8
|
-
"@playwright/test": "^1.
|
|
11
|
+
"@playwright/test": "^1.40.0",
|
|
9
12
|
"@slack/types": "^2.7.0",
|
|
10
13
|
"@typescript-eslint/eslint-plugin": "^5.30.6",
|
|
11
14
|
"@typescript-eslint/parser": "^5.30.6",
|
|
@@ -27,11 +30,16 @@
|
|
|
27
30
|
"pw": "nyc playwright test && nyc report --reporter=lcov",
|
|
28
31
|
"build": "tsc -p ./tsconfig.json",
|
|
29
32
|
"lint": "npx eslint . --ext .ts",
|
|
30
|
-
"lint-fix": "npx eslint . --ext .ts --fix"
|
|
33
|
+
"lint-fix": "npx eslint . --ext .ts --fix",
|
|
34
|
+
"cli": "yarn build && node dist/cli.js",
|
|
35
|
+
"cli-debug": "yarn build && npx . -c ./tests/test_data/valid_cli_config.json -j ./tests/test_data/valid_test_results.json"
|
|
31
36
|
},
|
|
32
37
|
"name": "playwright-slack-report",
|
|
33
|
-
"version": "1.1.
|
|
34
|
-
"
|
|
38
|
+
"version": "1.1.54",
|
|
39
|
+
"bin": {
|
|
40
|
+
"playwright-slack-report": "dist/cli.js"
|
|
41
|
+
},
|
|
42
|
+
"main": "dist/cli.js",
|
|
35
43
|
"types": "dist/index.d.ts",
|
|
36
44
|
"repository": "git@github.com:ryanrosello-og/playwright-slack-report.git",
|
|
37
45
|
"author": "Ryan Rosello <ryanrosello@hotmail.com>",
|
|
@@ -51,7 +59,7 @@
|
|
|
51
59
|
"src/**/*.ts"
|
|
52
60
|
],
|
|
53
61
|
"exclude": [
|
|
54
|
-
"./
|
|
62
|
+
"./custom_block/my_block.ts"
|
|
55
63
|
]
|
|
56
64
|
}
|
|
57
65
|
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const generateCustomLayout = (summaryResults) => {
|
|
4
|
-
const maxNumberOfFailures = 10;
|
|
5
|
-
const maxNumberOfFailureLength = 650;
|
|
6
|
-
const fails = [];
|
|
7
|
-
const meta = [];
|
|
8
|
-
for (let i = 0; i < summaryResults.failures.length; i += 1) {
|
|
9
|
-
const { failureReason, test } = summaryResults.failures[i];
|
|
10
|
-
const formattedFailure = failureReason
|
|
11
|
-
.substring(0, maxNumberOfFailureLength)
|
|
12
|
-
.split('\n')
|
|
13
|
-
.map((l) => `>${l}`)
|
|
14
|
-
.join('\n');
|
|
15
|
-
fails.push({
|
|
16
|
-
type: 'section',
|
|
17
|
-
text: {
|
|
18
|
-
type: 'mrkdwn',
|
|
19
|
-
text: `*${test}*
|
|
20
|
-
\n\n${formattedFailure}`,
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
if (i > maxNumberOfFailures) {
|
|
24
|
-
fails.push({
|
|
25
|
-
type: 'section',
|
|
26
|
-
text: {
|
|
27
|
-
type: 'mrkdwn',
|
|
28
|
-
text: '*⚠️ There are too many failures to display, view the full results in BuildKite*',
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
break;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
if (summaryResults.meta) {
|
|
35
|
-
for (let i = 0; i < summaryResults.meta.length; i += 1) {
|
|
36
|
-
const { key, value } = summaryResults.meta[i];
|
|
37
|
-
meta.push({
|
|
38
|
-
type: 'section',
|
|
39
|
-
text: {
|
|
40
|
-
type: 'mrkdwn',
|
|
41
|
-
text: `\n*${key}* :\t${value}`,
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
const testWithStringAttachment = summaryResults.tests.filter((t) => t.attachments)[0];
|
|
47
|
-
return [
|
|
48
|
-
{
|
|
49
|
-
type: 'section',
|
|
50
|
-
text: {
|
|
51
|
-
type: 'mrkdwn',
|
|
52
|
-
text: '**Thisi is cusomter block**',
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
type: 'section',
|
|
57
|
-
text: {
|
|
58
|
-
type: 'mrkdwn',
|
|
59
|
-
text: `**The first test is:**\n${summaryResults.tests[0].name}`,
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
type: 'section',
|
|
64
|
-
text: {
|
|
65
|
-
type: 'mrkdwn',
|
|
66
|
-
text: `**Test with attachment:**\n${testWithStringAttachment?.attachments
|
|
67
|
-
?.filter((a) => a.contentType === 'text/plain')
|
|
68
|
-
.map((a) => a.body?.toString())}`,
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
...meta,
|
|
72
|
-
{
|
|
73
|
-
type: 'section',
|
|
74
|
-
text: {
|
|
75
|
-
type: 'mrkdwn',
|
|
76
|
-
text: `:white_check_mark: *${summaryResults.passed}* Tests ran successfully \n\n :red_circle: *${summaryResults.failed}* Tests failed \n\n ${summaryResults.skipped > 0
|
|
77
|
-
? `:fast_forward: *${summaryResults.skipped}* skipped`
|
|
78
|
-
: ''} \n\n `,
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
type: 'divider',
|
|
83
|
-
},
|
|
84
|
-
...fails,
|
|
85
|
-
];
|
|
86
|
-
};
|
|
87
|
-
exports.default = generateCustomLayout;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function generateCustomLayoutSimpleExample(summaryResults) {
|
|
4
|
-
return [
|
|
5
|
-
{
|
|
6
|
-
type: 'section',
|
|
7
|
-
text: {
|
|
8
|
-
type: 'mrkdwn',
|
|
9
|
-
text: summaryResults.failed === 0
|
|
10
|
-
? ':tada: All tests passed!'
|
|
11
|
-
: `😭${summaryResults.failed} failure(s) out of ${summaryResults.tests.length} tests`,
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
];
|
|
15
|
-
}
|
|
16
|
-
exports.default = generateCustomLayoutSimpleExample;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function generateCustomLayoutSimpleMeta(summaryResults) {
|
|
4
|
-
const meta = [];
|
|
5
|
-
if (summaryResults.meta) {
|
|
6
|
-
for (let i = 0; i < summaryResults.meta.length; i += 1) {
|
|
7
|
-
const { key, value } = summaryResults.meta[i];
|
|
8
|
-
meta.push({
|
|
9
|
-
type: 'section',
|
|
10
|
-
text: {
|
|
11
|
-
type: 'mrkdwn',
|
|
12
|
-
text: `\n*${key}* :\t${value}`,
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return [
|
|
18
|
-
{
|
|
19
|
-
type: 'section',
|
|
20
|
-
text: {
|
|
21
|
-
type: 'mrkdwn',
|
|
22
|
-
text: summaryResults.failed === 0
|
|
23
|
-
? ':tada: All tests passed!'
|
|
24
|
-
: `😭${summaryResults.failed} failure(s) out of ${summaryResults.tests.length} tests`,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
...meta,
|
|
28
|
-
];
|
|
29
|
-
}
|
|
30
|
-
exports.default = generateCustomLayoutSimpleMeta;
|