feat: 简化测试场景,提高稳定性

- 创建独立的global-teardown.ts文件
- 增加测试间隔(每个测试后等待2秒)
- 添加后端健康检查,确保服务可用
- 优化测试隔离,清理localStorage和sessionStorage
- 降低后端负载,提高测试稳定性
This commit is contained in:
张翔
2026-04-04 13:43:25 +08:00
parent aedca1cf85
commit 80c4e56e0c
2 changed files with 18 additions and 19 deletions
@@ -39,6 +39,23 @@ test.describe('系统全面集成测试', () => {
localStorage.clear();
sessionStorage.clear();
});
// 检查后端服务健康状态
try {
const response = await fetch('http://localhost:8084/actuator/health', {
signal: AbortSignal.timeout(5000)
} as any);
if (!response.ok) {
console.log('⚠️ 后端服务健康检查失败,等待恢复...');
await page.waitForTimeout(5000);
}
} catch (error) {
console.log('⚠️ 后端服务无响应,等待恢复...');
await page.waitForTimeout(5000);
}
// 增加测试间隔,让后端服务有时间恢复
await page.waitForTimeout(2000);
});
test.describe('1. 用户认证流程测试', () => {