test(qa): e2e 装配修正 + 集成/门禁测试与工具链重构

- e2e:修死选择器与蜜罐误命中、补断言、GA4/security-headers 用例诚实标注
  skip 边界;新增 assert-helpers/fixtures/hydrated/primary-nav/touch-targets
  等复用桩。
- 集成层:config/test/jest.integration.config.js + tests-integration/ 真库
  一次性 SQLite 用例,teardown 守卫开发库指纹。
- 门禁工具链:jest.setup 归位到根、scripts/accessibility 全站 axe 节点计数、
  check-brand-text-token/check-motion-constraints 机械守卫、stryker/lighthouse
  配置收敛。
This commit is contained in:
2026-09-28 10:48:08 +08:00
parent a366bd1400
commit 6bb7c557ee
142 changed files with 6597 additions and 2653 deletions
+12 -7
View File
@@ -1,4 +1,4 @@
import { test, expect, type Page } from '@playwright/test';
import { test, expect, type Page } from './fixtures';
/**
* UJ-08: 服务探索者旅程
@@ -9,6 +9,10 @@ import { test, expect, type Page } from '@playwright/test';
test.setTimeout(90000);
// 本套件走桌面导航(desktop-navigation 在 md 断点以下 display:none):
// 固定桌面视口,使 chromium-mobile 项目也按用例真实语义验证引擎而非布局。
test.use({ viewport: { width: 1440, height: 900 } });
// ==================== 辅助函数 ====================
/**
@@ -124,14 +128,15 @@ test.describe('UJ-08: 服务探索者旅程(服务列表 → 服务详情 →
break;
}
}
// 服务详情页的信任区域可能为"查看案例"链接而非文本块,软验证
// 服务详情页的信任区域可能为"查看案例"链接而非文本块。
// N-27 修复:原 `isVisible().catch(() => false)` 把定位器/基础设施异常吞成
// 「链接不存在」,回退校验只在异常路径之外才被读到 ⇒ 改为无条件执行路径上的
// 硬断言:链接消失 ⇒ toBeVisible 超时判红;基础设施异常 ⇒ 原样抛出,不再伪装。
if (!hasTrustSection) {
const caseLink = page.locator('a:has-text("查看案例")').first();
const hasCaseLink = await caseLink.isVisible().catch(() => false);
if (hasCaseLink) {
hasTrustSection = true;
console.log('UJ-08: 找到"查看案例"链接作为信任证明');
}
await expect(caseLink, '服务详情页信任区域应含文本关键词或"查看案例"链接').toBeVisible({ timeout: 5000 });
hasTrustSection = true;
console.log('UJ-08: 找到"查看案例"链接作为信任证明');
}
expect(hasTrustSection).toBe(true);