Files
novalon-website/docs/acceptance/2026-10-24-full-qa/tools/scan-brand-sections.mjs
T
zhangxiang 763e159ac4 docs(acceptance): 两轮全站验收读数 + 复现脚本 + 企微资产包入库(OPEN-12)
按「这条结论怎么来的必须入库,排查当时的截图只服务当时」的既有口径,
把此前一直悬在 git status 里、归属未定的产物逐组落定:

入库(7.2MB):
- docs/acceptance/2026-10-21-full-qa/、2026-10-24-full-qa/ 的文字与结构化读数
  (README / defects*.json / sweep/summary.json / axe evidence / lighthouse /
  report.json 逐 run 原始读数 / tools 复现脚本)
- docs/acceptance/2026-11-26-axe/ 本轮 axe 复跑证据(35 路由 × 4 组合 140 rows 全 0)
- scripts/acceptance/{sweep-routes,contact-sheet}.mjs —— 两轮 README 里被引用的
  复现脚本,不提交则结论不可复算
- deliverables/.../wecom-pack.cjs + check-wecom.py + WECOM-MANIFEST.md +
  assets-wecom/pack-report.json(生成器/校验器/清单;18 张 PNG 可由脚本从已入库
  SVG 重新栅格化,故仍按既有规则忽略)

忽略(不提交,已写进 .gitignore 并注明归属):
- 两轮验收的逐页截图(172MB):只在排查当时有用
- infra/cicd/gitea{,-custom}/ + 2026-10-22-gitea-branding/(340KB):
  归 feature/gitea-branding,逐文件 sha256 与该分支 50/50 完全一致,
  在本分支提交会造成同一批文件的两份历史

判据:提交后 git status -uall 只剩被忽略项;每条 ?? 都能回答「归谁、为什么在这里」。
2026-11-26 20:03:46 +08:00

37 lines
1.8 KiB
JavaScript

// 全站 bg-brand-section 扫描:量化“满幅饱和红面”在哪些路由仍存在。
// 只读 3100 本地产物;不截图、不写远端。
import fs from 'fs';
import { chromium } from 'playwright';
const BASE = (process.env.BASE || 'http://127.0.0.1:3100').replace(/\/$/, '');
const EV = process.env.EV || 'docs/acceptance/2026-10-24-full-qa';
const routes = JSON.parse(fs.readFileSync(`${EV}/routes.json`, 'utf8')).routes;
const browser = await chromium.launch();
const page = await browser.newPage({ viewport: { width: 1440, height: 900 }, reducedMotion: 'reduce' });
const out = [];
for (const route of routes) {
await page.goto(BASE + route, { waitUntil: 'domcontentloaded', timeout: 45000 });
await page.waitForTimeout(400);
const found = await page.evaluate(() => {
const els = [...document.querySelectorAll('.bg-brand-section, [class*="bg-brand-section"]')];
const docH = document.documentElement.scrollHeight || 1;
return els.map((el) => {
const r = el.getBoundingClientRect();
const s = getComputedStyle(el);
return {
tag: el.tagName,
cls: String(el.className || '').slice(0, 160),
text: (el.innerText || '').trim().slice(0, 80),
w: Math.round(r.width), h: Math.round(r.height), top: Math.round(r.top + window.scrollY),
opacity: s.opacity, bg: s.backgroundColor,
pageRatio: +(r.width * r.height / (window.innerWidth * docH)).toFixed(4),
};
});
});
out.push({ route, count: found.length, elements: found });
console.log(`${route} count=${found.length} ${found.map((f) => `${f.w}x${f.h}@${f.top}`).join(' ')}`);
}
await browser.close();
fs.writeFileSync(`${EV}/visual/bg-brand-section.json`, JSON.stringify(out, null, 2));
console.log('DONE routes=' + out.length + ' hits=' + out.filter((x) => x.count > 0).length);