AirShelf/core/qa/visual-parity/_measure.mjs
zyc 890cb9ab67
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 2m2s
chore(core/qa): function-audit toolchain + parity/audit reports + pixel-perfect skill
- qa/function-audit: playwright 行为审计工具(audit.mjs/verify-modals.mjs/pages.json)
  + 18 页审计产出(*.audit.md/json、summary、运行日志)
- qa/visual-parity: 调试/测量辅助脚本(_dbg*.mjs/_measure.mjs/_off.mjs)
- core/还原度核对报告.md: 18 页 pixelmatch 核对结果(含 vite 代理陈旧坑记录)
- core/还原与接口待办.md: 逐页还原度/真实数据/交互接入待办总表
- .claude/skills/pixel-perfect-react: 像素级还原 React 的 SKILL 文档
- frontend/public/_devlogin.html: 临时本地登录辅助页(可删)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 09:41:30 +08:00

19 lines
942 B
JavaScript

import { chromium } from "playwright";
const TOK = process.argv[2];
const b = await chromium.launch();
const ctx = await b.newContext({ viewport: { width: 1440, height: 900 }, deviceScaleFactor: 1 });
const p = await ctx.newPage();
await p.goto("http://127.0.0.1:5173/");
await p.evaluate((t) => localStorage.setItem("airshelf_token", t), TOK);
await p.goto("http://127.0.0.1:5173/products/new", { waitUntil: "networkidle" });
await p.waitForTimeout(800);
const r = await p.evaluate(() => {
const d = document.querySelector(".pc-drawer");
if (!d) return { found: false, body: document.body.className, hasLogin: !!document.querySelector(".auth-exact-page") };
const cs = getComputedStyle(d);
const rect = d.getBoundingClientRect();
return { found: true, width: cs.width, transform: cs.transform, left: rect.left, right: rect.right, rectW: rect.width, cls: d.className };
});
console.log(JSON.stringify(r, null, 2));
await b.close();