playwright-slack-report 1.0.7 → 1.0.12

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.
@@ -31,7 +31,7 @@ const generateBlocks = async (summaryResults) => {
31
31
  text: {
32
32
  type: 'mrkdwn',
33
33
  text: `*${test}*
34
- \n\n${formattedFailure}`,
34
+ \n${formattedFailure}`,
35
35
  },
36
36
  });
37
37
  if (i > maxNumberOfFailures) {
@@ -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: 0,
16
+ failed: failures.length,
16
17
  skipped: 0,
17
- failures: await this.getFailures(),
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
- failures.push({
42
- test: test.name,
43
- failureReason: test.reason,
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
  }
@@ -35,8 +35,9 @@ class SlackReporter {
35
35
  }
36
36
  const resultSummary = await this.resultsParser.getParsedResults();
37
37
  resultSummary.meta = this.meta;
38
+ const maxRetry = Math.max(...resultSummary.tests.map((o) => o.retry));
38
39
  if (this.sendResults === 'on-failure'
39
- && resultSummary.failures.length === 0) {
40
+ && resultSummary.tests.filter((z) => z.status === 'failed' && z.retry === maxRetry).length === 0) {
40
41
  this.log('⏩ Slack reporter - no failures found');
41
42
  return;
42
43
  }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "dependencies": {
3
+ "@slack/web-api": "^6.7.2"
4
+ },
5
+ "devDependencies": {
3
6
  "@playwright/test": "^1.23.3",
4
- "@slack/web-api": "^6.7.2",
5
7
  "dotenv": "^16.0.1",
6
8
  "playwright": "^1.23.3",
7
9
  "typescript": "^4.7.4",
8
- "@slack/types": "^2.7.0"
9
- },
10
- "devDependencies": {
10
+ "@slack/types": "^2.7.0",
11
11
  "@typescript-eslint/eslint-plugin": "^5.30.6",
12
12
  "@typescript-eslint/parser": "^5.30.6",
13
13
  "eslint": "^7.32.0 || ^8.2.0",
@@ -28,11 +28,12 @@
28
28
  "lint":"npx eslint . --ext .ts"
29
29
  },
30
30
  "name": "playwright-slack-report",
31
- "version": "1.0.7",
31
+ "version": "1.0.12",
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
  }