@decocms/parity 0.35.30 → 0.35.31
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/CHANGELOG.md +8 -0
- package/dist/cli.js +388 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
|
9
9
|
|
|
10
10
|
### Added
|
|
11
11
|
|
|
12
|
+
* **`click-blocker-parity` check (visual module)** answers "can the user click the page on the
|
|
13
|
+
candidate where they can on prod?". `capturePage` now samples a 5x5 grid of viewport points
|
|
14
|
+
with `elementFromPoint` (one `page.evaluate`, at first-visit state, before the autoscroll and
|
|
15
|
+
before any consent dismissal) and records the overlay each hit belongs to, whether it paints,
|
|
16
|
+
and what sits beneath it. An overlay that swallows clicks on cand only is `high` when it paints
|
|
17
|
+
nothing (a transparent layer is invisible to every pixel check), and also `high` when it is a
|
|
18
|
+
visible modal or scrim blocking at least half the grid (`visibleBlockHighShare`); `medium` below. New optional `PageCapture.clickProbe`; older recordings and `--golden` files
|
|
19
|
+
parse unchanged and judge inconclusive for this check. Tolerances in `TOLERANCES.clickProbe`.
|
|
12
20
|
* **`parity run --record <dir>`** saves the exact input the checks ran on (captures with
|
|
13
21
|
html, resolved config, visual probes, screenshots incl. the prod noise-floor frame, and the
|
|
14
22
|
fetches the checks made) as a versioned recording, the input a later replay needs. The run's
|
package/dist/cli.js
CHANGED
|
@@ -76806,6 +76806,44 @@ var TOLERANCES = {
|
|
|
76806
76806
|
note: "A page-height difference at or above this is `high`: a block of content is missing or extra."
|
|
76807
76807
|
}
|
|
76808
76808
|
},
|
|
76809
|
+
clickProbe: {
|
|
76810
|
+
gridCols: {
|
|
76811
|
+
value: 5,
|
|
76812
|
+
unit: "count",
|
|
76813
|
+
basis: "assumed",
|
|
76814
|
+
note: "Columns of the click-probe grid, sampled at the centres of equal cells (x = 10/30/50/70/90% of the viewport). 5x5 = 25 points: enough that a banner strip or a centred modal shows up as several points, few enough that one `elementsFromPoint` pass costs milliseconds. Not calibrated against real storefronts."
|
|
76815
|
+
},
|
|
76816
|
+
gridRows: {
|
|
76817
|
+
value: 5,
|
|
76818
|
+
unit: "count",
|
|
76819
|
+
basis: "assumed",
|
|
76820
|
+
note: "Rows of the click-probe grid (y = 10/30/50/70/90% of the viewport). Same reasoning as gridCols. The grid is part of what a recording stores, so changing it makes older recordings inconclusive for this check (point counts differ), not wrong."
|
|
76821
|
+
},
|
|
76822
|
+
overlayMinCoverage: {
|
|
76823
|
+
value: 0.5,
|
|
76824
|
+
unit: "ratio (0-1)",
|
|
76825
|
+
basis: "assumed",
|
|
76826
|
+
note: "An overlay counts as page-blocking at a point when its box covers at least this share of the viewport. A sticky header, a chat bubble or a back-to-top button covers a few percent; a backdrop, a drawer scrim or a full-screen wrapper covers most of it. A half-viewport side drawer sits right on the line, on purpose."
|
|
76827
|
+
},
|
|
76828
|
+
blockedShareMin: {
|
|
76829
|
+
value: 0.2,
|
|
76830
|
+
unit: "ratio (0-1)",
|
|
76831
|
+
basis: "assumed",
|
|
76832
|
+
note: "Share of grid points newly blocked on cand (not blocked on prod) at which click-blocker-parity files a finding: 5 of 25. Below it the difference is a thin strip (an edge-hugging bar a few px taller), which the grid cannot tell from sampling noise."
|
|
76833
|
+
},
|
|
76834
|
+
visibleBlockHighShare: {
|
|
76835
|
+
value: 0.5,
|
|
76836
|
+
unit: "ratio (0-1)",
|
|
76837
|
+
basis: "assumed",
|
|
76838
|
+
note: "Share of grid points newly blocked on cand by a VISIBLE overlay at which click-blocker-parity files high instead of medium. At a majority of the viewport the page is unusable until the overlay is dismissed, and prod does not ask for that; the probe cannot verify the overlay offers a way to dismiss it (a confirm button can itself be nearly illegible), so 'the user can close it' is not assumed. Below it, down to blockedShareMin, the finding stays medium."
|
|
76839
|
+
},
|
|
76840
|
+
paintAlpha: {
|
|
76841
|
+
value: 0.05,
|
|
76842
|
+
unit: "alpha (0-1)",
|
|
76843
|
+
basis: "assumed",
|
|
76844
|
+
note: "A background, border or `::backdrop` colour with alpha below this, or an element chain whose opacity multiplies down below it, is treated as painting nothing. Matches 'nearly invisible' (a confirm button at opacity 0.02) without calling a faint tint invisible. Baked into the recorded `paints` flag, so changing it applies to new captures only."
|
|
76845
|
+
}
|
|
76846
|
+
},
|
|
76809
76847
|
geometry: {
|
|
76810
76848
|
subpixelPx: {
|
|
76811
76849
|
value: 1,
|
|
@@ -78360,6 +78398,154 @@ function detailFor(prod, cand, viewport) {
|
|
|
78360
78398
|
`);
|
|
78361
78399
|
}
|
|
78362
78400
|
|
|
78401
|
+
// src/checks/click-blocker-parity.ts
|
|
78402
|
+
var MIN_COVERAGE = TOLERANCES.clickProbe.overlayMinCoverage.value;
|
|
78403
|
+
var MIN_SHARE = TOLERANCES.clickProbe.blockedShareMin.value;
|
|
78404
|
+
var HIGH_VISIBLE_SHARE = TOLERANCES.clickProbe.visibleBlockHighShare.value;
|
|
78405
|
+
function clickBlockerParity(ctx) {
|
|
78406
|
+
const start = Date.now();
|
|
78407
|
+
const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
|
|
78408
|
+
const issues = [];
|
|
78409
|
+
const judged = [];
|
|
78410
|
+
const unjudged = [];
|
|
78411
|
+
for (const pair of pairs) {
|
|
78412
|
+
const why = unjudgeable(pair.prod.clickProbe, pair.cand.clickProbe);
|
|
78413
|
+
if (why) {
|
|
78414
|
+
unjudged.push(pair.key);
|
|
78415
|
+
issues.push({
|
|
78416
|
+
id: `click-blocker:no-probe:${pair.key}`,
|
|
78417
|
+
severity: "low",
|
|
78418
|
+
inconclusive: true,
|
|
78419
|
+
category: "functional",
|
|
78420
|
+
page: pair.key,
|
|
78421
|
+
check: "click-blocker-parity",
|
|
78422
|
+
summary: `[${pair.viewport}] ${pair.key}: click probe unavailable (${why}) — not compared by click-blocker-parity`,
|
|
78423
|
+
details: "Without a probe on both sides there is nothing to compare, and absence is not evidence that nothing blocks clicks. Re-capture with a current parity."
|
|
78424
|
+
});
|
|
78425
|
+
continue;
|
|
78426
|
+
}
|
|
78427
|
+
judged.push(pair.key);
|
|
78428
|
+
issues.push(...judgePair(pair));
|
|
78429
|
+
}
|
|
78430
|
+
const live = issues.filter((i) => !i.inconclusive);
|
|
78431
|
+
const compared = judged.length;
|
|
78432
|
+
const status = live.some((i) => i.severity === "high" || i.severity === "critical") ? "fail" : live.length > 0 ? "warn" : compared === 0 ? "skipped" : "pass";
|
|
78433
|
+
const summary = compared === 0 ? `nothing compared: ${pairs.length === 0 ? "no prod x cand page pairs" : `${unjudged.length} of ${pairs.length} page pair(s) had no click probe on a side`}` : `${compared} page pair(s) compared, ${live.length} click-blocking finding(s)${unjudged.length ? `, ${unjudged.length} without a probe` : ""}`;
|
|
78434
|
+
return {
|
|
78435
|
+
name: "click-blocker-parity",
|
|
78436
|
+
status,
|
|
78437
|
+
severity: "high",
|
|
78438
|
+
durationMs: Date.now() - start,
|
|
78439
|
+
summary,
|
|
78440
|
+
issues,
|
|
78441
|
+
...unitCounts({
|
|
78442
|
+
unit: "page-pair",
|
|
78443
|
+
judged,
|
|
78444
|
+
unjudged,
|
|
78445
|
+
issues,
|
|
78446
|
+
informational: (i) => i.id.startsWith("click-blocker:prod-only:")
|
|
78447
|
+
}),
|
|
78448
|
+
data: { pairs: pairs.length, compared, withoutProbe: unjudged.length }
|
|
78449
|
+
};
|
|
78450
|
+
}
|
|
78451
|
+
function unjudgeable(prod, cand) {
|
|
78452
|
+
if (!prod || !cand)
|
|
78453
|
+
return `no probe on ${!prod && !cand ? "either side" : !prod ? "prod" : "cand"}`;
|
|
78454
|
+
if (prod.points.length === 0 || cand.points.length === 0)
|
|
78455
|
+
return "probe sampled no points";
|
|
78456
|
+
if (prod.points.length !== cand.points.length)
|
|
78457
|
+
return "grids differ between sides";
|
|
78458
|
+
return null;
|
|
78459
|
+
}
|
|
78460
|
+
function isBlocked(p) {
|
|
78461
|
+
return p.overlay !== null && p.overlay.coverage >= MIN_COVERAGE && p.pointerEvents !== "none" && p.under !== null;
|
|
78462
|
+
}
|
|
78463
|
+
function judgePair(pair) {
|
|
78464
|
+
const prodPts = pair.prod.clickProbe?.points ?? [];
|
|
78465
|
+
const candPts = pair.cand.clickProbe?.points ?? [];
|
|
78466
|
+
const n = candPts.length;
|
|
78467
|
+
const newInvisible = [];
|
|
78468
|
+
const newVisible = [];
|
|
78469
|
+
const prodOnly = [];
|
|
78470
|
+
candPts.forEach((c, i) => {
|
|
78471
|
+
const p = prodPts[i];
|
|
78472
|
+
if (!p)
|
|
78473
|
+
return;
|
|
78474
|
+
const cb = isBlocked(c);
|
|
78475
|
+
const pb = isBlocked(p);
|
|
78476
|
+
if (cb && !pb)
|
|
78477
|
+
(c.paints ? newVisible : newInvisible).push(c);
|
|
78478
|
+
else if (pb && !cb)
|
|
78479
|
+
prodOnly.push(p);
|
|
78480
|
+
});
|
|
78481
|
+
const out = [];
|
|
78482
|
+
const common = {
|
|
78483
|
+
category: "functional",
|
|
78484
|
+
page: pair.key,
|
|
78485
|
+
check: "click-blocker-parity"
|
|
78486
|
+
};
|
|
78487
|
+
const evidence = pair.cand.screenshotPath ? [{ kind: "screenshot", path: pair.cand.screenshotPath }] : undefined;
|
|
78488
|
+
if (newInvisible.length / n >= MIN_SHARE) {
|
|
78489
|
+
out.push({
|
|
78490
|
+
...common,
|
|
78491
|
+
id: `click-blocker:invisible:${pair.key}`,
|
|
78492
|
+
severity: "high",
|
|
78493
|
+
summary: `[${pair.viewport}] cand has an invisible overlay swallowing clicks (${describeBlock(newInvisible, n)}); prod does not block those points`,
|
|
78494
|
+
details: `${blockDetails(newInvisible, n)} The layer paints nothing at the sampled points, so the page looks fine and does not respond. Typical cause: a drawer, modal or consent section that a signal kept closed in the source mounts open, or without content, in the port. Page URL: ${pair.cand.url}`,
|
|
78495
|
+
suggestedFix: "Find the overlay named above in the candidate and check what mounts it: it should render nothing (or `pointer-events: none`) until its trigger fires, as it does on prod.",
|
|
78496
|
+
evidence
|
|
78497
|
+
});
|
|
78498
|
+
}
|
|
78499
|
+
if (newVisible.length / n >= MIN_SHARE) {
|
|
78500
|
+
const high = newVisible.length / n >= HIGH_VISIBLE_SHARE;
|
|
78501
|
+
out.push({
|
|
78502
|
+
...common,
|
|
78503
|
+
id: `click-blocker:overlay-cand-only:${pair.key}`,
|
|
78504
|
+
severity: high ? "high" : "medium",
|
|
78505
|
+
summary: `[${pair.viewport}] cand has a visible overlay blocking the page (${describeBlock(newVisible, n)}) that prod does not have`,
|
|
78506
|
+
details: `${blockDetails(newVisible, n)} The overlay is visible, but ${high ? "it blocks most of the page, which stays unusable until the overlay is dismissed" : "it blocks part of the page"}, and prod's page is usable at the same moment; whether the overlay offers a way to dismiss it is not verified. Typical cause: a modal or drawer open in the port that starts closed on prod. Page URL: ${pair.cand.url}`,
|
|
78507
|
+
evidence
|
|
78508
|
+
});
|
|
78509
|
+
}
|
|
78510
|
+
if (prodOnly.length / n >= MIN_SHARE) {
|
|
78511
|
+
out.push({
|
|
78512
|
+
...common,
|
|
78513
|
+
id: `click-blocker:prod-only:${pair.key}`,
|
|
78514
|
+
severity: "low",
|
|
78515
|
+
inconclusive: true,
|
|
78516
|
+
summary: `[${pair.viewport}] prod blocks the page with an overlay (${describeBlock(prodOnly, n)}) that cand does not render`,
|
|
78517
|
+
details: "The candidate is more clickable than prod here, so this is not a click-blocking defect. Informational: a consent or promo layer prod shows and the port does not (see the visual and html checks)."
|
|
78518
|
+
});
|
|
78519
|
+
}
|
|
78520
|
+
return out;
|
|
78521
|
+
}
|
|
78522
|
+
function describeBlock(points, n) {
|
|
78523
|
+
const { selector } = dominantOverlay(points);
|
|
78524
|
+
return `${selector}, ${Math.round(points.length / n * 100)}% of the viewport grid`;
|
|
78525
|
+
}
|
|
78526
|
+
function dominantOverlay(points) {
|
|
78527
|
+
const counts = new Map;
|
|
78528
|
+
for (const p of points) {
|
|
78529
|
+
if (!p.overlay)
|
|
78530
|
+
continue;
|
|
78531
|
+
const e = counts.get(p.overlay.selector) ?? { n: 0, coverage: 0 };
|
|
78532
|
+
e.n++;
|
|
78533
|
+
e.coverage = Math.max(e.coverage, p.overlay.coverage);
|
|
78534
|
+
counts.set(p.overlay.selector, e);
|
|
78535
|
+
}
|
|
78536
|
+
const [selector, e] = [...counts.entries()].sort((a, b) => b[1].n - a[1].n)[0] ?? [
|
|
78537
|
+
"unknown",
|
|
78538
|
+
{ coverage: 0 }
|
|
78539
|
+
];
|
|
78540
|
+
return { selector, coverage: e.coverage };
|
|
78541
|
+
}
|
|
78542
|
+
function blockDetails(points, n) {
|
|
78543
|
+
const { selector, coverage } = dominantOverlay(points);
|
|
78544
|
+
const under = [...new Set(points.map((p) => p.underInteractive ?? p.under).filter(Boolean))].slice(0, 3).join("; ");
|
|
78545
|
+
const interactive = points.filter((p) => p.underInteractive).length;
|
|
78546
|
+
return `Overlay ${selector} covers ${Math.round(coverage * 100)}% of the viewport and intercepts ${points.length} of ${n} sampled points (${interactive} with a link/button/field underneath). Underneath: ${under || "page content"}.`;
|
|
78547
|
+
}
|
|
78548
|
+
|
|
78363
78549
|
// src/diff/console.ts
|
|
78364
78550
|
var HYDRATION_PATTERNS = [
|
|
78365
78551
|
/hydration (?:failed|mismatch|error)/i,
|
|
@@ -83235,7 +83421,7 @@ async function pickCategoryLink(candidates) {
|
|
|
83235
83421
|
return null;
|
|
83236
83422
|
if (usable.length === 1)
|
|
83237
83423
|
return usable[0];
|
|
83238
|
-
const filtered = usable.filter((c) => !
|
|
83424
|
+
const filtered = usable.filter((c) => !isBlocked2(c.href));
|
|
83239
83425
|
if (filtered.length === 0)
|
|
83240
83426
|
return usable[0] ?? null;
|
|
83241
83427
|
if (filtered.length === 1)
|
|
@@ -83255,7 +83441,7 @@ function isAccountLink(c) {
|
|
|
83255
83441
|
} catch {}
|
|
83256
83442
|
return ACCOUNT_LINK.test(`${c.text} ${path}`);
|
|
83257
83443
|
}
|
|
83258
|
-
function
|
|
83444
|
+
function isBlocked2(href) {
|
|
83259
83445
|
try {
|
|
83260
83446
|
const path = new URL(href, "http://placeholder.invalid").pathname.toLowerCase();
|
|
83261
83447
|
return PATH_BLOCKLIST.some((b) => path.startsWith(b));
|
|
@@ -83431,6 +83617,164 @@ ${compacted}
|
|
|
83431
83617
|
return null;
|
|
83432
83618
|
}
|
|
83433
83619
|
|
|
83620
|
+
// src/engine/click-probe.ts
|
|
83621
|
+
var CLICK_PROBE_SOURCE = `(function (cols, rows, minPaintAlpha) {
|
|
83622
|
+
var vw = window.innerWidth;
|
|
83623
|
+
var vh = window.innerHeight;
|
|
83624
|
+
var INTERACTIVE =
|
|
83625
|
+
'a[href],button,input:not([type=hidden]),select,textarea,summary,[role=button],[role=link],[role=menuitem],[role=tab],[onclick]';
|
|
83626
|
+
|
|
83627
|
+
function describe(el) {
|
|
83628
|
+
var s = el.tagName.toLowerCase();
|
|
83629
|
+
if (el.id) s += '#' + el.id;
|
|
83630
|
+
var cls = typeof el.className === 'string' ? el.className.split(/\\s+/).filter(Boolean) : [];
|
|
83631
|
+
// Hashed utility classes (css-1x2y3z, long generated names) are noise, not identity.
|
|
83632
|
+
cls = cls.filter(function (c) { return c.length <= 30; }).slice(0, 2);
|
|
83633
|
+
if (cls.length) s += '.' + cls.join('.');
|
|
83634
|
+
var role = el.getAttribute('role');
|
|
83635
|
+
if (role) s += '[role=' + role + ']';
|
|
83636
|
+
return s;
|
|
83637
|
+
}
|
|
83638
|
+
function describeInteractive(el) {
|
|
83639
|
+
var t = (el.getAttribute('aria-label') || el.textContent || '').replace(/\\s+/g, ' ').trim();
|
|
83640
|
+
return describe(el) + (t ? ' "' + t.slice(0, 24) + '"' : '');
|
|
83641
|
+
}
|
|
83642
|
+
function alphaOf(color) {
|
|
83643
|
+
if (!color || color === 'transparent') return 0;
|
|
83644
|
+
var m = color.match(/^rgba?\\(([^)]+)\\)$/);
|
|
83645
|
+
if (m) {
|
|
83646
|
+
var parts = m[1].split(/[ ,\\/]+/).filter(Boolean);
|
|
83647
|
+
return parts.length > 3 ? parseFloat(parts[3]) : 1;
|
|
83648
|
+
}
|
|
83649
|
+
// color(srgb r g b / a), oklch(... / a): alpha follows the slash, absent means opaque.
|
|
83650
|
+
var slash = color.split('/');
|
|
83651
|
+
return slash.length > 1 ? parseFloat(slash[1]) : 1;
|
|
83652
|
+
}
|
|
83653
|
+
function viewportCoverage(el) {
|
|
83654
|
+
var r = el.getBoundingClientRect();
|
|
83655
|
+
var w = Math.max(0, Math.min(r.right, vw) - Math.max(r.left, 0));
|
|
83656
|
+
var h = Math.max(0, Math.min(r.bottom, vh) - Math.max(r.top, 0));
|
|
83657
|
+
return vw * vh > 0 ? (w * h) / (vw * vh) : 0;
|
|
83658
|
+
}
|
|
83659
|
+
function isModalDialog(el) {
|
|
83660
|
+
if (el.tagName !== 'DIALOG' || !el.hasAttribute('open')) return false;
|
|
83661
|
+
try { return el.matches(':modal'); } catch (e) { return false; }
|
|
83662
|
+
}
|
|
83663
|
+
function overlayKind(el, cs) {
|
|
83664
|
+
if (el.tagName === 'DIALOG' && el.hasAttribute('open')) return 'dialog';
|
|
83665
|
+
try { if (el.matches(':popover-open') || el.matches(':fullscreen')) return 'top-layer'; } catch (e) {}
|
|
83666
|
+
if (cs.position === 'fixed') return 'fixed';
|
|
83667
|
+
// An absolutely positioned layer is an overlay only when it spans (nearly) the whole viewport:
|
|
83668
|
+
// ordinary absolute children (badges, dropdowns) are page content.
|
|
83669
|
+
if (cs.position === 'absolute' && viewportCoverage(el) >= 0.9) return 'absolute-cover';
|
|
83670
|
+
return null;
|
|
83671
|
+
}
|
|
83672
|
+
function paintsSelf(el, cs) {
|
|
83673
|
+
if (alphaOf(cs.backgroundColor) >= minPaintAlpha) return true;
|
|
83674
|
+
// 'initial' is what a DOM without a style engine reports for an unset image; browsers say 'none'.
|
|
83675
|
+
if (cs.backgroundImage && cs.backgroundImage !== 'none' && cs.backgroundImage !== 'initial') return true;
|
|
83676
|
+
var bw = parseFloat(cs.borderTopWidth) + parseFloat(cs.borderRightWidth) +
|
|
83677
|
+
parseFloat(cs.borderBottomWidth) + parseFloat(cs.borderLeftWidth);
|
|
83678
|
+
if (bw > 0 && cs.borderTopStyle !== 'none' && cs.borderTopStyle !== 'initial' && alphaOf(cs.borderTopColor) >= minPaintAlpha) return true;
|
|
83679
|
+
var tag = el.tagName;
|
|
83680
|
+
if (tag === 'IMG' || tag === 'VIDEO' || tag === 'CANVAS' || tag === 'SVG' || tag === 'PICTURE' || tag === 'IFRAME') return true;
|
|
83681
|
+
if (alphaOf(cs.color) >= minPaintAlpha) {
|
|
83682
|
+
for (var n = el.firstChild; n; n = n.nextSibling) {
|
|
83683
|
+
if (n.nodeType === 3 && n.nodeValue && n.nodeValue.trim()) return true;
|
|
83684
|
+
}
|
|
83685
|
+
}
|
|
83686
|
+
return false;
|
|
83687
|
+
}
|
|
83688
|
+
|
|
83689
|
+
var points = [];
|
|
83690
|
+
for (var r = 0; r < rows; r++) {
|
|
83691
|
+
for (var c = 0; c < cols; c++) {
|
|
83692
|
+
var x = Math.round(((c + 0.5) / cols) * vw);
|
|
83693
|
+
var y = Math.round(((r + 0.5) / rows) * vh);
|
|
83694
|
+
var hitEl = vw > 0 && vh > 0 ? document.elementFromPoint(x, y) : null;
|
|
83695
|
+
var point = { x: x, y: y, hit: null, pointerEvents: 'auto', paints: false, overlay: null, under: null, underInteractive: null };
|
|
83696
|
+
if (hitEl) {
|
|
83697
|
+
var hcs = getComputedStyle(hitEl);
|
|
83698
|
+
point.hit = describe(hitEl);
|
|
83699
|
+
point.pointerEvents = hcs.pointerEvents || 'auto';
|
|
83700
|
+
// Nearest overlay ancestor (inclusive), collecting the chain to test what is painted.
|
|
83701
|
+
var chain = [];
|
|
83702
|
+
var root = null;
|
|
83703
|
+
var kind = null;
|
|
83704
|
+
for (var el = hitEl; el && el !== document.body && el !== document.documentElement; el = el.parentElement) {
|
|
83705
|
+
chain.push(el);
|
|
83706
|
+
kind = overlayKind(el, getComputedStyle(el));
|
|
83707
|
+
if (kind) { root = el; break; }
|
|
83708
|
+
}
|
|
83709
|
+
// Point-level paint test. Opacity multiplies down the chain: a fully faded button inside
|
|
83710
|
+
// an opaque-looking wrapper still paints nothing.
|
|
83711
|
+
var opacity = 1;
|
|
83712
|
+
var paints = false;
|
|
83713
|
+
var scan = root ? chain : [hitEl];
|
|
83714
|
+
for (var i = 0; i < scan.length; i++) {
|
|
83715
|
+
var cs = getComputedStyle(scan[i]);
|
|
83716
|
+
var o = parseFloat(cs.opacity);
|
|
83717
|
+
opacity *= isNaN(o) ? 1 : o;
|
|
83718
|
+
if (paintsSelf(scan[i], cs)) paints = true;
|
|
83719
|
+
}
|
|
83720
|
+
if (root && kind === 'dialog' && isModalDialog(root)) {
|
|
83721
|
+
// A modal dialog's ::backdrop paints the page outside the dialog box; the dialog itself
|
|
83722
|
+
// is what elementFromPoint reports there.
|
|
83723
|
+
var rr = root.getBoundingClientRect();
|
|
83724
|
+
var inside = x >= rr.left && x <= rr.right && y >= rr.top && y <= rr.bottom;
|
|
83725
|
+
if (!inside) {
|
|
83726
|
+
var bcs = getComputedStyle(root, '::backdrop');
|
|
83727
|
+
paints = alphaOf(bcs.backgroundColor) >= minPaintAlpha;
|
|
83728
|
+
}
|
|
83729
|
+
}
|
|
83730
|
+
point.paints = paints && opacity >= minPaintAlpha;
|
|
83731
|
+
if (root) {
|
|
83732
|
+
point.overlay = {
|
|
83733
|
+
selector: describe(root),
|
|
83734
|
+
kind: kind,
|
|
83735
|
+
// A modal dialog makes the whole page inert whatever its own box measures.
|
|
83736
|
+
coverage: Math.round((kind === 'dialog' && isModalDialog(root) ? 1 : viewportCoverage(root)) * 100) / 100,
|
|
83737
|
+
};
|
|
83738
|
+
if (kind === 'dialog' && isModalDialog(root)) {
|
|
83739
|
+
// The page behind a modal dialog is inert, and an inert element is not hit-testable:
|
|
83740
|
+
// elementsFromPoint lists nothing beneath it. That is not "nothing to click" (the
|
|
83741
|
+
// clicks are swallowed all the same), so name the first page control it disables.
|
|
83742
|
+
point.under = 'page (inert behind modal dialog)';
|
|
83743
|
+
var ctl = Array.prototype.find.call(document.querySelectorAll(INTERACTIVE), function (e) {
|
|
83744
|
+
return !root.contains(e);
|
|
83745
|
+
});
|
|
83746
|
+
if (ctl) point.underInteractive = describeInteractive(ctl);
|
|
83747
|
+
points.push(point);
|
|
83748
|
+
continue;
|
|
83749
|
+
}
|
|
83750
|
+
var stack = document.elementsFromPoint(x, y);
|
|
83751
|
+
var seen = false;
|
|
83752
|
+
for (var j = 0; j < stack.length; j++) {
|
|
83753
|
+
var s = stack[j];
|
|
83754
|
+
if (s === root) { seen = true; continue; }
|
|
83755
|
+
if (!seen) continue;
|
|
83756
|
+
// Ancestors of the overlay (app wrappers, body) are not "beneath" it.
|
|
83757
|
+
if (s === document.body || s === document.documentElement || s.contains(root)) continue;
|
|
83758
|
+
if (point.under === null) point.under = describe(s);
|
|
83759
|
+
if (point.underInteractive === null && s.matches(INTERACTIVE)) {
|
|
83760
|
+
point.underInteractive = describeInteractive(s);
|
|
83761
|
+
break;
|
|
83762
|
+
}
|
|
83763
|
+
}
|
|
83764
|
+
}
|
|
83765
|
+
}
|
|
83766
|
+
points.push(point);
|
|
83767
|
+
}
|
|
83768
|
+
}
|
|
83769
|
+
return { viewportWidth: vw, viewportHeight: vh, points: points };
|
|
83770
|
+
})`;
|
|
83771
|
+
async function readClickProbe(page) {
|
|
83772
|
+
const { gridCols, gridRows, paintAlpha } = TOLERANCES.clickProbe;
|
|
83773
|
+
return await page.evaluate(`${CLICK_PROBE_SOURCE}(${gridCols.value}, ${gridRows.value}, ${paintAlpha.value})`).then((r) => r).catch(() => {
|
|
83774
|
+
return;
|
|
83775
|
+
}) ?? undefined;
|
|
83776
|
+
}
|
|
83777
|
+
|
|
83434
83778
|
// src/engine/cookie-banner.ts
|
|
83435
83779
|
var ACCEPT_SELECTORS = [
|
|
83436
83780
|
"#onetrust-accept-btn-handler",
|
|
@@ -84070,6 +84414,7 @@ async function capturePage(page, opts) {
|
|
|
84070
84414
|
tracePath: opts.tracePath,
|
|
84071
84415
|
xRobotsTag,
|
|
84072
84416
|
pairKey: opts.pairKey,
|
|
84417
|
+
...clickProbe ? { clickProbe } : {},
|
|
84073
84418
|
...response ? { variant: fingerprintVariant(html, response.headers(), cookieNames) } : {}
|
|
84074
84419
|
});
|
|
84075
84420
|
let cookieNames = [];
|
|
@@ -84079,6 +84424,7 @@ async function capturePage(page, opts) {
|
|
|
84079
84424
|
let vitals = null;
|
|
84080
84425
|
let vitalsStats;
|
|
84081
84426
|
let vitalsFullPage = null;
|
|
84427
|
+
let clickProbe;
|
|
84082
84428
|
let html = "";
|
|
84083
84429
|
const readVitals = async () => {
|
|
84084
84430
|
dlog(opts.side, opts.viewport, ` capturePage: vitals evaluate (cap=${Math.min(5000, remaining())}ms)`);
|
|
@@ -84087,6 +84433,10 @@ async function capturePage(page, opts) {
|
|
|
84087
84433
|
new Promise((resolve) => setTimeout(() => resolve(null), Math.min(5000, remaining())))
|
|
84088
84434
|
]) ?? null;
|
|
84089
84435
|
};
|
|
84436
|
+
const readClickProbeCapped = async () => response ? await Promise.race([
|
|
84437
|
+
readClickProbe(page),
|
|
84438
|
+
new Promise((resolve) => setTimeout(() => resolve(undefined), Math.min(3000, remaining())))
|
|
84439
|
+
]) : undefined;
|
|
84090
84440
|
let _resolveDisconnect;
|
|
84091
84441
|
const disconnectPromise = new Promise((r) => {
|
|
84092
84442
|
_resolveDisconnect = r;
|
|
@@ -84123,6 +84473,7 @@ async function capturePage(page, opts) {
|
|
|
84123
84473
|
}
|
|
84124
84474
|
await page.waitForTimeout(Math.min(opts.settleMs ?? 1200, remaining()));
|
|
84125
84475
|
vitals = await readVitals();
|
|
84476
|
+
clickProbe = await readClickProbeCapped();
|
|
84126
84477
|
} else {
|
|
84127
84478
|
dlog(opts.side, opts.viewport, ` capturePage: waitForLoadState('load') (cap=${Math.min(12000, remaining())}ms)`);
|
|
84128
84479
|
await page.waitForLoadState("load", { timeout: Math.min(12000, remaining()) }).catch(() => {
|
|
@@ -84137,6 +84488,7 @@ async function capturePage(page, opts) {
|
|
|
84137
84488
|
dlog(opts.side, opts.viewport, ` capturePage: settle (cap=${Math.min(opts.settleMs ?? 2000, remaining())}ms)`);
|
|
84138
84489
|
await page.waitForTimeout(Math.min(opts.settleMs ?? 2000, remaining()));
|
|
84139
84490
|
vitals = await readVitals();
|
|
84491
|
+
clickProbe = await readClickProbeCapped();
|
|
84140
84492
|
if (opts.scrollToLoad !== false && remaining() > 3000) {
|
|
84141
84493
|
const scrollBudget = Math.min(45000, remaining());
|
|
84142
84494
|
dlog(opts.side, opts.viewport, ` capturePage: scrollFullPage start (budget=${scrollBudget}ms, remaining=${remaining()}ms)`);
|
|
@@ -89074,7 +89426,7 @@ async function compareViewport(browser, args) {
|
|
|
89074
89426
|
repeatPath: null
|
|
89075
89427
|
})
|
|
89076
89428
|
]);
|
|
89077
|
-
return
|
|
89429
|
+
return judgePair2({
|
|
89078
89430
|
spec,
|
|
89079
89431
|
paths,
|
|
89080
89432
|
prod: prod.side,
|
|
@@ -89135,7 +89487,7 @@ function artifactPaths(outDir, prefix, label) {
|
|
|
89135
89487
|
candMasked: at("cand-masked")
|
|
89136
89488
|
};
|
|
89137
89489
|
}
|
|
89138
|
-
function
|
|
89490
|
+
function judgePair2(args) {
|
|
89139
89491
|
const { spec, paths, prod, cand } = args;
|
|
89140
89492
|
const base = {
|
|
89141
89493
|
label: spec.label,
|
|
@@ -89887,7 +90239,7 @@ async function visualRegressionKeyframes(ctx) {
|
|
|
89887
90239
|
const prod = prodProbe ?? unprobed("prod");
|
|
89888
90240
|
const cand = candProbe ?? unprobed("cand");
|
|
89889
90241
|
const prefix = `heatmap-${hashSelector(pair.key)}`;
|
|
89890
|
-
const r =
|
|
90242
|
+
const r = judgePair2({
|
|
89891
90243
|
spec: { label: pair.viewport, viewport: pair.viewport, size: null },
|
|
89892
90244
|
paths: artifactPaths(diffDir, prefix, pair.viewport),
|
|
89893
90245
|
prod: prod.side,
|
|
@@ -90227,6 +90579,7 @@ var analyticsBeaconParity2 = withCapturedPairs(analyticsBeaconParity);
|
|
|
90227
90579
|
var consoleErrorsBaseline2 = withCapturedPairs(consoleErrorsBaseline);
|
|
90228
90580
|
var redirectsParity2 = withCapturedPairs(redirectsParity);
|
|
90229
90581
|
var thirdPartyScriptsParity2 = withCapturedPairs(thirdPartyScriptsParity);
|
|
90582
|
+
var clickBlockerParity2 = withCapturedPairs(clickBlockerParity);
|
|
90230
90583
|
var imageLoadingHealth2 = withHtmlSnapshot(imageLoadingHealth);
|
|
90231
90584
|
var lazySectionPresence2 = withHtmlSnapshot(lazySectionPresence);
|
|
90232
90585
|
var metaSeoParity2 = withHtmlSnapshot(metaSeoParity);
|
|
@@ -90259,6 +90612,7 @@ var ALL_CHECKS = [
|
|
|
90259
90612
|
cartInteractionsFlow,
|
|
90260
90613
|
notFoundParity2,
|
|
90261
90614
|
cookieCepModalCls2,
|
|
90615
|
+
clickBlockerParity2,
|
|
90262
90616
|
pdpGalleryRelated2,
|
|
90263
90617
|
footerLinksHealth2,
|
|
90264
90618
|
loginFlow,
|
|
@@ -90301,6 +90655,7 @@ var ALL_CHECKS_BY_NAME = {
|
|
|
90301
90655
|
"cart-interactions-flow": cartInteractionsFlow,
|
|
90302
90656
|
"not-found-parity": notFoundParity2,
|
|
90303
90657
|
"cookie-cep-modal-cls": cookieCepModalCls2,
|
|
90658
|
+
"click-blocker-parity": clickBlockerParity2,
|
|
90304
90659
|
"pdp-gallery-related": pdpGalleryRelated2,
|
|
90305
90660
|
"footer-links-health": footerLinksHealth2,
|
|
90306
90661
|
"login-flow": loginFlow,
|
|
@@ -90417,8 +90772,13 @@ var MODULES = {
|
|
|
90417
90772
|
},
|
|
90418
90773
|
visual: {
|
|
90419
90774
|
name: "visual",
|
|
90420
|
-
description: "Visual regression — heatmap pixel + box-tree diff of sampled pages, banner aspect ratio, cookie/CEP modal layout shift",
|
|
90421
|
-
checks: [
|
|
90775
|
+
description: "Visual regression — heatmap pixel + box-tree diff of sampled pages, banner aspect ratio, cookie/CEP modal layout shift, overlays that swallow clicks on cand only",
|
|
90776
|
+
checks: [
|
|
90777
|
+
"visual-regression-keyframes",
|
|
90778
|
+
"banner-aspect-ratio",
|
|
90779
|
+
"cookie-cep-modal-cls",
|
|
90780
|
+
"click-blocker-parity"
|
|
90781
|
+
],
|
|
90422
90782
|
flows: ["homepage", "plp", "pdp"],
|
|
90423
90783
|
needsVisualPass: true
|
|
90424
90784
|
},
|
|
@@ -90623,6 +90983,25 @@ var VariantFingerprint = z2.object({
|
|
|
90623
90983
|
stack: ServingStack,
|
|
90624
90984
|
signals: z2.array(z2.string())
|
|
90625
90985
|
});
|
|
90986
|
+
var ClickProbePoint = z2.object({
|
|
90987
|
+
x: z2.number(),
|
|
90988
|
+
y: z2.number(),
|
|
90989
|
+
hit: z2.string().nullable(),
|
|
90990
|
+
pointerEvents: z2.string(),
|
|
90991
|
+
paints: z2.boolean(),
|
|
90992
|
+
overlay: z2.object({
|
|
90993
|
+
selector: z2.string(),
|
|
90994
|
+
kind: z2.enum(["fixed", "dialog", "top-layer", "absolute-cover"]),
|
|
90995
|
+
coverage: z2.number()
|
|
90996
|
+
}).nullable(),
|
|
90997
|
+
under: z2.string().nullable(),
|
|
90998
|
+
underInteractive: z2.string().nullable()
|
|
90999
|
+
});
|
|
91000
|
+
var ClickProbe = z2.object({
|
|
91001
|
+
viewportWidth: z2.number(),
|
|
91002
|
+
viewportHeight: z2.number(),
|
|
91003
|
+
points: z2.array(ClickProbePoint)
|
|
91004
|
+
});
|
|
90626
91005
|
var PageCapture = z2.object({
|
|
90627
91006
|
url: z2.string(),
|
|
90628
91007
|
finalUrl: z2.string(),
|
|
@@ -90647,7 +91026,8 @@ var PageCapture = z2.object({
|
|
|
90647
91026
|
pairKey: z2.string().optional(),
|
|
90648
91027
|
pass: z2.enum(["extra", "visual"]).optional(),
|
|
90649
91028
|
variant: VariantFingerprint.optional(),
|
|
90650
|
-
retried: z2.boolean().optional()
|
|
91029
|
+
retried: z2.boolean().optional(),
|
|
91030
|
+
clickProbe: ClickProbe.optional()
|
|
90651
91031
|
});
|
|
90652
91032
|
var StepCapture = z2.object({
|
|
90653
91033
|
step: z2.number(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/parity",
|
|
3
|
-
"version": "0.35.
|
|
3
|
+
"version": "0.35.31",
|
|
4
4
|
"description": "E2E parity validator for site migrations. Compares prod vs cand and reports UI, functional, SEO, visual, and Web Vitals deltas with a ranked HTML report.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|