playwright-slack-report-burak 2.2.1 → 2.3.0
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/dist/src/ResultsParser.js +19 -28
- package/dist/src/SlackReporter.js +1 -1
- package/package.json +1 -1
|
@@ -53,52 +53,43 @@ class ResultsParser {
|
|
|
53
53
|
const totalTestCasesForNode = this.result.reduce((acc, suite) => acc + suite.testSuite.tests.length, 0);
|
|
54
54
|
|
|
55
55
|
// Initialize or read existing summary from file
|
|
56
|
-
|
|
56
|
+
const nodeSummary = {
|
|
57
57
|
total: totalTestCasesForNode,
|
|
58
|
-
passed:
|
|
59
|
-
failed:
|
|
60
|
-
flaky: 0
|
|
58
|
+
passed: passes.length,
|
|
59
|
+
failed: failures.length,
|
|
60
|
+
flaky: (this.separateFlakyTests && flakes.length > 0) ?
|
|
61
|
+
flakes.length : 0,
|
|
61
62
|
skipped: 0,
|
|
62
|
-
failures
|
|
63
|
+
failures,
|
|
63
64
|
tests: [],
|
|
64
65
|
};
|
|
65
|
-
|
|
66
|
-
// Create the file if it doesn't exist
|
|
67
|
-
if (!fs.existsSync(nodeSummaryFile)) {
|
|
68
|
-
fs.writeFileSync(nodeSummaryFile, JSON.stringify(nodeSummary, null, 2));
|
|
69
|
-
} else {
|
|
70
|
-
nodeSummary = JSON.parse(fs.readFileSync(nodeSummaryFile, 'utf-8'));
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Update the node summary with new test results
|
|
74
66
|
for (const suite of this.result) {
|
|
75
|
-
|
|
67
|
+
nodeSummary.tests = nodeSummary.tests.concat(suite.testSuite.tests);
|
|
76
68
|
for (const test of suite.testSuite.tests) {
|
|
77
69
|
if (test.status === 'skipped') {
|
|
78
70
|
nodeSummary.skipped += 1;
|
|
79
71
|
}
|
|
80
|
-
if (test.status === 'failed' || test.status === 'timedOut') {
|
|
81
|
-
nodeSummary.failed += 1;
|
|
82
|
-
}
|
|
83
|
-
if (this.separateFlakyTests && test.status === 'passed' && test.retry > 0) {
|
|
84
|
-
nodeSummary.flaky += 1;
|
|
85
|
-
}
|
|
86
|
-
if (test.status === 'passed' && (!this.separateFlakyTests || test.retry === 0)) {
|
|
87
|
-
nodeSummary.passed += 1;
|
|
88
|
-
}
|
|
89
72
|
}
|
|
90
73
|
}
|
|
91
74
|
|
|
92
|
-
//
|
|
75
|
+
// Create the file
|
|
93
76
|
fs.writeFileSync(nodeSummaryFile, JSON.stringify(nodeSummary, null, 2));
|
|
94
77
|
|
|
95
78
|
if (this.shardIndex === 0 && this.totalShardCount > 1) {
|
|
96
|
-
|
|
79
|
+
if (process.env.CI) {
|
|
80
|
+
console.log('Fetching all artifacts...');
|
|
81
|
+
await this.fetchAllArtifacts();
|
|
82
|
+
} else {
|
|
83
|
+
while (!this.allNodeSummaryFilesExist() || !this.allBlobZipsExist()) {
|
|
84
|
+
console.log('Waiting for all both to exist...');
|
|
85
|
+
await new Promise(resolve => setTimeout(resolve, 1000)); // Wait for 1 second
|
|
86
|
+
}
|
|
87
|
+
}
|
|
97
88
|
}
|
|
98
89
|
|
|
99
90
|
console.log('Contents of playwright-report for node', this.shardIndex, ':', fs.readdirSync(summariesDir));
|
|
100
91
|
|
|
101
|
-
if (this.
|
|
92
|
+
if (this.shardIndex === 0 && this.allNodeSummaryFilesExist() && this.allBlobZipsExist()) {
|
|
102
93
|
// Merge all node summaries into the final summary
|
|
103
94
|
for (let i = 0; i < this.totalShardCount; i++) {
|
|
104
95
|
const nodeSummaryFile = path.join(summariesDir, `node_summary_${i}.json`);
|
|
@@ -301,7 +292,7 @@ class ResultsParser {
|
|
|
301
292
|
|
|
302
293
|
async fetchArtifact(i, file, summariesDir) {
|
|
303
294
|
const circleciToken = process.env.safetywingtest_CIRCLECI_API_TOKEN;
|
|
304
|
-
const circleciJobId = process.env.CIRCLE_WORKFLOW_JOB_ID || '
|
|
295
|
+
const circleciJobId = process.env.CIRCLE_WORKFLOW_JOB_ID || '8133c154-ceb3-466c-b4e1-d3d8768b60fa';
|
|
305
296
|
const circleciApiUrl = `https://output.circle-artifacts.com/output/job/${circleciJobId}/artifacts/${i}/html-report/${file}`;
|
|
306
297
|
const filePath = path.join(summariesDir, file);
|
|
307
298
|
|
|
@@ -71,7 +71,7 @@ class SlackReporter {
|
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
73
|
const resultSummary = await this.resultsParser.getParsedResults();
|
|
74
|
-
// SHARDING SUPPORT - Stop slack messages for non-zero index node
|
|
74
|
+
// SHARDING SUPPORT - Stop slack messages for non-zero index node(s)
|
|
75
75
|
if (process.env.CIRCLE_NODE_INDEX && process.env.CIRCLE_NODE_INDEX !== '0') {
|
|
76
76
|
this.log(`❌ Stopping reporter for non-zero index node ${process.env.CIRCLE_NODE_INDEX} of ${process.env.CIRCLE_NODE_TOTAL}`);
|
|
77
77
|
return;
|
package/package.json
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"lint-fix": "npx eslint . --ext .ts --fix"
|
|
31
31
|
},
|
|
32
32
|
"name": "playwright-slack-report-burak",
|
|
33
|
-
"version": "2.
|
|
33
|
+
"version": "2.3.0",
|
|
34
34
|
"main": "index.js",
|
|
35
35
|
"types": "dist/index.d.ts",
|
|
36
36
|
"repository": "git@github.com:ryanrosello-og/playwright-slack-report.git",
|