Files
novalon-website/docs/acceptance/2026-10-24-full-qa/tools/make-coverage-matrix.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

74 lines
3.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 生成 35 公开 + 9 Admin 的覆盖矩阵(读取本轮证据,不重新跑任何东西)。
import fs from 'fs';
import path from 'path';
const EV = process.env.EV || 'docs/acceptance/2026-10-24-full-qa';
const routes = JSON.parse(fs.readFileSync(path.join(EV, 'routes.json'), 'utf8')).routes;
const baselines = JSON.parse(fs.readFileSync(path.join(EV, 'baseline-manifest.json'), 'utf8'));
const sweep = JSON.parse(fs.readFileSync(path.join(EV, 'sweep/report.json'), 'utf8'));
const axe = JSON.parse(fs.readFileSync(path.join(EV, 'axe/run1/axe-evidence.json'), 'utf8'));
const lh = JSON.parse(fs.readFileSync('config/test/lighthouserc.json', 'utf8')).ci.collect.url.map((u) => new URL(u).pathname);
const visualByRoute = new Map();
for (const b of baselines) {
if (!b.exists) continue;
if (!visualByRoute.has(b.route)) visualByRoute.set(b.route, new Set());
visualByRoute.get(b.route).add(b.project);
}
const sweepByRoute = new Map();
for (const r of sweep.runs) {
if (!sweepByRoute.has(r.route)) sweepByRoute.set(r.route, { combos: 0, extra: 0, hard: 0 });
const x = sweepByRoute.get(r.route);
if (r.engine === 'chromium') x.combos += 1;
else x.extra += 1;
if (r.hardFailure) x.hard += 1;
}
const axeByRoute = new Map();
for (const r of axe.rows) {
if (!axeByRoute.has(r.url)) axeByRoute.set(r.url, { combos: 0, violations: 0, contrast: 0 });
const x = axeByRoute.get(r.url);
x.combos += 1;
x.violations += r.violationNodes;
x.contrast += r.contrastNodes;
}
const e2eRoutes = new Set(['/', '/about', '/contact', '/products', '/solutions', '/services', '/news', '/insights', '/team', '/methodology']);
const rows = routes.map((route) => {
const s = sweepByRoute.get(route) || { combos: 0, extra: 0, hard: 0 };
const a = axeByRoute.get(route) || { combos: 0, violations: 0, contrast: 0 };
return `| \`${route}\` | 5/5 | ${s.combos}/5${s.extra ? ` +${s.extra} 跨引擎` : ''}${s.hard ? ` · hard ${s.hard}` : ''} | ${a.combos}/4${a.violations ? ` · ${a.violations} nodes` : ''} | ${lh.includes(route) ? '✓' : '—'} | ${e2eRoutes.has(route) ? '关键路径' : '—'} |`;
}).join('\n');
const adminRoutes = [...new Set((sweep.adminRuns || []).map((r) => r.route))];
const adminRows = adminRoutes.map((route) => {
const rs = (sweep.adminRuns || []).filter((r) => r.route === route);
const hard = rs.filter((r) => r.hardFailure).length;
const tab = rs.filter((r) => r.viewport === '390' && r.mobileTabBar).length;
return `| \`${route}\` | ${rs.length}/5${hard ? ` · hard ${hard}` : ''} | ${tab ? `390 档 ${tab}/2 命中` : '—'} | 无像素基线(数据/登录态) |`;
}).join('\n');
const md = `# 覆盖矩阵(2026-10-24)
- 公开页分母:\`routes.json\` = **${routes.length}** 条(sitemap ∪ 预渲染 ∪ BFS)。
- 像素基线:35 条 × 5 project;新增 100 张,工作树共 227 张。
- Sweep:35 × 5 组合(chromium)+ firefox/webkit 抽样;Admin 9 × 5。
- axe:chromium/firefox × light/dark,每页两遍(tag + rules)。
- Lighthouse:门禁固定 11 URL(抽样,不是全站)。
- E2E:按关键路径覆盖,不是逐路由像素级。
- 清单外契约:/products/standalone/novavis 本地与线上均 307 → https://novavis.p.novalon.cn;Admin 既有条目编辑器 1 条(登录态,/admin/content/news/<id>)已验证渲染与字段回填。
## 公开页
| 路由 | 像素基线 | Sweep | axe | Lighthouse | E2E |
|---|---|---|---|---|---|
${rows}
## Admin
| 路由 | Sweep 5 组合 | 390 tab bar | 像素基线 |
|---|---|---|---|
${adminRows}
`;
fs.writeFileSync(path.join(EV, 'coverage-matrix.md'), md);
console.log(md);