@decocms/parity 0.35.1 → 0.35.3
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 +31 -6
- 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
|
};
|
|
@@ -118448,9 +118448,10 @@ function menuLinkIssues(visits) {
|
|
|
118448
118448
|
// src/engine/regression-specs.ts
|
|
118449
118449
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
118450
118450
|
import { existsSync as existsSync35 } from "node:fs";
|
|
118451
|
-
import { join as join48 } from "node:path";
|
|
118451
|
+
import { join as join48, resolve as resolve20 } from "node:path";
|
|
118452
118452
|
import { stripVTControlCharacters } from "node:util";
|
|
118453
|
-
function runRegressionSpecs(
|
|
118453
|
+
function runRegressionSpecs(repoDirArg, baseUrl) {
|
|
118454
|
+
const repoDir = resolve20(repoDirArg);
|
|
118454
118455
|
const dir = join48(repoDir, "tests", "qa");
|
|
118455
118456
|
if (!existsSync35(dir))
|
|
118456
118457
|
return null;
|
|
@@ -119876,6 +119877,25 @@ async function scoreFrames(page, base, frames) {
|
|
|
119876
119877
|
return out;
|
|
119877
119878
|
}, { base, frames });
|
|
119878
119879
|
}
|
|
119880
|
+
function visibleImagesInPage() {
|
|
119881
|
+
const vw = innerWidth;
|
|
119882
|
+
const vh = innerHeight;
|
|
119883
|
+
return [...document.querySelectorAll("img")].filter((img) => {
|
|
119884
|
+
const r = img.getBoundingClientRect();
|
|
119885
|
+
if (r.width < 120)
|
|
119886
|
+
return false;
|
|
119887
|
+
const x = r.left + r.width / 2;
|
|
119888
|
+
const y = r.top + r.height / 2;
|
|
119889
|
+
if (x < 0 || x >= vw || y < 0 || y >= vh)
|
|
119890
|
+
return false;
|
|
119891
|
+
const top = document.elementFromPoint(x, y);
|
|
119892
|
+
return !!top && (top === img || img.contains(top) || top.contains(img));
|
|
119893
|
+
}).sort((a, b) => {
|
|
119894
|
+
const ra = a.getBoundingClientRect();
|
|
119895
|
+
const rb = b.getBoundingClientRect();
|
|
119896
|
+
return rb.width * rb.height - ra.width * ra.height;
|
|
119897
|
+
}).slice(0, 3).map((img) => (img.currentSrc || img.src).split("/").pop()?.split("?")[0] ?? "");
|
|
119898
|
+
}
|
|
119879
119899
|
var SKELETON = "[class*='skeleton' i], .animate-pulse, [aria-busy='true'], .loading";
|
|
119880
119900
|
async function rerenderCommand(opts) {
|
|
119881
119901
|
if (!opts.selector && !opts.text) {
|
|
@@ -119956,6 +119976,7 @@ async function rerenderCommand(opts) {
|
|
|
119956
119976
|
await cdp.send("Page.startScreencast", { format: "jpeg", quality: 50, everyNthFrame: 1 });
|
|
119957
119977
|
await page.waitForTimeout(400);
|
|
119958
119978
|
const target = (opts.selector ? page.locator(opts.selector) : page.getByText(opts.text, { exact: true })).filter({ visible: true }).first();
|
|
119979
|
+
const imagesBefore = await page.evaluate(visibleImagesInPage).catch(() => []);
|
|
119959
119980
|
t0 = Date.now();
|
|
119960
119981
|
const clicked = await target.click({ timeout: 5000 }).then(() => true).catch(() => false);
|
|
119961
119982
|
if (!clicked) {
|
|
@@ -119967,6 +119988,7 @@ async function rerenderCommand(opts) {
|
|
|
119967
119988
|
return;
|
|
119968
119989
|
});
|
|
119969
119990
|
page.off("request", onReq);
|
|
119991
|
+
const imagesAfter = await page.evaluate(visibleImagesInPage).catch(() => []);
|
|
119970
119992
|
const dom = await page.evaluate(() => {
|
|
119971
119993
|
const w = window;
|
|
119972
119994
|
const before = w.__before;
|
|
@@ -120001,7 +120023,8 @@ async function rerenderCommand(opts) {
|
|
|
120001
120023
|
skeletons: Object.entries(dom.skeletons).map(([region, count]) => ({ region, count })),
|
|
120002
120024
|
flashes,
|
|
120003
120025
|
settledAt,
|
|
120004
|
-
frames: post.length
|
|
120026
|
+
frames: post.length,
|
|
120027
|
+
visibleImages: { before: imagesBefore, after: imagesAfter }
|
|
120005
120028
|
};
|
|
120006
120029
|
if (opts.sheet && base) {
|
|
120007
120030
|
const pick = new Set([0]);
|
|
@@ -120053,6 +120076,8 @@ async function rerenderCommand(opts) {
|
|
|
120053
120076
|
console.log(` ${r.remounted ? chalk41.red("REMOUNTED") : "changed "} ${r.region.padEnd(48)} +${r.added}/-${r.removed} attrs ${r.attrs} text ${r.text}`);
|
|
120054
120077
|
for (const s of report.skeletons)
|
|
120055
120078
|
console.log(chalk41.yellow(` skeletons ×${s.count} in ${s.region}`));
|
|
120079
|
+
const [b0, a0] = [report.visibleImages.before[0], report.visibleImages.after[0]];
|
|
120080
|
+
console.log(b0 === a0 ? ` main visible image unchanged: ${a0 ?? "none"}` : ` main visible image: ${b0 ?? "none"} → ${a0 ?? "none"}`);
|
|
120056
120081
|
for (const f of flashes)
|
|
120057
120082
|
console.log(chalk41.red(` white flash +${f.from}–${f.to}ms (peak ${f.peakWhite.toFixed(0)}% white)`));
|
|
120058
120083
|
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.3",
|
|
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",
|