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:
@@ -125,12 +125,19 @@ export default defineConfig({
|
||||
},
|
||||
],
|
||||
webServer: {
|
||||
// 使用 dev server 以支持 API 路由(admin 用户旅程等测试需要)
|
||||
// 若只运行非 API 测试(如 @journey @regression),可手动启动 npm run preview 并设置 reuseExistingServer: true
|
||||
command: 'npm run dev',
|
||||
// E2E_TARGET=production 时打构建产物(验收 A-10:dev server 下预渲染、ISR、生产响应头
|
||||
// 与构建期才暴露的问题永不被测)。dev 仍是默认目标,因为多数用例依赖热更新提速。
|
||||
// 产物是 output:'standalone',Next 16 明确告警 `"next start" does not work with
|
||||
// "output: standalone"` ⇒ 生产目标必须直接起 dist/standalone/server.js,否则测的是不受支持的降级路径。
|
||||
command:
|
||||
process.env.E2E_TARGET === 'production'
|
||||
? 'HOSTNAME=localhost PORT=3000 node dist/standalone/server.js'
|
||||
: 'npm run dev',
|
||||
url: 'http://localhost:3000',
|
||||
reuseExistingServer: true,
|
||||
timeout: 120000,
|
||||
// 复用已有服务会让「测的是当前代码」这一前提失效(门禁脚本曾把 next-server 留在 :3000 达
|
||||
// 39 分钟),故 CI 与 production 目标一律新起服务。
|
||||
reuseExistingServer: !process.env.CI && process.env.E2E_TARGET !== 'production',
|
||||
timeout: 180000,
|
||||
cwd: '..',
|
||||
env: {
|
||||
CMS_REVALIDATE_SECRET: process.env.CMS_REVALIDATE_SECRET || 'e2e-test-secret',
|
||||
|
||||
Reference in New Issue
Block a user