@sentinelqa/playwright-reporter 0.1.14 → 0.1.16

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.
Files changed (2) hide show
  1. package/dist/localReport.js +56 -92
  2. package/package.json +1 -1
@@ -254,22 +254,9 @@ const renderArtifact = (artifact) => {
254
254
  const label = escapeHtml(artifact.label);
255
255
  if (artifact.kind === "trace") {
256
256
  return `
257
- <div class="artifact-link artifact-link-trace">
258
- <div class="artifact-trace-row">
259
- <div class="artifact-trace-meta">
260
- <span class="artifact-kind">Trace</span>
261
- <a href="${href}" target="_blank" rel="noreferrer">${label}</a>
262
- </div>
263
- <a
264
- class="trace-button"
265
- href="${href}"
266
- target="_blank"
267
- rel="noreferrer"
268
- data-trace-path="${href}"
269
- >
270
- View Trace
271
- </a>
272
- </div>
257
+ <div class="artifact-link">
258
+ <span class="artifact-kind">Trace</span>
259
+ <a href="${href}" target="_blank" rel="noreferrer">${label}</a>
273
260
  </div>
274
261
  `;
275
262
  }
@@ -342,7 +329,7 @@ const renderTestCard = (test) => {
342
329
  };
343
330
  const renderAdditionalArtifacts = (artifacts) => {
344
331
  if (artifacts.length === 0) {
345
- return `<div class="empty-state">No additional Playwright artifacts were detected.</div>`;
332
+ return "";
346
333
  }
347
334
  return `
348
335
  <div class="artifact-list">
@@ -359,6 +346,27 @@ const renderAdditionalArtifacts = (artifacts) => {
359
346
  </div>
360
347
  `;
361
348
  };
349
+ const tryMapRemainingArtifactsToTests = (tests, artifactPaths, reportDir, usedRelativePaths, claimedSourcePaths) => {
350
+ const candidateTests = tests.filter((test) => ["failed", "timedOut", "interrupted"].includes(test.status));
351
+ const preferredKinds = ["screenshot", "video", "trace", "log", "network"];
352
+ for (const kind of preferredKinds) {
353
+ const pathsForKind = artifactPaths.filter((filePath) => !claimedSourcePaths.has(path_1.default.resolve(filePath)) && classifyArtifact(filePath) === kind);
354
+ let cursor = 0;
355
+ for (const test of candidateTests) {
356
+ const alreadyHasKind = test.artifacts.some((artifact) => artifact.kind === kind);
357
+ if (alreadyHasKind)
358
+ continue;
359
+ const nextPath = pathsForKind[cursor];
360
+ if (!nextPath)
361
+ break;
362
+ const resolved = path_1.default.resolve(nextPath);
363
+ const artifact = copyArtifact(resolved, kind, reportDir, usedRelativePaths, test.id);
364
+ test.artifacts.push(artifact);
365
+ claimedSourcePaths.add(resolved);
366
+ cursor += 1;
367
+ }
368
+ }
369
+ };
362
370
  const buildHtml = (tests, summary, extraArtifacts) => {
363
371
  const failedTests = tests.filter((test) => ["failed", "timedOut", "interrupted"].includes(test.status));
364
372
  const generatedAt = new Date().toLocaleString();
@@ -535,9 +543,6 @@ const buildHtml = (tests, summary, extraArtifacts) => {
535
543
  background: rgba(9, 13, 20, 0.9);
536
544
  padding: 12px;
537
545
  }
538
- .artifact-link-trace {
539
- padding: 14px;
540
- }
541
546
  .artifact-card img, .artifact-card video {
542
547
  width: 100%;
543
548
  border-radius: 10px;
@@ -562,42 +567,18 @@ const buildHtml = (tests, summary, extraArtifacts) => {
562
567
  text-transform: uppercase;
563
568
  letter-spacing: 0.08em;
564
569
  }
565
- .artifact-trace-row {
566
- display: flex;
567
- justify-content: space-between;
568
- gap: 12px;
569
- align-items: center;
570
- }
571
- .artifact-trace-meta {
572
- display: flex;
573
- gap: 10px;
574
- align-items: center;
575
- flex-wrap: wrap;
576
- }
577
- .trace-button {
578
- display: inline-flex;
579
- align-items: center;
580
- justify-content: center;
581
- padding: 8px 12px;
582
- border-radius: 999px;
583
- border: 1px solid rgba(125, 211, 252, 0.28);
584
- background: rgba(125, 211, 252, 0.08);
585
- color: var(--accent);
586
- font-size: 12px;
587
- font-weight: 600;
588
- text-transform: uppercase;
589
- letter-spacing: 0.06em;
590
- white-space: nowrap;
591
- }
592
- .trace-button:hover {
593
- text-decoration: none;
594
- background: rgba(125, 211, 252, 0.14);
595
- }
596
570
  .artifact-list {
597
571
  display: grid;
598
572
  gap: 12px;
599
573
  margin-top: 16px;
600
574
  }
575
+ .section-shell ul {
576
+ margin: 12px 0 0 18px;
577
+ color: var(--text);
578
+ }
579
+ .section-shell li {
580
+ margin-top: 6px;
581
+ }
601
582
  .empty-state {
602
583
  color: var(--muted);
603
584
  border: 1px dashed rgba(39, 48, 66, 0.9);
@@ -626,10 +607,6 @@ const buildHtml = (tests, summary, extraArtifacts) => {
626
607
  }
627
608
  .test-summary { flex-direction: column; }
628
609
  .meta-stack { min-width: 0; }
629
- .artifact-trace-row {
630
- flex-direction: column;
631
- align-items: flex-start;
632
- }
633
610
  }
634
611
  </style>
635
612
  </head>
@@ -676,49 +653,28 @@ const buildHtml = (tests, summary, extraArtifacts) => {
676
653
  <section class="section-shell">
677
654
  <h2>Additional Artifacts</h2>
678
655
  <p>Artifacts collected from Playwright output folders that were not directly attached to a single test.</p>
679
- ${renderAdditionalArtifacts(extraArtifacts)}
656
+ ${extraArtifacts.length > 0
657
+ ? renderAdditionalArtifacts(extraArtifacts)
658
+ : `<div class="empty-state">All detected artifacts were mapped onto failed tests.</div>`}
680
659
  </section>
681
660
 
682
661
  <section class="section-shell">
683
662
  <h2>Optional: Sentinel Cloud</h2>
684
- <div class="panel">
685
- <p>Upload runs to Sentinel Cloud for:</p>
686
- <ul>
687
- <li>CI history</li>
688
- <li>shareable run links</li>
689
- <li>AI failure summaries</li>
690
- </ul>
691
- <p>
692
- <a href="${SENTINEL_URL}" target="_blank" rel="noreferrer">More on sentinelqa.com</a>
693
- </p>
694
- </div>
663
+ <p>Upload runs to Sentinel Cloud for:</p>
664
+ <ul>
665
+ <li>CI history</li>
666
+ <li>shareable run links</li>
667
+ <li>AI failure summaries</li>
668
+ </ul>
669
+ <p>
670
+ <a href="${SENTINEL_URL}" target="_blank" rel="noreferrer">More on sentinelqa.com</a>
671
+ </p>
695
672
  </section>
696
673
 
697
674
  <footer>
698
675
  Generated by <a href="${SENTINEL_URL}" target="_blank" rel="noreferrer">Sentinel Playwright Reporter</a>.
699
676
  </footer>
700
677
  </div>
701
- <script>
702
- (function () {
703
- var traceButtons = document.querySelectorAll("[data-trace-path]");
704
- traceButtons.forEach(function (button) {
705
- var tracePath = button.getAttribute("data-trace-path");
706
- if (!tracePath) return;
707
-
708
- try {
709
- if (window.location.protocol === "http:" || window.location.protocol === "https:") {
710
- var traceUrl = new URL(tracePath, window.location.href).href;
711
- button.setAttribute(
712
- "href",
713
- "https://trace.playwright.dev/?trace=" + encodeURIComponent(traceUrl)
714
- );
715
- }
716
- } catch (_error) {
717
- // Fall back to the raw trace zip link when URL construction fails.
718
- }
719
- });
720
- })();
721
- </script>
722
678
  </body>
723
679
  </html>`;
724
680
  };
@@ -768,17 +724,25 @@ function generateLocalDebugReport(options) {
768
724
  }
769
725
  }
770
726
  }
771
- const extraArtifacts = [];
727
+ const discoveredArtifactPaths = [];
772
728
  for (const sourceDir of sourceDirs) {
773
729
  for (const filePath of listFilesRecursive(sourceDir)) {
774
730
  const resolved = path_1.default.resolve(filePath);
775
731
  if (claimedSourcePaths.has(resolved))
776
732
  continue;
777
- const artifact = copyArtifact(resolved, classifyArtifact(resolved), reportDir, usedRelativePaths, null);
778
- claimedSourcePaths.add(resolved);
779
- extraArtifacts.push(artifact);
733
+ discoveredArtifactPaths.push(resolved);
780
734
  }
781
735
  }
736
+ tryMapRemainingArtifactsToTests(tests, discoveredArtifactPaths, reportDir, usedRelativePaths, claimedSourcePaths);
737
+ const extraArtifacts = [];
738
+ for (const filePath of discoveredArtifactPaths) {
739
+ const resolved = path_1.default.resolve(filePath);
740
+ if (claimedSourcePaths.has(resolved))
741
+ continue;
742
+ const artifact = copyArtifact(resolved, classifyArtifact(resolved), reportDir, usedRelativePaths, null);
743
+ claimedSourcePaths.add(resolved);
744
+ extraArtifacts.push(artifact);
745
+ }
782
746
  const summary = summarizeTests(tests);
783
747
  const html = buildHtml(tests, summary, extraArtifacts);
784
748
  fs_1.default.writeFileSync(reportHtmlPath, html, "utf8");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentinelqa/playwright-reporter",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "private": false,
5
5
  "description": "Playwright reporter for CI debugging with optional Sentinel cloud dashboards",
6
6
  "license": "MIT",