feat: 添加测试框架和覆盖率报告功能
feat(测试): 新增Playwright和Vitest测试配置 feat(测试): 添加测试覆盖率报告生成功能 feat(测试): 实现前后端测试脚本集成 fix(测试): 修复测试密码不匹配问题 fix(测试): 修正URL等待策略 fix(测试): 调整错误消息选择器 refactor(测试): 重构测试目录结构 refactor(测试): 优化测试用例组织方式 docs: 更新测试报告文档 docs: 添加测试覆盖率报告模板 ci: 添加Docker测试环境配置 ci: 实现测试自动化脚本 chore: 更新依赖版本 chore: 添加测试相关配置文件
This commit is contained in:
@@ -1,32 +1,34 @@
|
||||
import { defineConfig, devices } from '@playwright/test';
|
||||
|
||||
const isHeadless = process.env.PLAYWRIGHT_HEADLESS === 'true' || process.env.CI === 'true';
|
||||
const baseURL = process.env.TEST_BASE_URL || process.env.VITE_BASE_URL || 'http://localhost:3001';
|
||||
|
||||
export default defineConfig({
|
||||
testDir: './e2e',
|
||||
fullyParallel: true,
|
||||
forbidOnly: !!process.env.CI,
|
||||
retries: process.env.CI ? 2 : 1,
|
||||
workers: process.env.CI ? 2 : 4,
|
||||
retries: 2,
|
||||
workers: process.env.CI ? 4 : 6,
|
||||
reporter: [
|
||||
['html', { outputFolder: 'playwright-report' }],
|
||||
['json', { outputFile: 'test-results/results.json' }],
|
||||
['junit', { outputFile: 'test-results/junit.xml' }],
|
||||
['list']
|
||||
['list'],
|
||||
['./e2e/customReporter.ts']
|
||||
],
|
||||
|
||||
timeout: 60000,
|
||||
timeout: 90000,
|
||||
expect: {
|
||||
timeout: 10000
|
||||
timeout: 20000
|
||||
},
|
||||
|
||||
use: {
|
||||
baseURL: 'http://localhost:3001',
|
||||
trace: 'retain-on-failure',
|
||||
baseURL: baseURL,
|
||||
trace: process.env.CI ? 'retain-on-failure' : 'off',
|
||||
screenshot: 'only-on-failure',
|
||||
video: 'retain-on-failure',
|
||||
actionTimeout: 15000,
|
||||
navigationTimeout: 30000,
|
||||
video: process.env.CI ? 'retain-on-failure' : 'off',
|
||||
actionTimeout: 30000,
|
||||
navigationTimeout: 60000,
|
||||
headless: isHeadless,
|
||||
locale: 'zh-CN',
|
||||
timezoneId: 'Asia/Shanghai',
|
||||
|
||||
Reference in New Issue
Block a user