playwright-slack-report-burak 2.0.11 → 2.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.
@@ -93,14 +93,12 @@ class ResultsParser {
93
93
  fs.writeFileSync(nodeSummaryFile, JSON.stringify(nodeSummary, null, 2));
94
94
 
95
95
  if (this.shardIndex === 0 && this.totalShardCount > 1) {
96
- /* console.log('Fetching all artifacts...');
97
- await this.fetchAllArtifacts(); */
98
96
  if (process.env.CI) {
99
97
  console.log('Fetching all artifacts...');
100
98
  await this.fetchAllArtifacts();
101
99
  } else {
102
100
  while (!this.allNodeSummaryFilesExist() || !this.allBlobZipsExist()) {
103
- console.log('Waiting for all blob zips to exist...');
101
+ console.log('Waiting for all both to exist...');
104
102
  await new Promise(resolve => setTimeout(resolve, 1000)); // Wait for 1 second
105
103
  }
106
104
  }
@@ -108,7 +106,7 @@ class ResultsParser {
108
106
 
109
107
  console.log('Contents of playwright-report for node', this.shardIndex, ':', fs.readdirSync(summariesDir));
110
108
 
111
- if (this.allNodeSummaryFilesExist() && this.allBlobZipsExist()) {
109
+ if (this.allNodeSummaryFilesExist() && this.allBlobZipsExist() && this.shardIndex === 0) {
112
110
  // Merge all node summaries into the final summary
113
111
  for (let i = 0; i < this.totalShardCount; i++) {
114
112
  const nodeSummaryFile = path.join(summariesDir, `node_summary_${i}.json`);
@@ -322,8 +320,7 @@ class ResultsParser {
322
320
  const response = await axios.get(circleciApiUrl, {
323
321
  headers: {
324
322
  'Circle-Token': circleciToken,
325
- },
326
- responseType: 'arraybuffer'
323
+ }
327
324
  });
328
325
 
329
326
  fs.writeFileSync(filePath, response.data);
@@ -343,8 +340,10 @@ class ResultsParser {
343
340
  mergeReports() {
344
341
  try {
345
342
  // Execute the command to merge reports
346
- exec('npx playwright merge-reports --reporter html ./playwright-report', { stdio: 'inherit' });
343
+ exec('npx playwright merge-reports --reporter html playwright-report');
344
+ //new Promise(resolve => setTimeout(resolve, 5000));
347
345
  console.log('Reports merged successfully.');
346
+ console.log('Contents of playwright-report:', fs.readdirSync('./playwright-report'));
348
347
  } catch (error) {
349
348
  // Log a warning instead of throwing an error
350
349
  console.warn('Warning: Failed to merge reports. This may not affect the overall process.', error.message);
@@ -70,12 +70,12 @@ class SlackReporter {
70
70
  this.log(message);
71
71
  return;
72
72
  }
73
- const { stopReporter, currentShardIndex, totalShardCount } = await this.resultsParser.getParsedResults();
74
- if (stopReporter) {
75
- this.log(`❌ Stopping reporter for non-zero index node ${currentShardIndex} of ${totalShardCount}`);
73
+ const resultSummary = await this.resultsParser.getParsedResults();
74
+ // SHARDING SUPPORT - Stop slack messages for non-zero index node
75
+ if (process.env.CIRCLE_NODE_INDEX && process.env.CIRCLE_NODE_INDEX !== '0') {
76
+ this.log(`❌ Stopping reporter for non-zero index node ${process.env.CIRCLE_NODE_INDEX} of ${process.env.CIRCLE_NODE_TOTAL}`);
76
77
  return;
77
78
  }
78
- const resultSummary = await this.resultsParser.getParsedResults();
79
79
  resultSummary.meta = this.meta;
80
80
  const maxRetry = Math.max(...resultSummary.tests.map((o) => o.retry));
81
81
  if (this.sendResults === 'on-failure'
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.0.11",
33
+ "version": "2.0.13",
34
34
  "main": "index.js",
35
35
  "types": "dist/index.d.ts",
36
36
  "repository": "git@github.com:ryanrosello-og/playwright-slack-report.git",