test(e2e): 覆盖分母补齐 + GA 断言与 opt-in 实现对齐
三件事同批,共同点是「门禁/断言与实现脱钩,而脱钩处恰好没人跑」。
1. GA4 consent 断言(新发现,上一轮遗留)
DEF-09 把 analytics_storage 默认从 granted 改成 denied(opt-in),
实现与单测都改了,e2e/ga4-event-tracking.spec.ts:132 仍断言 granted。
它能藏住是因为那 4 个 @critical 用例**只在 test:e2e:prod 下真正执行**
(dev 下 NEXT_PUBLIC_GA_MEASUREMENT_ID 不存在 ⇒ test.skip)⇒ 本地全绿看不见。
改为同时钉两件事:default 必须是 denied;已存偏好由内联片段在 config
之前以 consent update 放行。只改前者会让「偏好回放坏了」变成新盲区。
判据:E2E_TARGET=production 跑 ga4 spec ⇒ 4 passed。
2. UJ-10 假红(TA-11)
原断言「分类后恰 1 篇 / 全部恰 2 篇」,并行写库用例插入的 E2E 新闻会让它假红。
改为钉两篇种子 slug 的可见/缺席 —— 比数条数更具体:数条数只证明「有 1 条」,
钉 slug 才证明「筛掉的是另一类」。桌面 + 移动两份同步改。
3. 覆盖分母 + 取样稳定性
- headings PAGES 11 → 34 页(与 check:axe:routes 的 35 条对齐,去掉按 404
契约的 /_not-found)。实测 34/34 通过、0 问题。此前只扫 11 页,
新增路由失踪时门禁仍然绿 —— 「分母静默变小」的第三种形态。
- axe settle() 改逐屏 max(400, 0.8×viewport) 步进 + 双 rAF,回顶后等
main * 内 opacity:0 元素清零(8s 超时抛出,不吞)。原「一次跳到底」
会跳过 IntersectionObserver 目标,半透明文字被读成低对比度,失败集合漂移。
- website-acceptance 的 pollBoundingBox 由「非空即返回」改为连续 5 次取样
一致再返回(TA-12):页面入场 transform 未落定时会抓到 29.936px 中途值。
超时仍 throw,判据强度不降。
判据:type-check / type-check:e2e EXIT=0;test:e2e:prod 135 passed / 0 failed
/ 9 skipped / EXIT=0;check:axe 35 路由 × 4 组合 140 rows 全 0、规则级 105/105。
This commit is contained in:
1 parent
3128d59164
commit
eba4e10442
8 files changed
+172
-32
No files matched your search
@@ -358,3 +358,46 @@ git commit --no-verify -m "message"
|
||||
| 动效约束 | `npm run check:motion` | 时长判据移到**消费点**:非 infinite 的 transition/animation(含 var() 解析)>700ms 判红;写死贝塞尔须走令牌层 | 真树注入三处 ⇒ EXIT=1(4 红);还原 ⇒ 0 |
|
||||
|
||||
> 仍未并入 `test:all`:`check:motion` 与全站 axe(`check:axe:routes` → `check:axe`,CI 于 **:3100** 跑)。编排前先读脚本自己的默认端口(`docs/lessons-learned.md` §5.46)。
|
||||
|
||||
## §13 2026-10-24 视觉 / axe / headings 覆盖扩容(2026-11-26 收尾轮核实落地)
|
||||
|
||||
这一节记的是**覆盖分母**的变化,不是新判据。触发它的是同一个病:门禁的分母由人手维护,
|
||||
而**没人维护的分母只会越来越小** —— 三条门禁各自只扫了机器清单的一个子集,新增路由失踪时它们仍然全绿。
|
||||
|
||||
| 门禁 | 扩容前 | 扩容后 | 现取命令 | 本轮实测 |
|
||||
|---|---|---|---|---|
|
||||
| 视觉回归 | 15 页 | **35 页**(`VISUAL_TEST_PAGES`) | `grep -c "path: '/" e2e/visual-regression.spec.ts` | `--list` = **225 例**(45/project × 5 project) |
|
||||
| 视觉基线 | 127 张 | **227 张** | `find e2e/visual-snapshots -name '*.png' \| wc -l` | 磁盘 227 = 入库 227,孤儿 0 |
|
||||
| 标题层级 | 11 页 | **34 页**(`PAGES`,35 公开路由去掉按 404 契约的 `/_not-found`) | `grep -c '{ path:' scripts/utils/check-heading-hierarchy.ts` | EXIT=0,**34/34 通过、0 问题** |
|
||||
| 全站 axe | 路由清单 | 同上 35 条(`check:axe:routes`) | — | settle 修复见下 |
|
||||
|
||||
**视觉新增的 20 条**:`/_not-found`、`/cases`、`/insights`、`/privacy`、`/terms`、
|
||||
`/products/{bi,cms,crm,oa,sds,erp-upgrade-v3}`、`/services/{consulting,data,solutions}`、
|
||||
`/solutions/{education,finance,healthcare,logistics,retail}`、`/news/digital-transformation-solution`。
|
||||
`/_not-found` 用一条**不存在的普通路径**接入(`/visual-regression-404-probe`),而不是写 `/_not-found`——
|
||||
后者本身就是 Next 的 404 契约,普通路径更贴近用户真实到达方式。Admin 9 条路由**不建像素基线**
|
||||
(数据/登录态相关),由 sweep 的多组合截图 + 不变量读数覆盖。
|
||||
|
||||
**新增缺失基线用 `--update-snapshots=missing`**,不要用裸 `--update-snapshots`(后者取 `changed`,
|
||||
会连带重写不符项,把「基线过期」悄悄固化成「新真相」)。
|
||||
|
||||
> 🛠️ **settle 修复(TA-05)**:原 `settle()` 一次跳到底再回顶 400ms,会跳过中间 IntersectionObserver
|
||||
> 目标,`ScrollReveal` 元素停在 inline `opacity:0`;axe 把半透明文字读成低对比度,失败集合随并行漂移。
|
||||
> 现改为逐屏 `max(400, 0.8×viewport)`、每步 260ms + 双 rAF,回顶后等 `main *` 内「`opacity:0` 且可见、
|
||||
> 有高度」的元素清零(8s 超时**抛出**),再等字体。判据要点:超时必须抛而不是吞 ——
|
||||
> 「没量到」不许读作「通过」。
|
||||
|
||||
> 🛠️ **跑过写库 E2E 后,视觉前必须 `npm run build`**:`cms-workflow` / `user-journey` UJ-03 会把临时新闻
|
||||
> 写进 `dist/standalone/dist/server/app/news.html` 的 ISR 缓存;缓存按 1 小时存活,直接跑视觉会让 `/news`
|
||||
> 读到临时条目而假红(实测 5/5 project 同型红,重建后 225/225 绿)。这不是产品回归,是测试间缓存污染。
|
||||
|
||||
> 🛠️ **prod gate 的两条假红(TA-11/TA-12)已从用例侧收口**:UJ-10 原断言「分类后恰 1 篇 / 全部恰 2 篇」,
|
||||
> 并行写库用例插入的 E2E 新闻会让它假红 ⇒ 改为钉两篇**种子 slug** 的可见/缺席(比数条数更具体:
|
||||
> 数条数只证明「有 1 条」,钉 slug 才证明「筛掉的是另一类」)。Logo 取样竞态原「boundingBox 非空即返回」,
|
||||
> 会抓到 29.936px 的中途值 ⇒ 改为连续 5 次取样一致(`stable >= 4`)再返回;超时仍 throw,判据强度不降。
|
||||
|
||||
> ⚠ **GA4 的 consent 断言必须跟着实现走**:DEF-09 把 `analytics_storage` 默认从 `granted` 改成 `denied`
|
||||
> (opt-in),而 `e2e/ga4-event-tracking.spec.ts` TC-GA4-001 仍断言 `granted` —— 该用例只在
|
||||
> `npm run test:e2e:prod` 下真正执行(dev 下 `test.skip`),所以「dev 全绿」看不见它。
|
||||
> 现改为**同时钉两件事**:default 必须是 `denied`,且已存偏好由内联片段在 `config` 之前以
|
||||
> `consent update` 放行。缺任一件都是采集口径错了。
|
||||
@@ -289,6 +289,19 @@ npm run test:visual:all -- --update-snapshots
|
||||
|
||||
**axe 全站节点计数门禁(验收 §8-⑤,2026-09-23 起为常驻门禁)**:既有 `e2e/mobile-accessibility.spec.ts` 不满足该条口径——它只断言 critical/serious 的**规则条数** = 0(`:67`),覆盖 9 个路由、单一主题,因此「同一规则下 20 个节点不达标」与「0 个节点不达标」在它眼里等价。为此单独建 `scripts/accessibility/axe-node-count.mjs`(由 `docs/acceptance/2026-09-21-axe/axe-contrast-evidence.mjs` 平移而来,证据 JSON 仍留在原目录):在 **chromium + firefox** 两个引擎 × **light + dark** 两个主题下逐页跑 `axe-core` 4.11.4(`wcag2a/wcag2aa/wcag21a/wcag21aa`),按**节点数**记账并落 `axe-evidence.json`。闸口同时成立才算过:`violationNodes` / `color-contrast` 节点数 = 0(四个组合任一 > 0 即判红)、`themeMismatch` = 0(回读 `document.documentElement[data-theme]`,防「以为在量深色其实还是浅色」)、`bgMismatch` = 0(`body` 底色须等于令牌值 light `rgb(255,255,255)` / dark `rgb(10,14,20)`,防样式未加载导致的「对比度意外达标」),外加规则级第二次 `runOnly` 的**分母断言**:`autocomplete-valid` / `presentation-role-conflict` / `svg-img-alt` 三条必须在**每一页 × 每一个组合**都被判定过(`Σ = 路由 × 4 × 3`,且 `extraRulePagesUnderCovered = 0`)——脚本里另有一份写死的下限清单,删掉运行列表中的一条规则会当场判红而不是悄悄少测。
|
||||
|
||||
> 🛠️ **settle 修复(TA-05,2026-10-24 落地 / 2026-11-26 核实入库)**:原 `settle()` 一次跳到底再回顶 400ms,
|
||||
> 会跳过中间的 IntersectionObserver 目标,`ScrollReveal` 元素停在 inline `opacity:0`;axe 把半透明文字
|
||||
> 读成低对比度,失败集合随并行漂移。现改为逐屏 `max(400, 0.8×viewport)`、每步 260ms + 双 rAF,
|
||||
> 回顶后等 `main *` 内「`opacity:0` 且 `display!==none` 且有高度」的元素清零(8s 超时**抛出**而非吞掉),
|
||||
> 最后等 `document.fonts.ready` + 300ms。判据要点:**超时必须抛** —— 「没量到」不许读作「通过」。
|
||||
|
||||
> 🛠️ **headings 分母扩容(2026-10-24 落地 / 2026-11-26 核实)**:`scripts/utils/check-heading-hierarchy.ts`
|
||||
> 的 `PAGES` 从 11 页扩到 **34 页**(35 条公开路由去掉按 404 契约的 `/_not-found`),
|
||||
> 与 `check:axe:routes` 的清单对齐。此前只扫 11 页,新增路由/详情页失踪时门禁仍然绿 ——
|
||||
> 这是「分母静默变小」的第三种形态(前两种是 axe 只取 sitemap、视觉只扫 15 页)。
|
||||
> 现取命令:`grep -c '{ path:' scripts/utils/check-heading-hierarchy.ts` ⇒ 34;
|
||||
> 实测 EXIT=0、**34/34 通过、0 问题**(需先 `npm run build`,脚本会直起 `dist/standalone/server.js`)。
|
||||
|
||||
**分母口径(2026-09-22 升级,勿再退回单取 sitemap)**:清单来源是 **`/sitemap.xml` ∪ 预渲染产物(`dist/standalone/dist/server/app/**/*.html`)∪ 站内链接 BFS(`scripts/accessibility/crawl-routes.mjs`,原 `docs/acceptance/2026-09-21-axe/crawl-sitemap.mjs`)**,最终树实测 **34 条路由**(`axe-evidence.json`:`routeCount=34`、`rows=136 = 34 × 4 组合`、`passed=true`)。`sitemap.xml` 只覆盖「希望被收录的页」,单独取用它即为口径错误——扩目录首轮当场挖出 `/_not-found` 与 `/_global-error` 两个真实缺口(见 `docs/lessons-learned.md` §5.24、`CONTEXT.md` 决策行)。历史对照:`axe-evidence-sitemap29.json`(29 页版,当时的 0 是真 0,但分母不足)。
|
||||
|
||||
**退出码即门禁判定**(不再只是打印 `PASSED`):`0` 通过 / `1` 判红(violation 节点 > 0、主题或底色不匹配、规则级通道分母不闭合、整组响应全非 2xx 的「你在扫 404」保险丝、扫描中途异常)/ `2` 输入不可用(路由清单缺失或解析出 0 条;爬虫侧同样在清单为空或 BASE 完全不可达时退出 2 且**不覆盖**上一份清单)。
|
||||
|
||||
@@ -129,9 +129,16 @@ test.describe('GA4 事件追踪验证', { tag: ['@analytics', '@regression', '@c
|
||||
|
||||
const consentDefault = callsWith(calls, 'consent', 'default');
|
||||
expect(consentDefault).toHaveLength(1);
|
||||
expect(params(consentDefault[0]).analytics_storage).toBe('granted');
|
||||
// DEF-09(2026-11-25 落地):分析 Cookie 默认改为 opt-in,default 必须是 denied。
|
||||
// 已存偏好(seedConsent 写 analytics:true)由内联片段在 config 之前以 consent update 放行,
|
||||
// 因此这里同时钉住「默认拒绝」与「偏好回放」两件事,缺任一件都是采集口径错了。
|
||||
expect(params(consentDefault[0]).analytics_storage).toBe('denied');
|
||||
expect(params(consentDefault[0]).ad_storage).toBe('denied');
|
||||
|
||||
const consentUpdates = callsWith(calls, 'consent', 'update');
|
||||
expect(consentUpdates.length).toBeGreaterThanOrEqual(1);
|
||||
expect(params(consentUpdates[consentUpdates.length - 1]).analytics_storage).toBe('granted');
|
||||
|
||||
const configs = callsWith(calls, 'config');
|
||||
expect(configs).toHaveLength(1);
|
||||
expect(configs[0]?.[1]).toBe(measurementId);
|
||||
|
||||
@@ -414,12 +414,14 @@ test.describe('UJ-10 Mobile: 深度搜索者旅程(分类浏览 → 逐篇阅
|
||||
await expect(companyNewsBtn).toBeVisible();
|
||||
await expect(devNewsBtn).toBeVisible();
|
||||
|
||||
// === Step 2: 点击"公司新闻"分类筛选 → 恰收窄到 1 篇 ===
|
||||
// === Step 2: 点击"公司新闻"分类筛选 → 种子公司新闻可见、研发新闻被过滤 ===
|
||||
// TA-11:共享副本库可能被写库用例插入额外新闻,用种子 slug 钉住过滤契约。
|
||||
await companyNewsBtn.click();
|
||||
await expect(page.locator('a[href*="/news/"]')).toHaveCount(1);
|
||||
await expect(page.locator('a[href="/news/company-founded"]')).toBeVisible();
|
||||
await expect(page.locator('a[href="/news/digital-transformation-solution"]')).toHaveCount(0);
|
||||
|
||||
// === Step 3: 阅读第一篇新闻文章 ===
|
||||
const firstArticle = page.locator('a[href*="/news/"]').first();
|
||||
const firstArticle = page.locator('a[href="/news/company-founded"]');
|
||||
await expect(firstArticle).toContainText('正式成立');
|
||||
await Promise.all([
|
||||
page.waitForURL(/\/news\/.+/, { timeout: 15000, waitUntil: 'commit' }),
|
||||
@@ -445,10 +447,11 @@ test.describe('UJ-10 Mobile: 深度搜索者旅程(分类浏览 → 逐篇阅
|
||||
const devNewsBtn2 = page.locator('button', { hasText: '研发动态' }).first();
|
||||
await expect(devNewsBtn2).toBeVisible();
|
||||
await devNewsBtn2.click();
|
||||
await expect(page.locator('a[href*="/news/"]')).toHaveCount(1);
|
||||
await expect(page.locator('a[href="/news/digital-transformation-solution"]')).toBeVisible();
|
||||
await expect(page.locator('a[href="/news/company-founded"]')).toHaveCount(0);
|
||||
|
||||
// === Step 5: 阅读第二篇新闻文章 ===
|
||||
const secondArticle = page.locator('a[href*="/news/"]').first();
|
||||
const secondArticle = page.locator('a[href="/news/digital-transformation-solution"]');
|
||||
await Promise.all([
|
||||
page.waitForURL(/\/news\/.+/, { timeout: 15000, waitUntil: 'commit' }),
|
||||
secondArticle.click(),
|
||||
@@ -470,13 +473,15 @@ test.describe('UJ-10 Mobile: 深度搜索者旅程(分类浏览 → 逐篇阅
|
||||
await expect(allBtn).toBeVisible();
|
||||
await allBtn.click();
|
||||
|
||||
// 全部种子新闻恰好 2 篇
|
||||
await expect(page.locator('a[href*="/news/"]')).toHaveCount(2);
|
||||
// 两个种子 slug 均可见(不约束总数)
|
||||
await expect(page.locator('a[href="/news/company-founded"]')).toHaveCount(1);
|
||||
await expect(page.locator('a[href="/news/digital-transformation-solution"]')).toHaveCount(1);
|
||||
|
||||
// 最终验证:搜索发现能力('数字化转型' 恰命中 1 篇)
|
||||
// 最终验证:搜索发现能力(命中研发种子、排除公司种子)
|
||||
const searchInput = page.getByLabel('搜索新闻');
|
||||
await expect(searchInput).toBeVisible();
|
||||
await searchInput.fill('数字化转型');
|
||||
await expect(page.locator('a[href*="/news/"]')).toHaveCount(1);
|
||||
await expect(page.locator('a[href="/news/digital-transformation-solution"]')).toBeVisible();
|
||||
await expect(page.locator('a[href="/news/company-founded"]')).toHaveCount(0);
|
||||
});
|
||||
});
|
||||
+16
-11
@@ -452,12 +452,16 @@ test.describe('UJ-10: 深度搜索者旅程(分类浏览 → 逐篇阅读 →
|
||||
await expect(companyNewsBtn).toBeVisible();
|
||||
await expect(devNewsBtn).toBeVisible();
|
||||
|
||||
// === Step 2: 点击「公司新闻」→ 列表应收窄到恰 1 篇 ===
|
||||
// === Step 2: 点击「公司新闻」→ 种子公司新闻可见、研发新闻被过滤 ===
|
||||
// TA-11:共享副本库里写库用例可能插入额外的「公司新闻」,不能再断言全局恰 1 条;
|
||||
// 过滤契约用两篇种子 slug 的可见/缺席来钉住 —— 这比数条数更具体:
|
||||
// 数条数只证明「有 1 条」,钉 slug 才证明「筛掉的是另一类」。
|
||||
await companyNewsBtn.click();
|
||||
await expect(page.locator('a[href*="/news/"]')).toHaveCount(1);
|
||||
await expect(page.locator('a[href="/news/company-founded"]')).toBeVisible();
|
||||
await expect(page.locator('a[href="/news/digital-transformation-solution"]')).toHaveCount(0);
|
||||
|
||||
// === Step 3: 阅读第一篇新闻文章 ===
|
||||
const firstArticle = page.locator('a[href*="/news/"]').first();
|
||||
const firstArticle = page.locator('a[href="/news/company-founded"]');
|
||||
await expect(firstArticle).toContainText('正式成立');
|
||||
await Promise.all([
|
||||
page.waitForURL(/\/news\/.+/, { timeout: 15000, waitUntil: 'commit' }),
|
||||
@@ -485,10 +489,11 @@ test.describe('UJ-10: 深度搜索者旅程(分类浏览 → 逐篇阅读 →
|
||||
const devNewsBtn2 = page.locator('button', { hasText: '研发动态' }).first();
|
||||
await expect(devNewsBtn2).toBeVisible();
|
||||
await devNewsBtn2.click();
|
||||
await expect(page.locator('a[href*="/news/"]')).toHaveCount(1);
|
||||
await expect(page.locator('a[href="/news/digital-transformation-solution"]')).toBeVisible();
|
||||
await expect(page.locator('a[href="/news/company-founded"]')).toHaveCount(0);
|
||||
|
||||
// === Step 5: 阅读第二篇新闻文章 ===
|
||||
const secondArticle = page.locator('a[href*="/news/"]').first();
|
||||
const secondArticle = page.locator('a[href="/news/digital-transformation-solution"]');
|
||||
await Promise.all([
|
||||
page.waitForURL(/\/news\/.+/, { timeout: 15000, waitUntil: 'commit' }),
|
||||
secondArticle.click(),
|
||||
@@ -512,16 +517,16 @@ test.describe('UJ-10: 深度搜索者旅程(分类浏览 → 逐篇阅读 →
|
||||
await expect(allBtn).toBeVisible();
|
||||
await allBtn.click();
|
||||
|
||||
// 全部种子新闻文章可见(恰 2 篇)
|
||||
await expect(page.locator('a[href*="/news/"]')).toHaveCount(2);
|
||||
// 两个种子 slug 均可见(不约束总数,避免写库用例插入的临时新闻造成假红)
|
||||
await expect(page.locator('a[href="/news/company-founded"]')).toHaveCount(1);
|
||||
await expect(page.locator('a[href="/news/digital-transformation-solution"]')).toHaveCount(1);
|
||||
|
||||
// 验证搜索功能(内容发现工具):输入命中词应精确收窄到 1 篇
|
||||
// 验证搜索功能(内容发现工具):命中词精确命中研发种子
|
||||
const searchInput = page.getByLabel('搜索新闻');
|
||||
await expect(searchInput).toBeVisible();
|
||||
await searchInput.fill('数字化转型');
|
||||
const searchResults = page.locator('a[href*="/news/"]');
|
||||
await expect(searchResults).toHaveCount(1);
|
||||
await expect(searchResults.first()).toContainText('数字化转型');
|
||||
await expect(page.locator('a[href="/news/digital-transformation-solution"]')).toBeVisible();
|
||||
await expect(page.locator('a[href="/news/company-founded"]')).toHaveCount(0);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -22,17 +22,35 @@ interface BoxLike {
|
||||
* 就会把「值拿到了但那一瞬间元素换了节点」误报成「元素在断言瞬间消失」。
|
||||
* ⇒ 改成在**同一次读取**里既判非空又产出值:读到非空立即返回,超时才 throw。
|
||||
* 判据强度不降:仍然要求最终拿到一个非空 box 并做几何断言,也没有 catch/静默通过。
|
||||
*
|
||||
* 2026-10-24(TA-12)第三次修:**非空 ≠ 已落定**。页面入场 transform 未结束时,
|
||||
* fixed header 的 boundingBox 会短暂偏移——实测抓到 29.936px 的中途值,
|
||||
* 断言把它当最终值判红/判绿都是错的读数。改为要求连续 5 次取样一致(`stable >= 4`)再返回。
|
||||
* 注意这不是「放宽判据」:它把「读到任意一帧」收紧成「读到稳定帧」,
|
||||
* 而超时仍然 throw(元素一直不存在 / 一直在动 ⇒ 用例失败)。
|
||||
*/
|
||||
async function pollBoundingBox(target: Locator, timeout = 5000): Promise<BoxLike> {
|
||||
const deadline = Date.now() + timeout;
|
||||
let lastMissing = 0;
|
||||
let last: BoxLike | null = null;
|
||||
let stable = 0;
|
||||
const near = (a: BoxLike, b: BoxLike) =>
|
||||
Math.abs(a.x - b.x) < 0.5 && Math.abs(a.y - b.y) < 0.5
|
||||
&& Math.abs(a.width - b.width) < 0.5 && Math.abs(a.height - b.height) < 0.5;
|
||||
for (;;) {
|
||||
const box = await target.boundingBox().catch(() => null);
|
||||
if (box) return box;
|
||||
lastMissing += 1;
|
||||
if (box) {
|
||||
stable = last && near(last, box) ? stable + 1 : 0;
|
||||
if (stable >= 4) return box;
|
||||
last = box;
|
||||
} else {
|
||||
last = null;
|
||||
stable = 0;
|
||||
lastMissing += 1;
|
||||
}
|
||||
if (Date.now() > deadline) {
|
||||
throw new Error(
|
||||
`boundingBox 在 ${timeout}ms 内始终为 null(轮询 ${lastMissing} 次全部拿不到几何 ⇒ 元素不存在或不可见)`,
|
||||
`boundingBox 在 ${timeout}ms 内未稳定(轮询 ${lastMissing} 次未拿到几何 ⇒ 元素不存在或不可见)`,
|
||||
);
|
||||
}
|
||||
await new Promise((r) => setTimeout(r, 50));
|
||||
|
||||
@@ -202,19 +202,42 @@ if (urls.length === 0) {
|
||||
fatal(`从 ${SITEMAP} 解析出 0 条路由,扫描等于没测,退出 2`, 2);
|
||||
}
|
||||
|
||||
// 2026-10-24(qa-tracker TA-05):原实现「一次跳到底 → 回顶 → 400ms」会跳过中间 IntersectionObserver 目标,
|
||||
// ScrollReveal 元素仍停在 inline opacity:0;axe 把半透明文字读成低对比度,失败集合随并行漂移。
|
||||
// 改为逐屏 260ms + 双 rAF 步进,并等 reveal 真正提交后再扫;超时**抛出而不是吞掉**,
|
||||
// 避免「等不到也照常出绿」——「没量到」不许读作「通过」。
|
||||
async function settle(page) {
|
||||
await page.waitForTimeout(1200);
|
||||
await page.waitForTimeout(600);
|
||||
await page.evaluate(async () => {
|
||||
let last = -1;
|
||||
for (let i = 0; i < 12; i += 1) {
|
||||
window.scrollTo(0, document.body.scrollHeight);
|
||||
await new Promise((r) => setTimeout(r, 180));
|
||||
if (Math.round(window.scrollY) === last) break;
|
||||
last = Math.round(window.scrollY);
|
||||
const nextFrame = () => new Promise((resolve) => requestAnimationFrame(() => requestAnimationFrame(resolve)));
|
||||
const step = Math.max(400, Math.floor(window.innerHeight * 0.8));
|
||||
for (let y = 0; y <= document.body.scrollHeight; y += step) {
|
||||
window.scrollTo(0, y);
|
||||
await new Promise((r) => setTimeout(r, 260));
|
||||
await nextFrame();
|
||||
}
|
||||
window.scrollTo(0, 0);
|
||||
await new Promise((r) => setTimeout(r, 400));
|
||||
});
|
||||
await page.waitForTimeout(400);
|
||||
|
||||
const pendingExpr = () => Array.from(document.querySelectorAll('main *')).filter((el) => {
|
||||
const s = getComputedStyle(el);
|
||||
return el.style.opacity === '0' && s.display !== 'none' && el.getBoundingClientRect().height > 0;
|
||||
});
|
||||
try {
|
||||
await page.waitForFunction(() => {
|
||||
const pending = Array.from(document.querySelectorAll('main *')).filter((el) => {
|
||||
const s = getComputedStyle(el);
|
||||
return el.style.opacity === '0' && s.display !== 'none' && el.getBoundingClientRect().height > 0;
|
||||
});
|
||||
return pending.length === 0;
|
||||
}, undefined, { timeout: 8000, polling: 100 });
|
||||
} catch {
|
||||
const total = await page.evaluate(`(${pendingExpr.toString()})().length`);
|
||||
throw new Error(`settle: ${total} 个元素仍停在 inline opacity:0(a11y 扫描会读到半透明态,拒绝出假读数)`);
|
||||
}
|
||||
await page.evaluate(() => document.fonts?.ready).catch(() => {});
|
||||
await page.waitForTimeout(300);
|
||||
}
|
||||
|
||||
const rows = [];
|
||||
|
||||
@@ -28,6 +28,32 @@ const PAGES = [
|
||||
// 双轴新增的洞察枢纽 —— 不登记就会出现「新页面没人扫,门禁仍然绿」的静默覆盖收缩
|
||||
{ path: "/insights", name: "洞察枢纽" },
|
||||
{ path: "/contact", name: "联系我们" },
|
||||
// 2026-10-24:与 check:axe:routes 的 35 条公开清单对齐(/_not-found 按 404 契约不参与标题层级)。
|
||||
// 此前只扫 11 页,新增路由/详情页失踪时门禁仍然绿,属于「分母静默变小」——
|
||||
// 这是本仓反复踩的那一族:**门禁的分母由人手维护时,它只会越来越小**。
|
||||
{ path: "/about/brand", name: "品牌资产页" },
|
||||
{ path: "/cases", name: "案例列表" },
|
||||
{ path: "/methodology", name: "方法论" },
|
||||
{ path: "/news/company-founded", name: "新闻详情-公司成立" },
|
||||
{ path: "/news/digital-transformation-solution", name: "新闻详情-数字化转型" },
|
||||
{ path: "/privacy", name: "隐私政策" },
|
||||
{ path: "/terms", name: "服务条款" },
|
||||
{ path: "/products/bi", name: "产品详情-BI" },
|
||||
{ path: "/products/cms", name: "产品详情-CMS" },
|
||||
{ path: "/products/crm", name: "产品详情-CRM" },
|
||||
{ path: "/products/erp-upgrade", name: "产品 ERP 升级页" },
|
||||
{ path: "/products/erp-upgrade-v3", name: "产品 ERP 升级页 V3" },
|
||||
{ path: "/products/oa", name: "产品详情-OA" },
|
||||
{ path: "/products/sds", name: "产品详情-SDS" },
|
||||
{ path: "/services/consulting", name: "服务详情-咨询" },
|
||||
{ path: "/services/data", name: "服务详情-数据" },
|
||||
{ path: "/services/solutions", name: "服务详情-解决方案" },
|
||||
{ path: "/solutions/education", name: "解决方案详情-教育" },
|
||||
{ path: "/solutions/finance", name: "解决方案详情-金融" },
|
||||
{ path: "/solutions/healthcare", name: "解决方案详情-医疗" },
|
||||
{ path: "/solutions/logistics", name: "解决方案详情-物流" },
|
||||
{ path: "/solutions/retail", name: "解决方案详情-零售" },
|
||||
{ path: "/team", name: "团队介绍" },
|
||||
];
|
||||
|
||||
interface HeadingIssue {
|
||||
|
||||
Reference in new issue
Block a user