refactor: reorganize project structure and improve code quality
- Move CI/CD configs to config/ci/ directory - Reorganize scripts into categorized directories (deployment, monitoring, testing, utils) - Consolidate documentation into docs/ directory with proper structure - Update linting and testing configurations - Remove obsolete test reports and performance summaries - Add new documentation for code quality tools and contact form security - Improve project organization and maintainability - Fix lint-staged config to only lint JS/TS files - Disable react/react-in-jsx-scope rule for Next.js compatibility - Ignore scripts and test config directories in ESLint
This commit is contained in:
@@ -0,0 +1,123 @@
|
||||
# 测试框架整合说明
|
||||
|
||||
## 背景
|
||||
|
||||
项目原本存在三个独立的测试框架:
|
||||
1. **e2e/** - Playwright TypeScript测试框架(主要框架)
|
||||
2. **e2e-tests/** - Python Playwright测试框架(已废弃)
|
||||
3. **test-framework/** - 共享测试框架(已废弃)
|
||||
|
||||
## 整合决策
|
||||
|
||||
### 保留的测试框架
|
||||
- **e2e/** - 作为主要测试框架
|
||||
- 完整的测试套件(冒烟、回归、性能、可访问性、安全、视觉、移动端、响应式、API、集成、管理后台等)
|
||||
- TypeScript与项目技术栈一致
|
||||
- 完善的配置和工具链
|
||||
- 丰富的测试用例和Page Object模型
|
||||
|
||||
### 废弃的测试框架
|
||||
- **e2e-tests/** - Python Playwright测试框架
|
||||
- 基础测试套件
|
||||
- 与项目技术栈不一致
|
||||
- 维护成本高
|
||||
|
||||
- **test-framework/** - 共享测试框架
|
||||
- 简单的E2E测试
|
||||
- 功能重复
|
||||
- 缺少维护
|
||||
|
||||
## 迁移说明
|
||||
|
||||
### 已迁移的内容
|
||||
以下测试用例已从废弃框架迁移到e2e/:
|
||||
|
||||
#### 从e2e-tests/迁移
|
||||
- 基础页面测试(首页、联系页面)
|
||||
- 导航测试
|
||||
- 性能测试(基础)
|
||||
- 响应式测试(基础)
|
||||
|
||||
#### 从test-framework/迁移
|
||||
- 可访问性测试
|
||||
- 性能测试
|
||||
- SEO测试
|
||||
- 联系页面测试
|
||||
|
||||
### 未迁移的内容
|
||||
以下内容未迁移,因为e2e/中已有更完善的实现:
|
||||
|
||||
#### e2e-tests/中未迁移
|
||||
- Python特定的测试工具和辅助函数
|
||||
- Python报告生成器
|
||||
- Python日志系统
|
||||
|
||||
#### test-framework/中未迁移
|
||||
- 简单的测试用例(e2e/中已有更完善的版本)
|
||||
- 共享的页面对象(已整合到e2e/中)
|
||||
|
||||
## 使用指南
|
||||
|
||||
### 运行测试
|
||||
|
||||
```bash
|
||||
# 运行所有E2E测试
|
||||
npm run test
|
||||
|
||||
# 运行冒烟测试
|
||||
npm run test:smoke
|
||||
|
||||
# 运行回归测试
|
||||
npm run test:tier:standard
|
||||
|
||||
# 运行性能测试
|
||||
npm run test:performance
|
||||
|
||||
# 运行可访问性测试
|
||||
cd e2e && npx playwright test --grep @accessibility
|
||||
|
||||
# 运行安全测试
|
||||
cd e2e && npx playwright test --grep @security
|
||||
|
||||
# 运行视觉回归测试
|
||||
cd e2e && npx playwright test --grep @visual
|
||||
```
|
||||
|
||||
### 测试配置
|
||||
|
||||
主要配置文件位于e2e/目录:
|
||||
- `playwright.config.ts` - 主配置文件
|
||||
- `playwright.config.admin.ts` - 管理后台测试配置
|
||||
- `playwright.config.tiered.ts` - 分层测试配置
|
||||
- `playwright.coverage.config.ts` - 覆盖率测试配置
|
||||
|
||||
### 测试报告
|
||||
|
||||
测试报告位于e2e/playwright-report/目录:
|
||||
```bash
|
||||
# 查看测试报告
|
||||
cd e2e && npm run test:report
|
||||
```
|
||||
|
||||
## 废弃框架处理
|
||||
|
||||
### e2e-tests/目录
|
||||
- **状态**: 已废弃
|
||||
- **操作**: 已添加到.gitignore
|
||||
- **保留原因**: 保留历史记录,便于参考
|
||||
|
||||
### test-framework/目录
|
||||
- **状态**: 已废弃
|
||||
- **操作**: 已添加到.gitignore
|
||||
- **保留原因**: 保留历史记录,便于参考
|
||||
|
||||
## 迁移日期
|
||||
2026-03-24
|
||||
|
||||
## 相关文档
|
||||
- [E2E测试文档](../e2e/README.md)
|
||||
- [测试策略](../docs/testing-strategy.md)
|
||||
- [测试最佳实践](../docs/testing-best-practices.md)
|
||||
|
||||
## 问题反馈
|
||||
如有测试相关问题,请联系开发团队。
|
||||
Reference in New Issue
Block a user