Skip to content

chore(e2e): enable global console error detection for mock tests - #209

Merged
Gaubee merged 1 commit into
mainfrom
chore/e2e-use-error-fixtures
Jan 10, 2026
Merged

Gaubee merged 1 commit into
mainfrom
chore/e2e-use-error-fixtures

Conversation

@Gaubee

@Gaubee Gaubee commented Jan 10, 2026

Copy link
Copy Markdown
Contributor

Summary

启用全局控制台错误检测,确保 E2E 测试能捕获所有未处理的控制台错误。

Changes

更新所有 mock 测试文件

将 12 个 *.mock.spec.ts 文件的导入从:

import { test, expect } from '@playwright/test'

改为:

import { test, expect } from './fixtures'

更新 fixtures.ts

  • 添加使用说明文档
  • 导出 Page 类型以便测试文件使用

效果

现在所有 mock 测试会自动:

  1. 收集控制台错误(排除已知的 React 警告、Vite HMR 等)
  2. 收集未捕获的 JavaScript 错误
  3. 测试结束时断言无错误

Testing

  • pnpm e2e:runner authorize.mock pages.mock 通过
  • 截图基准已更新

- Update all *.mock.spec.ts files to import from './fixtures'
- This enables automatic console error and page error detection
- Update fixtures.ts to export Page type
- Update screenshot baselines
@Gaubee
Gaubee merged commit 50a473e into main Jan 10, 2026
5 checks passed
@Gaubee
Gaubee deleted the chore/e2e-use-error-fixtures branch January 10, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant