feat: 添加测试框架和覆盖率报告功能
feat(测试): 新增Playwright和Vitest测试配置 feat(测试): 添加测试覆盖率报告生成功能 feat(测试): 实现前后端测试脚本集成 fix(测试): 修复测试密码不匹配问题 fix(测试): 修正URL等待策略 fix(测试): 调整错误消息选择器 refactor(测试): 重构测试目录结构 refactor(测试): 优化测试用例组织方式 docs: 更新测试报告文档 docs: 添加测试覆盖率报告模板 ci: 添加Docker测试环境配置 ci: 实现测试自动化脚本 chore: 更新依赖版本 chore: 添加测试相关配置文件
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
FROM mcr.microsoft.com/playwright:v1.58.2-jammy
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 安装依赖
|
||||
COPY package*.json ./
|
||||
RUN npm ci
|
||||
|
||||
# 复制测试文件
|
||||
COPY e2e ./e2e
|
||||
COPY playwright.config.ts ./
|
||||
COPY tsconfig.json ./
|
||||
|
||||
# 创建测试结果目录
|
||||
RUN mkdir -p /app/test-results /app/playwright-report
|
||||
|
||||
# 安装Playwright浏览器
|
||||
RUN npx playwright install --with-deps chromium
|
||||
|
||||
# 设置环境变量
|
||||
ENV CI=true
|
||||
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
|
||||
|
||||
# 运行测试
|
||||
CMD ["npx", "playwright", "test", "--reporter=json", "--reporter=html", "--reporter=junit"]
|
||||
|
||||
# 健康检查
|
||||
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
|
||||
CMD test -f /app/playwright-report/index.html || exit 1
|
||||
Reference in New Issue
Block a user