feat: 修复测试套件问题并添加Woodpecker CI配置
- 修复API测试认证问题:创建全局认证设置,更新Playwright配置 - 优化回归测试稳定性:增加超时时间到15秒,修复定位器 - 创建Woodpecker CI工作流:CI、部署和质量门禁配置 - 添加Jest配置和测试脚本 - 移除登录页面的默认账号密码显示(安全问题修复)
This commit is contained in:
@@ -6,7 +6,7 @@ export class CustomReporter {
|
||||
private results: any[] = [];
|
||||
private startTime: number = Date.now();
|
||||
|
||||
onBegin(config: any, suite: Suite) {
|
||||
onBegin(_config: any, suite: Suite) {
|
||||
console.log('\n=== 测试执行开始 ===');
|
||||
console.log(`测试套件: ${suite.allTests().length} 个测试`);
|
||||
}
|
||||
@@ -38,7 +38,7 @@ export class CustomReporter {
|
||||
return 'form';
|
||||
}
|
||||
|
||||
private generateCustomReport(result: FullResult, duration: number): string {
|
||||
private generateCustomReport(_result: FullResult, duration: number): string {
|
||||
const passed = this.results.filter(r => r.status === 'passed').length;
|
||||
const failed = this.results.filter(r => r.status === 'failed').length;
|
||||
const passRate = ((passed / this.results.length) * 100).toFixed(2);
|
||||
|
||||
@@ -1,15 +1,28 @@
|
||||
import { TestResult, PerformanceMetrics, ComparisonResult } from '../../types/reporting';
|
||||
import { TestResult, PerformanceMetrics, ComparisonResult, PerformanceBaseline as PerformanceBaselineType } from '../../types/reporting';
|
||||
|
||||
export class PerformanceBaseline {
|
||||
private baseline: Map<string, PerformanceMetrics> = new Map();
|
||||
|
||||
calculate(results: TestResult[]): PerformanceBaseline {
|
||||
calculate(results: TestResult[]): PerformanceBaselineType {
|
||||
results.forEach(result => {
|
||||
if (result.type === 'performance' && result.metrics) {
|
||||
this.updateBaseline(result);
|
||||
}
|
||||
});
|
||||
return this;
|
||||
|
||||
const firstBaseline = this.baseline.values().next().value;
|
||||
return {
|
||||
timestamp: Date.now(),
|
||||
metrics: firstBaseline || {
|
||||
loadTime: 0,
|
||||
domContentLoaded: 0,
|
||||
firstContentfulPaint: 0,
|
||||
largestContentfulPaint: 0,
|
||||
cumulativeLayoutShift: 0,
|
||||
firstInputDelay: 0
|
||||
},
|
||||
url: ''
|
||||
};
|
||||
}
|
||||
|
||||
private updateBaseline(result: TestResult): void {
|
||||
|
||||
Reference in New Issue
Block a user