playwright-slack-report 1.0.8 → 1.0.13

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 ![Biulds](https://github.com/ryanrosello-og/playwright-slack-report/actions/workflows/playwright.yml/badge.svg) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/ryanrosello-og/playwright-slack-report/blob/master/LICENSE)
1
+ # playwright-slack-report ![Biulds](https://github.com/ryanrosello-og/playwright-slack-report/actions/workflows/playwright.yml/badge.svg) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/ryanrosello-og/playwright-slack-report/blob/master/LICENSE) [![Coverage Status](https://coveralls.io/repos/github/ryanrosello-og/playwright-slack-report/badge.svg?branch=main)](https://coveralls.io/github/ryanrosello-og/playwright-slack-report?branch=main)
2
2
 
3
3
  [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/ryanrosello-og/playwright-slack-report)
4
4
 
@@ -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
@@ -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.8",
31
+ "version": "1.0.13",
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
  }