@arpanp/zen-reporter 0.11.1 → 0.11.2
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 +2 -2
- package/bin/zen-reporter.js +25 -8
- package/dist/index.html +2 -2
- package/package.json +14 -5
- package/docs/screenshots/dark-mode.png +0 -0
- package/docs/screenshots/light-mode.png +0 -0
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
|
-

|
|
11
|
+

|
|
12
12
|
|
|
13
13
|
Dark mode:
|
|
14
14
|
|
|
15
|
-

|
|
15
|
+

|
|
16
16
|
|
|
17
17
|
## Features
|
|
18
18
|
|
package/bin/zen-reporter.js
CHANGED
|
@@ -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
|
-
|
|
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 =
|
|
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
|
-
|
|
372
|
-
|
|
373
|
-
|
|
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) {
|