| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- /**
- * Playwright E2E 测试配置
- *
- * 运行 E2E 测试前需要:
- * 1. 启动后端服务:cd cfc-backend && mvn spring-boot:run
- * 2. 启动前端 H5:cd cfc-frontend && npm run dev:h5
- *
- * 运行测试:
- * npx playwright test # 运行所有测试
- * npx playwright test tests/e2e/assessment # 运行指定测试文件
- * npx playwright test --grep "场景1" # 运行包含特定场景的测试
- */
- module.exports = {
- testDir: './e2e',
- timeout: 60000,
- retries: 0,
- use: {
- // uni-app H5 dev server (默认 8080)
- baseURL: 'http://localhost:8080',
- headless: true,
- viewport: { width: 375, height: 812 }, // iPhone X 尺寸
- ignoreHTTPSErrors: true,
- // 等待策略
- actionTimeout: 15000,
- navigationTimeout: 30000,
- },
- projects: [
- {
- name: 'chromium',
- use: { browserName: 'chromium' },
- },
- {
- name: 'webkit',
- use: { browserName: 'webkit' },
- },
- ],
- reporter: [
- ['html', { outputFolder: 'playwright-report' }],
- ['list'],
- ],
- // 全局测试钩子
- globalSetup: async () => {
- // 确保测试环境就绪
- },
- globalTeardown: async () => {
- // 清理测试数据
- },
- }
|