@reportforge/playwright-pdf 0.3.1 → 0.4.0

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.
@@ -25,6 +25,8 @@
25
25
 
26
26
  {{> failure-deep-dive options=(obj showFullFailures=true showStackTraces=true) }}
27
27
 
28
+ {{> failure-analysis}}
29
+
28
30
  {{> slow-tests limit=10 showProject=true}}
29
31
 
30
32
  {{> defect-log }}
@@ -4,6 +4,8 @@
4
4
 
5
5
  {{> cover-page}}
6
6
 
7
+ {{> analysis-oneliner}}
8
+
7
9
  <div class="report-header">
8
10
  <div class="report-header__left">
9
11
  {{#if meta.branding.logoBase64}}
@@ -0,0 +1,3 @@
1
+ {{#if analysis.oneLiner}}
2
+ <div class="analysis-oneliner">{{analysis.oneLiner}}</div>
3
+ {{/if}}
@@ -0,0 +1,42 @@
1
+ {{#if analysis.clusters.length}}
2
+ <section class="failure-analysis">
3
+ <h2>Failure Analysis</h2>
4
+ <p class="oneliner">{{analysis.oneLiner}}</p>
5
+
6
+ {{#if analysis.truncated}}
7
+ <p class="analysis-truncated">
8
+ Showing analysis of the first {{analysis.analysedCount}} of {{analysis.totalFailures}} failures.
9
+ Raise <code>failureAnalysis.maxFailuresToAnalyse</code> for full coverage.
10
+ </p>
11
+ {{/if}}
12
+
13
+ {{#each analysis.clusters}}
14
+ <div class="cluster cluster--{{category}}">
15
+ <div class="cluster-header">
16
+ <span class="cluster-category">{{categoryLabel category}}</span>
17
+ <span class="cluster-count">{{count}} {{pluralise count "test" "tests"}}</span>
18
+ <span class="cluster-strength cluster-strength--{{strength}}">{{strengthLabel strength}} match</span>
19
+ </div>
20
+
21
+ {{#if stackFrame}}
22
+ <div class="cluster-frame"><code>{{stackFrame}}</code></div>
23
+ {{/if}}
24
+
25
+ <div class="cluster-message">{{representativeMessage}}</div>
26
+
27
+ <ul class="cluster-tests">
28
+ {{#each (take tests 5)}}
29
+ <li>{{this}}</li>
30
+ {{/each}}
31
+ {{#if (gt testsTotal 5)}}
32
+ <li class="more">+{{subtract testsTotal 5}} more</li>
33
+ {{/if}}
34
+ </ul>
35
+
36
+ {{#if (eq strength "weak")}}
37
+ <p class="confidence-warning">* Weak match — manual review recommended</p>
38
+ {{/if}}
39
+ </div>
40
+ {{/each}}
41
+ </section>
42
+ {{/if}}
@@ -232,3 +232,6 @@ code {
232
232
  background: rgba(255,255,255,0.6); padding: 1px 4px; border-radius: 2px;
233
233
  border: none;
234
234
  }
235
+
236
+ /* ── Failure-analysis one-liner — shared by detailed + executive templates ── */
237
+ .analysis-oneliner { font-size: 0.9em; opacity: 0.9; margin-top: 4px; }
@@ -408,5 +408,26 @@
408
408
  -webkit-print-color-adjust: exact;
409
409
  }
410
410
 
411
+ /* ── Failure Analysis ───────────────────────────────────────────────────── */
412
+ /* NOTE: .analysis-oneliner lives in base.css — the executive template renders it too. */
413
+ .failure-analysis { margin-top: 24px; }
414
+ .failure-analysis .oneliner { font-weight: 600; }
415
+ .analysis-truncated { font-size: 0.85em; opacity: 0.8; }
416
+
417
+ .cluster { border-left: 3px solid; padding-left: 12px; margin-bottom: 16px; }
418
+ .cluster-header { display: flex; gap: 12px; align-items: baseline; }
419
+ .cluster-strength--strong { color: oklch(55% 0.15 145); }
420
+ .cluster-strength--moderate { color: oklch(60% 0.18 65); }
421
+ .cluster-strength--weak { color: oklch(55% 0.20 25); }
422
+ .cluster--timeout { border-color: oklch(60% 0.18 65); }
423
+ .cluster--assertion { border-color: oklch(55% 0.20 25); }
424
+ .cluster--locator-not-found { border-color: oklch(55% 0.20 25); }
425
+ .cluster--network { border-color: oklch(55% 0.15 260); }
426
+ .cluster--navigation { border-color: oklch(55% 0.15 260); }
427
+ .cluster--flaky-by-retry { border-color: oklch(55% 0.15 290); }
428
+ .cluster--env-config { border-color: oklch(55% 0.15 145); }
429
+ .cluster--unknown { border-color: oklch(60% 0.00 0); }
430
+ .confidence-warning { font-size: 0.8em; opacity: 0.75; }
431
+
411
432
  </content>
412
433
  </invoke>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reportforge/playwright-pdf",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "Enterprise-ready PDF reports for Playwright Test — minimal, detailed, and executive templates with CI/CD integrations",
5
5
  "license": "MIT",
6
6
  "author": "ReportForge",
@@ -34,7 +34,8 @@
34
34
  }
35
35
  },
36
36
  "bin": {
37
- "reportforge-demo": "./dist/demo/cli.js"
37
+ "reportforge-demo": "./dist/demo/cli.js",
38
+ "reportforge-export-feedback": "./dist/cli/export-feedback.js"
38
39
  },
39
40
  "publishConfig": {
40
41
  "access": "public"
@@ -47,12 +48,13 @@
47
48
  "LICENSE"
48
49
  ],
49
50
  "scripts": {
50
- "prebuild": "npm run bundle-chartjs && npm run bundle-fonts && npm run bundle-pubkey && npm run precompile-templates",
51
+ "prebuild": "npm run bundle-chartjs && npm run bundle-fonts && npm run bundle-pubkey && npm run bundle-model && npm run precompile-templates",
51
52
  "build": "tsup && npm run copy-templates",
52
53
  "copy-templates": "node -e \"const fs=require('fs');const path=require('path');fs.cpSync('src/templates',path.join('dist','templates'),{recursive:true,filter:p=>!p.endsWith('.ts')});\"",
53
54
  "bundle-chartjs": "tsx scripts/build/bundle-chartjs.ts",
54
55
  "bundle-fonts": "tsx scripts/build/bundle-fonts.ts",
55
56
  "bundle-pubkey": "tsx scripts/build/bundle-license-pubkey.ts",
57
+ "bundle-model": "tsx scripts/build/bundle-model.ts",
56
58
  "precompile-templates": "tsx scripts/build/precompile-templates.ts",
57
59
  "dev": "tsup --watch",
58
60
  "test": "vitest run",
@@ -63,6 +65,9 @@
63
65
  "typecheck": "tsc --noEmit",
64
66
  "prepublishOnly": "npm run typecheck && npm run test && npm run build",
65
67
  "generate-license": "tsx scripts/generate-license.ts",
68
+ "ml:train": "cd scripts/ml && python train.py",
69
+ "ml:evaluate": "cd scripts/ml && python evaluate.py",
70
+ "ml:harvest": "tsx scripts/ml/harvest.ts",
66
71
  "snapshot-png": "tsx scripts/snapshot-png.ts",
67
72
  "docs:gen": "tsx scripts/docs/sync-docs.ts --write",
68
73
  "check:docs": "tsx scripts/docs/sync-docs.ts --check"