@decocms/parity 0.35.29 → 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.
Files changed (3) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cli.js +416 -35
  3. 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
@@ -61,6 +69,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
61
69
 
62
70
  ### Fixed
63
71
 
72
+ * **The compared / passed counts agree across checks again.** Three changes that each assumed
73
+ the others were already in: a pair a not-captured guard (`withCapturedPairs`) withholds now
74
+ lands in the check's `inconclusive` count (a check that does not count stays uncounted);
75
+ `visual-regression-keyframes` counts a height-differs page as compared-and-not-passed and every
76
+ other `failed` page as inconclusive, even when a live `visual:sections` finding names it, so the
77
+ check agrees with the "N not compared" split line; and the page-height severity scale moved
78
+ into `TOLERANCES.visual` (`heightLowMaxPx`, `heightLowMaxPct`, `heightHighMinPct`). No tolerance
79
+ value changed.
80
+
64
81
  * **A candidate page that was never captured is no longer a status divergence.**
65
82
  A capture that recorded no HTTP answer (status 0: timeout, refused connection)
66
83
  made `http-status-parity` file a critical `prod=200 cand=0`. It is now one
package/dist/cli.js CHANGED
@@ -76786,6 +76786,62 @@ var TOLERANCES = {
76786
76786
  unit: "px",
76787
76787
  basis: "assumed",
76788
76788
  note: "Minimum connected-component size to count as a hotspot; drops 1-2px anti-aliasing specks. About a small icon."
76789
+ },
76790
+ heightLowMaxPx: {
76791
+ value: 50,
76792
+ unit: "px",
76793
+ basis: "assumed",
76794
+ note: "A page-height difference under this and under heightLowMaxPct is `low` (margin / rounding)."
76795
+ },
76796
+ heightLowMaxPct: {
76797
+ value: 2,
76798
+ unit: "% of prod height",
76799
+ basis: "assumed",
76800
+ note: "Paired with heightLowMaxPx so a short page is not 'low' at 49 px."
76801
+ },
76802
+ heightHighMinPct: {
76803
+ value: 10,
76804
+ unit: "% of prod height",
76805
+ basis: "assumed",
76806
+ note: "A page-height difference at or above this is `high`: a block of content is missing or extra."
76807
+ }
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."
76789
76845
  }
76790
76846
  },
76791
76847
  geometry: {
@@ -78342,6 +78398,154 @@ function detailFor(prod, cand, viewport) {
78342
78398
  `);
78343
78399
  }
78344
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
+
78345
78549
  // src/diff/console.ts
78346
78550
  var HYDRATION_PATTERNS = [
78347
78551
  /hydration (?:failed|mismatch|error)/i,
@@ -79374,11 +79578,11 @@ function withCapturedPairs(check) {
79374
79578
  summary: `${uncapturedSummary(pair.key, sides)} — not compared by ${result.name}`,
79375
79579
  details: "The capture recorded no HTTP answer (status 0), so this check had nothing to judge on that side. Not a finding about the page: re-run it against a warm server."
79376
79580
  }));
79377
- return {
79581
+ return addWithheld({
79378
79582
  ...result,
79379
79583
  status: result.status === "pass" ? "warn" : result.status,
79380
79584
  issues: [...result.issues, ...issues]
79381
- };
79585
+ }, missing.length);
79382
79586
  };
79383
79587
  Object.defineProperty(guarded, "name", { value: check.name });
79384
79588
  return guarded;
@@ -83217,7 +83421,7 @@ async function pickCategoryLink(candidates) {
83217
83421
  return null;
83218
83422
  if (usable.length === 1)
83219
83423
  return usable[0];
83220
- const filtered = usable.filter((c) => !isBlocked(c.href));
83424
+ const filtered = usable.filter((c) => !isBlocked2(c.href));
83221
83425
  if (filtered.length === 0)
83222
83426
  return usable[0] ?? null;
83223
83427
  if (filtered.length === 1)
@@ -83237,7 +83441,7 @@ function isAccountLink(c) {
83237
83441
  } catch {}
83238
83442
  return ACCOUNT_LINK.test(`${c.text} ${path}`);
83239
83443
  }
83240
- function isBlocked(href) {
83444
+ function isBlocked2(href) {
83241
83445
  try {
83242
83446
  const path = new URL(href, "http://placeholder.invalid").pathname.toLowerCase();
83243
83447
  return PATH_BLOCKLIST.some((b) => path.startsWith(b));
@@ -83413,6 +83617,164 @@ ${compacted}
83413
83617
  return null;
83414
83618
  }
83415
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
+
83416
83778
  // src/engine/cookie-banner.ts
83417
83779
  var ACCEPT_SELECTORS = [
83418
83780
  "#onetrust-accept-btn-handler",
@@ -84052,6 +84414,7 @@ async function capturePage(page, opts) {
84052
84414
  tracePath: opts.tracePath,
84053
84415
  xRobotsTag,
84054
84416
  pairKey: opts.pairKey,
84417
+ ...clickProbe ? { clickProbe } : {},
84055
84418
  ...response ? { variant: fingerprintVariant(html, response.headers(), cookieNames) } : {}
84056
84419
  });
84057
84420
  let cookieNames = [];
@@ -84061,6 +84424,7 @@ async function capturePage(page, opts) {
84061
84424
  let vitals = null;
84062
84425
  let vitalsStats;
84063
84426
  let vitalsFullPage = null;
84427
+ let clickProbe;
84064
84428
  let html = "";
84065
84429
  const readVitals = async () => {
84066
84430
  dlog(opts.side, opts.viewport, ` capturePage: vitals evaluate (cap=${Math.min(5000, remaining())}ms)`);
@@ -84069,6 +84433,10 @@ async function capturePage(page, opts) {
84069
84433
  new Promise((resolve) => setTimeout(() => resolve(null), Math.min(5000, remaining())))
84070
84434
  ]) ?? null;
84071
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;
84072
84440
  let _resolveDisconnect;
84073
84441
  const disconnectPromise = new Promise((r) => {
84074
84442
  _resolveDisconnect = r;
@@ -84105,6 +84473,7 @@ async function capturePage(page, opts) {
84105
84473
  }
84106
84474
  await page.waitForTimeout(Math.min(opts.settleMs ?? 1200, remaining()));
84107
84475
  vitals = await readVitals();
84476
+ clickProbe = await readClickProbeCapped();
84108
84477
  } else {
84109
84478
  dlog(opts.side, opts.viewport, ` capturePage: waitForLoadState('load') (cap=${Math.min(12000, remaining())}ms)`);
84110
84479
  await page.waitForLoadState("load", { timeout: Math.min(12000, remaining()) }).catch(() => {
@@ -84119,6 +84488,7 @@ async function capturePage(page, opts) {
84119
84488
  dlog(opts.side, opts.viewport, ` capturePage: settle (cap=${Math.min(opts.settleMs ?? 2000, remaining())}ms)`);
84120
84489
  await page.waitForTimeout(Math.min(opts.settleMs ?? 2000, remaining()));
84121
84490
  vitals = await readVitals();
84491
+ clickProbe = await readClickProbeCapped();
84122
84492
  if (opts.scrollToLoad !== false && remaining() > 3000) {
84123
84493
  const scrollBudget = Math.min(45000, remaining());
84124
84494
  dlog(opts.side, opts.viewport, ` capturePage: scrollFullPage start (budget=${scrollBudget}ms, remaining=${remaining()}ms)`);
@@ -89056,7 +89426,7 @@ async function compareViewport(browser, args) {
89056
89426
  repeatPath: null
89057
89427
  })
89058
89428
  ]);
89059
- return judgePair({
89429
+ return judgePair2({
89060
89430
  spec,
89061
89431
  paths,
89062
89432
  prod: prod.side,
@@ -89117,7 +89487,7 @@ function artifactPaths(outDir, prefix, label) {
89117
89487
  candMasked: at("cand-masked")
89118
89488
  };
89119
89489
  }
89120
- function judgePair(args) {
89490
+ function judgePair2(args) {
89121
89491
  const { spec, paths, prod, cand } = args;
89122
89492
  const base = {
89123
89493
  label: spec.label,
@@ -89738,32 +90108,12 @@ function everyRegionImperceptible(heatmapPath, prod, cand, diffDir, prefix, view
89738
90108
  });
89739
90109
  return explainHotspots(all.hotspots, prod.side, cand.side, artifactPaths(diffDir, prefix, viewport), prod.boxTree, cand.boxTree).every(isImperceptible);
89740
90110
  }
89741
- var HEIGHT_DIFF_TOLERANCE = {
89742
- lowMaxPx: {
89743
- value: 50,
89744
- unit: "px",
89745
- basis: "assumed",
89746
- note: "under this and under lowMaxPct: margin / rounding"
89747
- },
89748
- lowMaxPct: {
89749
- value: 2,
89750
- unit: "% of prod height",
89751
- basis: "assumed",
89752
- note: "paired with lowMaxPx so a short page is not 'low' at 49 px"
89753
- },
89754
- highMinPct: {
89755
- value: 10,
89756
- unit: "% of prod height",
89757
- basis: "assumed",
89758
- note: "at or above: a block of content is missing or extra"
89759
- }
89760
- };
89761
90111
  function heightDiffSeverity(prodH, candH) {
89762
90112
  const delta = Math.abs(candH - prodH);
89763
90113
  const pct = prodH > 0 ? delta / prodH * 100 : 100;
89764
- if (pct >= HEIGHT_DIFF_TOLERANCE.highMinPct.value)
90114
+ if (pct >= TOLERANCES.visual.heightHighMinPct.value)
89765
90115
  return "high";
89766
- if (delta < HEIGHT_DIFF_TOLERANCE.lowMaxPx.value && pct < HEIGHT_DIFF_TOLERANCE.lowMaxPct.value) {
90116
+ if (delta < TOLERANCES.visual.heightLowMaxPx.value && pct < TOLERANCES.visual.heightLowMaxPct.value) {
89767
90117
  return "low";
89768
90118
  }
89769
90119
  return "medium";
@@ -89889,7 +90239,7 @@ async function visualRegressionKeyframes(ctx) {
89889
90239
  const prod = prodProbe ?? unprobed("prod");
89890
90240
  const cand = candProbe ?? unprobed("cand");
89891
90241
  const prefix = `heatmap-${hashSelector(pair.key)}`;
89892
- const r = judgePair({
90242
+ const r = judgePair2({
89893
90243
  spec: { label: pair.viewport, viewport: pair.viewport, size: null },
89894
90244
  paths: artifactPaths(diffDir, prefix, pair.viewport),
89895
90245
  prod: prod.side,
@@ -90056,6 +90406,9 @@ Usually missing from registerSections() in src/setup.ts, or the CMS is not resol
90056
90406
  summary: "Visual pass ran but no page pair was captured on both sides — nothing was compared"
90057
90407
  });
90058
90408
  }
90409
+ const measured = (r) => r.verdict !== "failed" || r.notComparedKind === "height-differs";
90410
+ const notMeasured = results.filter((r) => !measured(r)).map((r) => r.pageKey);
90411
+ const notMeasuredSet = new Set(notMeasured);
90059
90412
  const summary = {
90060
90413
  results,
90061
90414
  pagesChecked: results.length,
@@ -90076,9 +90429,9 @@ Usually missing from registerSections() in src/setup.ts, or the CMS is not resol
90076
90429
  issues,
90077
90430
  ...unitCounts({
90078
90431
  unit: "page-pair",
90079
- judged: results.filter((r) => r.verdict !== "failed").map((r) => r.pageKey),
90080
- unjudged: results.filter((r) => r.verdict === "failed").map((r) => r.pageKey),
90081
- issues,
90432
+ judged: results.filter(measured).map((r) => r.pageKey),
90433
+ unjudged: notMeasured,
90434
+ issues: issues.filter((i) => i.inconclusive || i.accepted || !i.page || !notMeasuredSet.has(i.page)),
90082
90435
  informational: (i) => i.id.startsWith("visual:heatmap:") || i.id.startsWith("visual:sections-expected:")
90083
90436
  }),
90084
90437
  data: { visualDiff: summary }
@@ -90226,6 +90579,7 @@ var analyticsBeaconParity2 = withCapturedPairs(analyticsBeaconParity);
90226
90579
  var consoleErrorsBaseline2 = withCapturedPairs(consoleErrorsBaseline);
90227
90580
  var redirectsParity2 = withCapturedPairs(redirectsParity);
90228
90581
  var thirdPartyScriptsParity2 = withCapturedPairs(thirdPartyScriptsParity);
90582
+ var clickBlockerParity2 = withCapturedPairs(clickBlockerParity);
90229
90583
  var imageLoadingHealth2 = withHtmlSnapshot(imageLoadingHealth);
90230
90584
  var lazySectionPresence2 = withHtmlSnapshot(lazySectionPresence);
90231
90585
  var metaSeoParity2 = withHtmlSnapshot(metaSeoParity);
@@ -90258,6 +90612,7 @@ var ALL_CHECKS = [
90258
90612
  cartInteractionsFlow,
90259
90613
  notFoundParity2,
90260
90614
  cookieCepModalCls2,
90615
+ clickBlockerParity2,
90261
90616
  pdpGalleryRelated2,
90262
90617
  footerLinksHealth2,
90263
90618
  loginFlow,
@@ -90300,6 +90655,7 @@ var ALL_CHECKS_BY_NAME = {
90300
90655
  "cart-interactions-flow": cartInteractionsFlow,
90301
90656
  "not-found-parity": notFoundParity2,
90302
90657
  "cookie-cep-modal-cls": cookieCepModalCls2,
90658
+ "click-blocker-parity": clickBlockerParity2,
90303
90659
  "pdp-gallery-related": pdpGalleryRelated2,
90304
90660
  "footer-links-health": footerLinksHealth2,
90305
90661
  "login-flow": loginFlow,
@@ -90416,8 +90772,13 @@ var MODULES = {
90416
90772
  },
90417
90773
  visual: {
90418
90774
  name: "visual",
90419
- description: "Visual regression — heatmap pixel + box-tree diff of sampled pages, banner aspect ratio, cookie/CEP modal layout shift",
90420
- checks: ["visual-regression-keyframes", "banner-aspect-ratio", "cookie-cep-modal-cls"],
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
+ ],
90421
90782
  flows: ["homepage", "plp", "pdp"],
90422
90783
  needsVisualPass: true
90423
90784
  },
@@ -90622,6 +90983,25 @@ var VariantFingerprint = z2.object({
90622
90983
  stack: ServingStack,
90623
90984
  signals: z2.array(z2.string())
90624
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
+ });
90625
91005
  var PageCapture = z2.object({
90626
91006
  url: z2.string(),
90627
91007
  finalUrl: z2.string(),
@@ -90646,7 +91026,8 @@ var PageCapture = z2.object({
90646
91026
  pairKey: z2.string().optional(),
90647
91027
  pass: z2.enum(["extra", "visual"]).optional(),
90648
91028
  variant: VariantFingerprint.optional(),
90649
- retried: z2.boolean().optional()
91029
+ retried: z2.boolean().optional(),
91030
+ clickProbe: ClickProbe.optional()
90650
91031
  });
90651
91032
  var StepCapture = z2.object({
90652
91033
  step: z2.number(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/parity",
3
- "version": "0.35.29",
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",