Files
novalon-website/e2e/footer-beian-verify.spec.ts
T
zhangxiang 1c0ce5f458 chore(gates): DEC-N6 让 e2e 进类型口径,并修 pre-commit 位与证据路径覆盖历史
- 新增 e2e/tsconfig.json + `npm run type-check:e2e`(并入 test:all)。
  本轮实测证据:teardown 补丁里第二个 `const revalidateSecret` 与既有声明重名,
  `npm run type-check` 全程 EXIT=0,只有 `playwright test --list` 才报重复声明 ——
  现在静态期就能抓。读数:type-check:e2e EXIT=0。
- .husky/pre-commit 的索引模式改回 100755(本轮每次提交都在打
  "was ignored because it's not set as executable",即 lint-staged 在任何克隆里都不执行)。
  验证看 `git ls-files -s .husky` 的 mode,不是看文件系统权限。
- axe 证据落盘改为按运行轮次分目录(原写死 docs/acceptance/2026-09-21-axe/axe-evidence.json,
  于是每跑一次就覆盖一次历史:0157b1c9 里那 409 行 diff 就是这么产生的),
  并补 check:axe:selftest;判定逻辑与退出码三档语义未动。
- 顺带修一处仪器级缺陷:package.json 里 `type-check:e2e` 被写了两遍 ——
  JSON 重复键是后者静默覆盖前者,不会报错也不会判红,正是本仓反复吃的"重复声明"类。
  现取键数与值由 node 回读校验。
2026-10-17 07:54:21 +08:00

56 lines
2.4 KiB
TypeScript
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.
import { test, expect } from './fixtures';
test.describe('Footer ICP/Police BeiAn Visibility', { tag: '@regression' }, () => {
test('desktop: ICP and police bei an should be visible', async ({ page }) => {
await page.setViewportSize({ width: 1440, height: 900 });
await page.goto('/', { waitUntil: 'domcontentloaded' });
await page.evaluate(() => window.scrollTo(0, document.body.scrollHeight));
await page.waitForTimeout(500);
const icp = page.getByText(/蜀ICP备/);
const police = page.getByText(/川公网安备/);
await expect(icp).toBeVisible();
await expect(police).toBeVisible();
const icpBox = await icp.boundingBox();
const policeBox = await police.boundingBox();
console.log('桌面端 ICP位置:', icpBox);
console.log('桌面端 公安备案位置:', policeBox);
});
test('mobile: ICP and police bei an should be visible above tab bar', async ({ page }) => {
await page.setViewportSize({ width: 390, height: 844 });
await page.goto('/', { waitUntil: 'domcontentloaded' });
await page.evaluate(() => window.scrollTo(0, document.body.scrollHeight));
await page.waitForTimeout(500);
const icp = page.getByText(/蜀ICP备/);
const police = page.getByText(/川公网安备/);
await expect(icp).toBeVisible();
await expect(police).toBeVisible();
const icpBox = await icp.boundingBox();
const policeBox = await police.boundingBox();
const viewport = page.viewportSize();
// DEC-N6 补口带出的类型口径修正:Page.viewportSize() 的返回类型是 `{width,height} | null`。
// 本项目在 playwright.config.ts 里显式设了 viewport,取不到只会是装配异常;旧代码在此处
// 直接 `viewport.height`,null 分支本来就是 TypeError 崩溃 ⇒ 改成显式抛错,消息可读、行为等价。
if (!viewport) throw new Error('viewportSize() 返回 null:chromium-mobile 项目应有显式 viewport');
console.log('移动端 ICP位置:', icpBox);
console.log('移动端 公安备案位置:', policeBox);
console.log('移动端 视口高度:', viewport.height);
// 确保备案信息在视口内(底部tab bar高度约64px + safe area)
const tabBarEstimatedBottom = viewport.height;
if (icpBox) {
console.log('ICP底部距离视口底部:', tabBarEstimatedBottom - (icpBox.y + icpBox.height));
}
});
});