@sentinelqa/playwright-reporter 0.1.14 → 0.1.15
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/dist/localReport.js +53 -17
- package/package.json +1 -1
package/dist/localReport.js
CHANGED
|
@@ -342,7 +342,7 @@ const renderTestCard = (test) => {
|
|
|
342
342
|
};
|
|
343
343
|
const renderAdditionalArtifacts = (artifacts) => {
|
|
344
344
|
if (artifacts.length === 0) {
|
|
345
|
-
return
|
|
345
|
+
return "";
|
|
346
346
|
}
|
|
347
347
|
return `
|
|
348
348
|
<div class="artifact-list">
|
|
@@ -359,6 +359,27 @@ const renderAdditionalArtifacts = (artifacts) => {
|
|
|
359
359
|
</div>
|
|
360
360
|
`;
|
|
361
361
|
};
|
|
362
|
+
const tryMapRemainingArtifactsToTests = (tests, artifactPaths, reportDir, usedRelativePaths, claimedSourcePaths) => {
|
|
363
|
+
const candidateTests = tests.filter((test) => ["failed", "timedOut", "interrupted"].includes(test.status));
|
|
364
|
+
const preferredKinds = ["screenshot", "video", "trace", "log", "network"];
|
|
365
|
+
for (const kind of preferredKinds) {
|
|
366
|
+
const pathsForKind = artifactPaths.filter((filePath) => !claimedSourcePaths.has(path_1.default.resolve(filePath)) && classifyArtifact(filePath) === kind);
|
|
367
|
+
let cursor = 0;
|
|
368
|
+
for (const test of candidateTests) {
|
|
369
|
+
const alreadyHasKind = test.artifacts.some((artifact) => artifact.kind === kind);
|
|
370
|
+
if (alreadyHasKind)
|
|
371
|
+
continue;
|
|
372
|
+
const nextPath = pathsForKind[cursor];
|
|
373
|
+
if (!nextPath)
|
|
374
|
+
break;
|
|
375
|
+
const resolved = path_1.default.resolve(nextPath);
|
|
376
|
+
const artifact = copyArtifact(resolved, kind, reportDir, usedRelativePaths, test.id);
|
|
377
|
+
test.artifacts.push(artifact);
|
|
378
|
+
claimedSourcePaths.add(resolved);
|
|
379
|
+
cursor += 1;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
};
|
|
362
383
|
const buildHtml = (tests, summary, extraArtifacts) => {
|
|
363
384
|
const failedTests = tests.filter((test) => ["failed", "timedOut", "interrupted"].includes(test.status));
|
|
364
385
|
const generatedAt = new Date().toLocaleString();
|
|
@@ -598,6 +619,13 @@ const buildHtml = (tests, summary, extraArtifacts) => {
|
|
|
598
619
|
gap: 12px;
|
|
599
620
|
margin-top: 16px;
|
|
600
621
|
}
|
|
622
|
+
.section-shell ul {
|
|
623
|
+
margin: 12px 0 0 18px;
|
|
624
|
+
color: var(--text);
|
|
625
|
+
}
|
|
626
|
+
.section-shell li {
|
|
627
|
+
margin-top: 6px;
|
|
628
|
+
}
|
|
601
629
|
.empty-state {
|
|
602
630
|
color: var(--muted);
|
|
603
631
|
border: 1px dashed rgba(39, 48, 66, 0.9);
|
|
@@ -676,22 +704,22 @@ const buildHtml = (tests, summary, extraArtifacts) => {
|
|
|
676
704
|
<section class="section-shell">
|
|
677
705
|
<h2>Additional Artifacts</h2>
|
|
678
706
|
<p>Artifacts collected from Playwright output folders that were not directly attached to a single test.</p>
|
|
679
|
-
${
|
|
707
|
+
${extraArtifacts.length > 0
|
|
708
|
+
? renderAdditionalArtifacts(extraArtifacts)
|
|
709
|
+
: `<div class="empty-state">All detected artifacts were mapped onto failed tests.</div>`}
|
|
680
710
|
</section>
|
|
681
711
|
|
|
682
712
|
<section class="section-shell">
|
|
683
713
|
<h2>Optional: Sentinel Cloud</h2>
|
|
684
|
-
<
|
|
685
|
-
|
|
686
|
-
<
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
<
|
|
692
|
-
|
|
693
|
-
</p>
|
|
694
|
-
</div>
|
|
714
|
+
<p>Upload runs to Sentinel Cloud for:</p>
|
|
715
|
+
<ul>
|
|
716
|
+
<li>CI history</li>
|
|
717
|
+
<li>shareable run links</li>
|
|
718
|
+
<li>AI failure summaries</li>
|
|
719
|
+
</ul>
|
|
720
|
+
<p>
|
|
721
|
+
<a href="${SENTINEL_URL}" target="_blank" rel="noreferrer">More on sentinelqa.com</a>
|
|
722
|
+
</p>
|
|
695
723
|
</section>
|
|
696
724
|
|
|
697
725
|
<footer>
|
|
@@ -768,17 +796,25 @@ function generateLocalDebugReport(options) {
|
|
|
768
796
|
}
|
|
769
797
|
}
|
|
770
798
|
}
|
|
771
|
-
const
|
|
799
|
+
const discoveredArtifactPaths = [];
|
|
772
800
|
for (const sourceDir of sourceDirs) {
|
|
773
801
|
for (const filePath of listFilesRecursive(sourceDir)) {
|
|
774
802
|
const resolved = path_1.default.resolve(filePath);
|
|
775
803
|
if (claimedSourcePaths.has(resolved))
|
|
776
804
|
continue;
|
|
777
|
-
|
|
778
|
-
claimedSourcePaths.add(resolved);
|
|
779
|
-
extraArtifacts.push(artifact);
|
|
805
|
+
discoveredArtifactPaths.push(resolved);
|
|
780
806
|
}
|
|
781
807
|
}
|
|
808
|
+
tryMapRemainingArtifactsToTests(tests, discoveredArtifactPaths, reportDir, usedRelativePaths, claimedSourcePaths);
|
|
809
|
+
const extraArtifacts = [];
|
|
810
|
+
for (const filePath of discoveredArtifactPaths) {
|
|
811
|
+
const resolved = path_1.default.resolve(filePath);
|
|
812
|
+
if (claimedSourcePaths.has(resolved))
|
|
813
|
+
continue;
|
|
814
|
+
const artifact = copyArtifact(resolved, classifyArtifact(resolved), reportDir, usedRelativePaths, null);
|
|
815
|
+
claimedSourcePaths.add(resolved);
|
|
816
|
+
extraArtifacts.push(artifact);
|
|
817
|
+
}
|
|
782
818
|
const summary = summarizeTests(tests);
|
|
783
819
|
const html = buildHtml(tests, summary, extraArtifacts);
|
|
784
820
|
fs_1.default.writeFileSync(reportHtmlPath, html, "utf8");
|