@decocms/parity 0.35.0 → 0.35.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/dist/cli.js +50 -18
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -60676,12 +60676,12 @@ Consider to rely on 'then' or 'done' mode instead.`);
|
|
|
60676
60676
|
if (!win.navigator || _typeof(win.navigator) !== "object") {
|
|
60677
60677
|
return {};
|
|
60678
60678
|
}
|
|
60679
|
-
var { navigator, innerHeight, innerWidth } = win;
|
|
60679
|
+
var { navigator, innerHeight: innerHeight2, innerWidth: innerWidth2 } = win;
|
|
60680
60680
|
var _ref90 = getOrientation(win) || {}, { angle, type: type2 } = _ref90;
|
|
60681
60681
|
return {
|
|
60682
60682
|
userAgent: navigator.userAgent,
|
|
60683
|
-
windowWidth:
|
|
60684
|
-
windowHeight:
|
|
60683
|
+
windowWidth: innerWidth2,
|
|
60684
|
+
windowHeight: innerHeight2,
|
|
60685
60685
|
orientationAngle: angle,
|
|
60686
60686
|
orientationType: type2
|
|
60687
60687
|
};
|
|
@@ -117561,10 +117561,12 @@ function capBody(issue, run) {
|
|
|
117561
117561
|
if (issue.expected)
|
|
117562
117562
|
lines.push("", "## Esperado", issue.expected);
|
|
117563
117563
|
const DETAILS = "\x00details\x00";
|
|
117564
|
+
const REPRO = "\x00repro\x00";
|
|
117565
|
+
const HINT = "\x00hint\x00";
|
|
117564
117566
|
if (issue.details)
|
|
117565
117567
|
lines.push("", DETAILS);
|
|
117566
117568
|
if (issue.reproduction)
|
|
117567
|
-
lines.push("", "## Como reproduzir",
|
|
117569
|
+
lines.push("", "## Como reproduzir", REPRO);
|
|
117568
117570
|
const media = (issue.evidence ?? []).filter((e) => (e.kind === "screenshot" || e.kind === "video") && e.path);
|
|
117569
117571
|
if (media.length) {
|
|
117570
117572
|
lines.push("", "## Evidência");
|
|
@@ -117577,23 +117579,29 @@ function capBody(issue, run) {
|
|
|
117577
117579
|
}
|
|
117578
117580
|
}
|
|
117579
117581
|
if (issue.suggestedFix)
|
|
117580
|
-
lines.push("", "## Pista de correção",
|
|
117582
|
+
lines.push("", "## Pista de correção", HINT);
|
|
117581
117583
|
lines.push("", "## Como verificar", issue.verify ?? `Com o build de produção (local: \`build\` + \`preview\`, não o dev server; na revisão: o preview do PR), abrir ${pagePath ? new URL(pagePath, run.url).pathname : "a mesma página"} e confirmar que o observado acima não acontece mais. Colar no card o que foi checado.`);
|
|
117582
117584
|
lines.push("", `_${run.source ?? "parity sweep"} ${run.runId} · ${run.timestamp.slice(0, 10)}_`);
|
|
117583
117585
|
const skeleton = lines.join(`
|
|
117584
117586
|
`);
|
|
117585
|
-
const
|
|
117586
|
-
|
|
117587
|
-
|
|
117588
|
-
|
|
117589
|
-
|
|
117590
|
-
const
|
|
117591
|
-
if (
|
|
117592
|
-
return
|
|
117593
|
-
${
|
|
117594
|
-
|
|
117595
|
-
|
|
117596
|
-
|
|
117587
|
+
const parts = [
|
|
117588
|
+
[DETAILS, issue.details ?? ""],
|
|
117589
|
+
[HINT, issue.suggestedFix ?? ""],
|
|
117590
|
+
[REPRO, issue.reproduction ?? ""]
|
|
117591
|
+
];
|
|
117592
|
+
const full = parts.reduce((t, [k, v]) => t.replace(k, v), skeleton);
|
|
117593
|
+
if (full.length <= CARD_BODY_MAX)
|
|
117594
|
+
return full;
|
|
117595
|
+
const more = run.reportHtml ? `…(cortado — completo em ${run.reportHtml})` : "…(cortado)";
|
|
117596
|
+
let room = CARD_BODY_MAX - parts.reduce((t, [k]) => skeleton.includes(k) ? t - k.length : t, skeleton.length);
|
|
117597
|
+
const kept = new Map;
|
|
117598
|
+
for (const [k, v] of [...parts].reverse()) {
|
|
117599
|
+
const fit = v.length <= room ? v : room > 80 ? `${v.slice(0, room - more.length - 1)}
|
|
117600
|
+
${more}` : room >= more.length ? more : "";
|
|
117601
|
+
kept.set(k, fit);
|
|
117602
|
+
room = Math.max(0, room - fit.length);
|
|
117603
|
+
}
|
|
117604
|
+
return parts.reduce((t, [k]) => t.replace(k, kept.get(k) ?? ""), skeleton);
|
|
117597
117605
|
}
|
|
117598
117606
|
function specSection(issue, run) {
|
|
117599
117607
|
const spec = (issue.evidence ?? []).find((e) => e.kind === "spec");
|
|
@@ -119868,6 +119876,25 @@ async function scoreFrames(page, base, frames) {
|
|
|
119868
119876
|
return out;
|
|
119869
119877
|
}, { base, frames });
|
|
119870
119878
|
}
|
|
119879
|
+
function visibleImagesInPage() {
|
|
119880
|
+
const vw = innerWidth;
|
|
119881
|
+
const vh = innerHeight;
|
|
119882
|
+
return [...document.querySelectorAll("img")].filter((img) => {
|
|
119883
|
+
const r = img.getBoundingClientRect();
|
|
119884
|
+
if (r.width < 120)
|
|
119885
|
+
return false;
|
|
119886
|
+
const x = r.left + r.width / 2;
|
|
119887
|
+
const y = r.top + r.height / 2;
|
|
119888
|
+
if (x < 0 || x >= vw || y < 0 || y >= vh)
|
|
119889
|
+
return false;
|
|
119890
|
+
const top = document.elementFromPoint(x, y);
|
|
119891
|
+
return !!top && (top === img || img.contains(top) || top.contains(img));
|
|
119892
|
+
}).sort((a, b) => {
|
|
119893
|
+
const ra = a.getBoundingClientRect();
|
|
119894
|
+
const rb = b.getBoundingClientRect();
|
|
119895
|
+
return rb.width * rb.height - ra.width * ra.height;
|
|
119896
|
+
}).slice(0, 3).map((img) => (img.currentSrc || img.src).split("/").pop()?.split("?")[0] ?? "");
|
|
119897
|
+
}
|
|
119871
119898
|
var SKELETON = "[class*='skeleton' i], .animate-pulse, [aria-busy='true'], .loading";
|
|
119872
119899
|
async function rerenderCommand(opts) {
|
|
119873
119900
|
if (!opts.selector && !opts.text) {
|
|
@@ -119948,6 +119975,7 @@ async function rerenderCommand(opts) {
|
|
|
119948
119975
|
await cdp.send("Page.startScreencast", { format: "jpeg", quality: 50, everyNthFrame: 1 });
|
|
119949
119976
|
await page.waitForTimeout(400);
|
|
119950
119977
|
const target = (opts.selector ? page.locator(opts.selector) : page.getByText(opts.text, { exact: true })).filter({ visible: true }).first();
|
|
119978
|
+
const imagesBefore = await page.evaluate(visibleImagesInPage).catch(() => []);
|
|
119951
119979
|
t0 = Date.now();
|
|
119952
119980
|
const clicked = await target.click({ timeout: 5000 }).then(() => true).catch(() => false);
|
|
119953
119981
|
if (!clicked) {
|
|
@@ -119959,6 +119987,7 @@ async function rerenderCommand(opts) {
|
|
|
119959
119987
|
return;
|
|
119960
119988
|
});
|
|
119961
119989
|
page.off("request", onReq);
|
|
119990
|
+
const imagesAfter = await page.evaluate(visibleImagesInPage).catch(() => []);
|
|
119962
119991
|
const dom = await page.evaluate(() => {
|
|
119963
119992
|
const w = window;
|
|
119964
119993
|
const before = w.__before;
|
|
@@ -119993,7 +120022,8 @@ async function rerenderCommand(opts) {
|
|
|
119993
120022
|
skeletons: Object.entries(dom.skeletons).map(([region, count]) => ({ region, count })),
|
|
119994
120023
|
flashes,
|
|
119995
120024
|
settledAt,
|
|
119996
|
-
frames: post.length
|
|
120025
|
+
frames: post.length,
|
|
120026
|
+
visibleImages: { before: imagesBefore, after: imagesAfter }
|
|
119997
120027
|
};
|
|
119998
120028
|
if (opts.sheet && base) {
|
|
119999
120029
|
const pick = new Set([0]);
|
|
@@ -120045,6 +120075,8 @@ async function rerenderCommand(opts) {
|
|
|
120045
120075
|
console.log(` ${r.remounted ? chalk41.red("REMOUNTED") : "changed "} ${r.region.padEnd(48)} +${r.added}/-${r.removed} attrs ${r.attrs} text ${r.text}`);
|
|
120046
120076
|
for (const s of report.skeletons)
|
|
120047
120077
|
console.log(chalk41.yellow(` skeletons ×${s.count} in ${s.region}`));
|
|
120078
|
+
const [b0, a0] = [report.visibleImages.before[0], report.visibleImages.after[0]];
|
|
120079
|
+
console.log(b0 === a0 ? ` main visible image unchanged: ${a0 ?? "none"}` : ` main visible image: ${b0 ?? "none"} → ${a0 ?? "none"}`);
|
|
120048
120080
|
for (const f of flashes)
|
|
120049
120081
|
console.log(chalk41.red(` white flash +${f.from}–${f.to}ms (peak ${f.peakWhite.toFixed(0)}% white)`));
|
|
120050
120082
|
console.log(chalk41.dim(` settled at +${settledAt ?? "?"}ms · ${post.length} frames${opts.sheet ? ` · sheet ${opts.sheet}` : ""}`));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/parity",
|
|
3
|
-
"version": "0.35.
|
|
3
|
+
"version": "0.35.2",
|
|
4
4
|
"description": "E2E parity validator for site migrations. Compares prod vs cand and reports UI, functional, SEO, visual, and Web Vitals deltas with an LLM-ranked HTML report.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|