playwright-slack-report 1.0.10 → 1.0.14
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
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# playwright-slack-report  [](https://github.com/ryanrosello-og/playwright-slack-report/blob/master/LICENSE)
|
|
1
|
+
# playwright-slack-report  [](https://github.com/ryanrosello-og/playwright-slack-report/blob/master/LICENSE) [](https://coveralls.io/github/ryanrosello-og/playwright-slack-report?branch=main)
|
|
2
2
|
|
|
3
3
|
[](https://gitpod.io/#https://github.com/ryanrosello-og/playwright-slack-report)
|
|
4
4
|
|
|
@@ -10,11 +10,12 @@ class ResultsParser {
|
|
|
10
10
|
this.result = [];
|
|
11
11
|
}
|
|
12
12
|
async getParsedResults() {
|
|
13
|
+
const failures = await this.getFailures();
|
|
13
14
|
const summary = {
|
|
14
15
|
passed: 0,
|
|
15
|
-
failed:
|
|
16
|
+
failed: failures.length,
|
|
16
17
|
skipped: 0,
|
|
17
|
-
failures
|
|
18
|
+
failures,
|
|
18
19
|
tests: [],
|
|
19
20
|
};
|
|
20
21
|
for (const suite of this.result) {
|
|
@@ -23,9 +24,6 @@ class ResultsParser {
|
|
|
23
24
|
if (test.status === 'passed') {
|
|
24
25
|
summary.passed += 1;
|
|
25
26
|
}
|
|
26
|
-
else if (test.status === 'failed' || test.status === 'timedOut') {
|
|
27
|
-
summary.failed += 1;
|
|
28
|
-
}
|
|
29
27
|
else if (test.status === 'skipped') {
|
|
30
28
|
summary.skipped += 1;
|
|
31
29
|
}
|
|
@@ -38,10 +36,15 @@ class ResultsParser {
|
|
|
38
36
|
for (const suite of this.result) {
|
|
39
37
|
for (const test of suite.testSuite.tests) {
|
|
40
38
|
if (test.status === 'failed' || test.status === 'timedOut') {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
failureReason
|
|
44
|
-
|
|
39
|
+
// dont add duplicate results (retries)
|
|
40
|
+
const failureExists = failures.find((f) => f.test === test.name
|
|
41
|
+
&& f.failureReason === test.reason);
|
|
42
|
+
if (!failureExists) {
|
|
43
|
+
failures.push({
|
|
44
|
+
test: test.name,
|
|
45
|
+
failureReason: test.reason,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
50
|
}
|
package/dist/src/SlackClient.js
CHANGED
|
@@ -34,6 +34,9 @@ class SlackClient {
|
|
|
34
34
|
// eslint-disable-next-line no-console
|
|
35
35
|
console.log(`✅ Message sent to ${channel}`);
|
|
36
36
|
}
|
|
37
|
+
else {
|
|
38
|
+
result.push({ channel, outcome: `❌ Message not sent to ${channel} \r\n ${JSON.stringify(chatResponse, null, 2)}` });
|
|
39
|
+
}
|
|
37
40
|
}
|
|
38
41
|
catch (error) {
|
|
39
42
|
result.push({
|
|
@@ -44,13 +44,15 @@ class SlackReporter {
|
|
|
44
44
|
const slackClient = new SlackClient_1.default(new web_api_1.WebClient(process.env.SLACK_BOT_USER_OAUTH_TOKEN, {
|
|
45
45
|
logLevel: web_api_1.LogLevel.DEBUG,
|
|
46
46
|
}));
|
|
47
|
-
await slackClient.sendMessage({
|
|
47
|
+
const result = await slackClient.sendMessage({
|
|
48
48
|
options: {
|
|
49
49
|
channelIds: this.slackChannels,
|
|
50
50
|
summaryResults: resultSummary,
|
|
51
51
|
customLayout: this.customLayout,
|
|
52
52
|
},
|
|
53
53
|
});
|
|
54
|
+
// eslint-disable-next-line no-console
|
|
55
|
+
console.log(JSON.stringify(result, null, 2));
|
|
54
56
|
}
|
|
55
57
|
preChecks() {
|
|
56
58
|
if (this.sendResults === 'off') {
|
package/package.json
CHANGED
|
@@ -23,16 +23,17 @@
|
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
25
|
"prettier": "prettier --write --loglevel warn \"**/**/*.ts\"",
|
|
26
|
-
"pw": "nyc playwright test",
|
|
26
|
+
"pw": "nyc playwright test && nyc report --reporter=lcov",
|
|
27
27
|
"build": "tsc -p ./tsconfig.json",
|
|
28
28
|
"lint":"npx eslint . --ext .ts"
|
|
29
29
|
},
|
|
30
30
|
"name": "playwright-slack-report",
|
|
31
|
-
"version": "1.0.
|
|
31
|
+
"version": "1.0.14",
|
|
32
32
|
"main": "index.js",
|
|
33
33
|
"types": "dist/index.d.ts",
|
|
34
34
|
"repository": "git@github.com:ryanrosello-og/playwright-slack-report.git",
|
|
35
35
|
"author": "Ryan Rosello <ryanrosello@hotmail.com>",
|
|
36
36
|
"license": "MIT",
|
|
37
|
-
"files": ["/dist/src"]
|
|
37
|
+
"files": ["/dist/src"],
|
|
38
|
+
"keywords": ["slack", "report", "playwright", "typescript"]
|
|
38
39
|
}
|