- 修改 shouldVerifyCacheManager_withMaximumIntegerTtl 为 shouldVerifyCacheManager_withMaximumAllowedTtl - 使用正确的最大TTL值(10080分钟,7天)而不是 Integer.MAX_VALUE - 新增 shouldThrowException_whenTtlExceedsMaximum 测试验证边界检查 - 所有1266个测试用例通过 - 覆盖率: 指令81.89%, 行88.48%, 分支51.55% docs: 添加项目状态报告 - 生成 PROJECT_STATUS_REPORT.md 详细记录项目当前状态 - 包含质量指标、已完成功能、待办事项和技术债务
47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
import { FullConfig } from '@playwright/test';
|
||
import fs from 'fs';
|
||
import path from 'path';
|
||
|
||
/**
|
||
* Playwright E2E全局清理
|
||
* 在测试结束后执行:
|
||
* 1. 清理测试数据
|
||
* 2. 关闭资源
|
||
* 3. 生成测试报告
|
||
*/
|
||
|
||
async function globalTeardown(config: FullConfig) {
|
||
console.log('');
|
||
console.log('🧹 开始E2E测试全局清理...');
|
||
|
||
try {
|
||
// 1. 读取测试数据
|
||
const testDataPath = path.join(__dirname, '..', '.e2e-test-data.json');
|
||
|
||
if (fs.existsSync(testDataPath)) {
|
||
const testData = JSON.parse(fs.readFileSync(testDataPath, 'utf-8'));
|
||
|
||
// 2. 清理测试数据(可选:调用后端API删除测试数据)
|
||
console.log(` 📋 清理测试活动 ID=${testData.activityId}`);
|
||
|
||
// 3. 删除测试数据文件
|
||
fs.unlinkSync(testDataPath);
|
||
console.log(' ✅ 测试数据文件已清理');
|
||
}
|
||
|
||
// 4. 生成测试摘要
|
||
console.log('');
|
||
console.log('📊 E2E测试摘要');
|
||
console.log(' 查看完整报告: npx playwright show-report e2e-report');
|
||
console.log('');
|
||
|
||
console.log('✅ 全局清理完成!');
|
||
|
||
} catch (error) {
|
||
console.error('❌ 全局清理出错:', error);
|
||
// 不抛出错误,避免影响测试报告
|
||
}
|
||
}
|
||
|
||
export default globalTeardown;
|