playwright-slack-report-burak 2.0.8 → 2.0.10

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.
@@ -38,7 +38,7 @@ class ResultsParser {
38
38
  }*/
39
39
 
40
40
  // Define the directory to store node summaries
41
- const summariesDir = path.join(process.env.CIRCLE_WORKING_DIRECTORY || './', 'playwright-report');
41
+ const summariesDir = path.join('./', 'playwright-report');
42
42
 
43
43
  if (!fs.existsSync(summariesDir)) {
44
44
  fs.mkdirSync(summariesDir, { recursive: true });
@@ -92,8 +92,9 @@ class ResultsParser {
92
92
  // Write the updated summary back to the file for the current node
93
93
  fs.writeFileSync(nodeSummaryFile, JSON.stringify(nodeSummary, null, 2));
94
94
 
95
- console.log('current shard index', this.shardIndex, 'type:', typeof this.shardIndex, 'total shard count', this.totalShardCount, 'type:', typeof this.totalShardCount, 'CI', process.env.CI, 'type:', typeof process.env.CI);
96
95
  if (this.shardIndex === 0 && this.totalShardCount > 1) {
96
+ /* console.log('Fetching all artifacts...');
97
+ await this.fetchAllArtifacts(); */
97
98
  if (process.env.CI) {
98
99
  console.log('Fetching all artifacts...');
99
100
  await this.fetchAllArtifacts();
@@ -105,8 +106,6 @@ class ResultsParser {
105
106
  }
106
107
  }
107
108
 
108
- console.log('Contents of playwright-report for node', this.shardIndex, ':', fs.readdirSync(summariesDir));
109
-
110
109
  if (this.allNodeSummaryFilesExist() && this.allBlobZipsExist()) {
111
110
  // Merge all node summaries into the final summary
112
111
  for (let i = 0; i < this.totalShardCount; i++) {
@@ -272,7 +271,7 @@ class ResultsParser {
272
271
  }*/
273
272
  allNodeSummaryFilesExist() {
274
273
  console.log('Checking if all node summary files exist...');
275
- const summariesDir = path.join(process.env.CIRCLE_WORKING_DIRECTORY || './', 'playwright-report');
274
+ const summariesDir = path.join('./', 'playwright-report');
276
275
 
277
276
  for (let i = 0; i < this.totalShardCount; i++) {
278
277
  const nodeSummaryFile = path.join(summariesDir, `node_summary_${i}.json`);
@@ -285,7 +284,7 @@ class ResultsParser {
285
284
 
286
285
  allBlobZipsExist() {
287
286
  console.log('Checking if all blob zips exist...');
288
- const summariesDir = path.join(process.env.CIRCLE_WORKING_DIRECTORY || './', 'playwright-report');
287
+ const summariesDir = path.join('./', 'playwright-report');
289
288
 
290
289
  for (let i = 0; i < this.totalShardCount; i++) {
291
290
  const blobZipFile = path.join(summariesDir, `blob-report-node-${i}.zip`);
@@ -297,7 +296,7 @@ class ResultsParser {
297
296
  }
298
297
 
299
298
  async fetchAllArtifacts() {
300
- const summariesDir = path.join(process.env.CIRCLE_WORKING_DIRECTORY || './', 'playwright-report');
299
+ const summariesDir = path.join('./', 'playwright-report');
301
300
  while (!this.allNodeSummaryFilesExist() || !this.allBlobZipsExist()) {
302
301
  console.log('Waiting for all blob zips to exist...');
303
302
  if (!fs.existsSync(summariesDir)) {
@@ -312,7 +311,7 @@ class ResultsParser {
312
311
 
313
312
  async fetchArtifact(i, file, summariesDir) {
314
313
  const circleciToken = process.env.safetywingtest_CIRCLECI_API_TOKEN;
315
- const circleciJobId = process.env.CIRCLE_WORKFLOW_JOB_ID || 'cb4e5f50-16cc-4dd1-a494-8c3094d91ceb';
314
+ const circleciJobId = process.env.CIRCLE_WORKFLOW_JOB_ID || '5175a4cb-273e-42fd-a5a6-40c3dc31c9de';
316
315
  const circleciApiUrl = `https://output.circle-artifacts.com/output/job/${circleciJobId}/artifacts/${i}/html-report/${file}`;
317
316
  const filePath = path.join(summariesDir, file);
318
317
 
@@ -321,7 +320,8 @@ class ResultsParser {
321
320
  const response = await axios.get(circleciApiUrl, {
322
321
  headers: {
323
322
  'Circle-Token': circleciToken,
324
- }
323
+ },
324
+ responseType: 'arraybuffer'
325
325
  });
326
326
 
327
327
  fs.writeFileSync(filePath, response.data);
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.8",
33
+ "version": "2.0.10",
34
34
  "main": "index.js",
35
35
  "types": "dist/index.d.ts",
36
36
  "repository": "git@github.com:ryanrosello-og/playwright-slack-report.git",