@arpanp/zen-reporter 0.11.1 → 0.11.3

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
@@ -8,11 +8,11 @@ Zen Reporter transforms Playwright's raw test results into an interactive, visua
8
8
 
9
9
  Light mode:
10
10
 
11
- ![Dashboard Overview - Light Mode](docs/screenshots/light-mode.png)
11
+ ![Dashboard Overview - Light Mode](https://raw.githubusercontent.com/apatelia/zen-reporter/main/docs/screenshots/light-mode.png)
12
12
 
13
13
  Dark mode:
14
14
 
15
- ![Dashboard Overview - Dark Mode](docs/screenshots/dark-mode.png)
15
+ ![Dashboard Overview - Dark Mode](https://raw.githubusercontent.com/apatelia/zen-reporter/main/docs/screenshots/dark-mode.png)
16
16
 
17
17
  ## Features
18
18
 
@@ -50,7 +50,7 @@ npm install @arpanp/zen-reporter
50
50
 
51
51
  ## Configuring Zen Reporter in Playwright
52
52
 
53
- Add `zen-reporter` to your `playwright.config.ts` (or `playwright.config.js`):
53
+ Add `@arpanp/zen-reporter` to your `playwright.config.ts` (or `playwright.config.js`):
54
54
 
55
55
  ### Basic Configuration
56
56
 
@@ -58,7 +58,7 @@ Add `zen-reporter` to your `playwright.config.ts` (or `playwright.config.js`):
58
58
  import { defineConfig } from '@playwright/test';
59
59
 
60
60
  export default defineConfig({
61
- reporter: 'zen-reporter',
61
+ reporter: '@arpanp/zen-reporter',
62
62
  });
63
63
  ```
64
64
 
@@ -72,7 +72,7 @@ import { defineConfig } from '@playwright/test';
72
72
  export default defineConfig({
73
73
  reporter: [
74
74
  [
75
- 'zen-reporter',
75
+ '@arpanp/zen-reporter',
76
76
  {
77
77
  outputDir: 'zen-report', // Optional: Output directory where report files will be generated (default: "zen-report")
78
78
  projectName: 'My E2E Project', // Optional: Project name displayed in the top bar header
@@ -136,6 +136,14 @@ function formatDate(val) {
136
136
  return `${year}-${month}-${day} ${hours}:${mins}:${secs}`;
137
137
  }
138
138
 
139
+ function padCenter(str, width) {
140
+ const totalPad = width - str.length;
141
+ if (totalPad <= 0) return str;
142
+ const padLeft = Math.floor(totalPad / 2);
143
+ const padRight = totalPad - padLeft;
144
+ return ' '.repeat(padLeft) + str + ' '.repeat(padRight);
145
+ }
146
+
139
147
  function printTable({ columns, rows }, emptyMessage = 'No records found.', entityName = 'records') {
140
148
  if (!columns || columns.length === 0) return;
141
149
 
@@ -318,10 +326,7 @@ function printTable({ columns, rows }, emptyMessage = 'No records found.', entit
318
326
  emptyMessage.length > totalInnerWidth - 2
319
327
  ? emptyMessage.slice(0, totalInnerWidth - 5) + '...'
320
328
  : emptyMessage;
321
- const padTotal = totalInnerWidth - msg.length;
322
- const padLeft = Math.floor(padTotal / 2);
323
- const padRight = padTotal - padLeft;
324
- console.log(`|${' '.repeat(padLeft)}${msg}${' '.repeat(padRight)}|`);
329
+ console.log(`|${padCenter(msg, totalInnerWidth)}|`);
325
330
  } else {
326
331
  let isFirst = true;
327
332
  for (const row of stringRows) {
@@ -364,13 +369,25 @@ function generateMarkdownSummaryFromReport(reportData) {
364
369
  const titleProject = testRun.projectName || 'Test Automation Project';
365
370
  const titleRun = testRun.testRunName || 'Test Run';
366
371
 
367
- let md = `### 📊 Test Run Summary: ${titleProject} — ${titleRun}\n\n`;
372
+ let md = `\n### 📊 Test Run Summary: ${titleProject} — ${titleRun}\n\n`;
368
373
  md += `**Status:** ${statusStr}\n`;
369
374
  md += `**Duration:** ${durationStr}\n`;
370
375
  md += `**Pass Rate:** ${passRate}%\n\n`;
371
- md += `| Total | Passed | Failed | Timed Out | Skipped |\n`;
372
- md += `| :---: | :---: | :---: | :-------: | :-----: |\n`;
373
- md += `| ${total} | ${passed} | ${failed} | ${timedOut} | ${skipped} |\n`;
376
+
377
+ const headers = ['Total', 'Passed', 'Failed', 'Timed Out', 'Skipped'];
378
+ const values = [String(total), String(passed), String(failed), String(timedOut), String(skipped)];
379
+
380
+ if (interrupted > 0) {
381
+ headers.push('Interrupted');
382
+ values.push(String(interrupted));
383
+ }
384
+
385
+ const widths = headers.map((h, i) => Math.max(h.length, values[i].length, 3));
386
+ const headerRow = `| ${headers.map((h, i) => padCenter(h, widths[i])).join(' | ')} |`;
387
+ const sepRow = `| ${widths.map((w) => ':' + '-'.repeat(w - 2) + ':').join(' | ')} |`;
388
+ const valueRow = `| ${values.map((v, i) => padCenter(v, widths[i])).join(' | ')} |`;
389
+
390
+ md += `${headerRow}\n${sepRow}\n${valueRow}\n`;
374
391
 
375
392
  const failedCases = [];
376
393
  function collectFailedCases(suites) {