monocart-reporter 1.6.33 → 1.6.35

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/lib/utils/util.js CHANGED
@@ -98,6 +98,21 @@ const Util = {
98
98
  return {};
99
99
  },
100
100
 
101
+ resolveTestIdWithRetry: (testInfo) => {
102
+ const id = Util.shortTestId(testInfo.testId);
103
+ const retry = testInfo.retry;
104
+ if (retry > 0) {
105
+ return `${id}-retry${retry}`;
106
+ }
107
+ return id;
108
+ },
109
+
110
+ resolveArtifactSourcePath: (artifactsDir, id) => {
111
+ const filename = `source-${id}.json`;
112
+ const sourcePath = path.resolve(artifactsDir, filename);
113
+ return sourcePath;
114
+ },
115
+
101
116
  saveHtmlReport: async (options) => {
102
117
 
103
118
  const {
package/lib/visitor.js CHANGED
@@ -287,13 +287,16 @@ class Visitor {
287
287
  const resultsTimestamps = [].concat(testCase.timestamps);
288
288
 
289
289
  for (const testResult of testCase.results) {
290
- caseItem.attachments = caseItem.attachments.concat(testResult.attachments);
291
290
 
292
- caseItem.errors = caseItem.errors.concat(testResult.errors);
291
+ const retry = testResult.retry;
293
292
 
294
- caseItem.retry = testResult.retry;
293
+ caseItem.retry = retry;
295
294
  caseItem.status = testResult.status;
296
295
 
296
+ const attachments = this.initAttachmentsRetry(testResult.attachments, retry);
297
+ caseItem.attachments = caseItem.attachments.concat(attachments);
298
+ caseItem.errors = caseItem.errors.concat(testResult.errors);
299
+
297
300
  // The worker index is used to reference a specific browser instance
298
301
  // The parallel index coordinates the parallel execution of tests across multiple worker instances.
299
302
  // https://playwright.dev/docs/test-parallel#worker-index-and-parallel-index
@@ -317,7 +320,7 @@ class Visitor {
317
320
 
318
321
  // concat all steps
319
322
  if (caseItem.subs.length) {
320
- caseItem.subs.push(this.getRetryStep(testResult));
323
+ caseItem.subs.push(this.getRetryStep(retry));
321
324
  }
322
325
 
323
326
  const steps = await this.testStepHandler(testResult.steps, caseItem);
@@ -369,18 +372,25 @@ class Visitor {
369
372
 
370
373
  }
371
374
 
375
+ initAttachmentsRetry(attachments, retry) {
376
+ attachments.forEach((item) => {
377
+ item.retry = retry;
378
+ });
379
+ return attachments;
380
+ }
381
+
372
382
  // ==============================================================================================
373
383
 
374
- getRetryStep(testResult) {
384
+ getRetryStep(retry) {
375
385
  const stepId = Util.uid();
376
386
  return {
377
387
  id: stepId,
378
- title: `Retry #${testResult.retry}`,
388
+ title: `Retry #${retry}`,
379
389
  type: 'step',
380
390
  stepType: 'retry',
381
391
  // for retry color
382
392
  status: 'retry',
383
- retry: testResult.retry
393
+ retry
384
394
  };
385
395
  }
386
396
 
@@ -612,8 +622,6 @@ class Visitor {
612
622
  this.artifactDataMap[json.type] = [json.data];
613
623
  }
614
624
  }
615
- // remove artifact json after loaded
616
- Util.rmSync(p);
617
625
  }
618
626
 
619
627
  // ==============================================================================================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monocart-reporter",
3
- "version": "1.6.33",
3
+ "version": "1.6.35",
4
4
  "description": "A playwright test reporter. Shows suites/cases/steps with tree style, markdown annotations, custom columns/formatters/data collection visitors, console logs, style tags, send email.",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
@@ -18,6 +18,8 @@
18
18
  "scripts": {
19
19
  "link": "node ./scripts/link.js",
20
20
  "test": "npm run link && npx playwright test -c tests",
21
+ "test-coverage": "npm run link && npx playwright test tests/report-coverage -c tests",
22
+ "test-network": "npm run link && npx playwright test tests/report-network -c tests",
21
23
  "build": "sf lint && sf b -p",
22
24
  "dev": "sf d reporter -w .temp/monocart/index.json",
23
25
  "patch": "npm run build && sf publish patch -r",
@@ -53,9 +55,9 @@
53
55
  "eslint-config-plus": "^1.0.6",
54
56
  "eslint-plugin-html": "^7.1.0",
55
57
  "eslint-plugin-vue": "^9.14.1",
56
- "lighthouse": "^10.2.0",
58
+ "lighthouse": "^10.3.0",
57
59
  "stylelint": "^15.7.0",
58
60
  "stylelint-config-plus": "^1.0.3",
59
- "vine-ui": "^3.1.11"
61
+ "vine-ui": "^3.1.12"
60
62
  }
61
63
  }