feat: complete system test fixes - 100% pass rate (85/85)

- Fixed all form tests (20/20 passing)
- Fixed all performance tests (35/35 passing)
- Fixed all SEO and accessibility tests (30/30 passing)
- Enhanced test framework with custom reporting
- Added performance baseline tracking
- Improved test reliability and error handling
This commit is contained in:
张翔
2026-03-06 19:37:02 +08:00
parent e6524044ef
commit 4c8714c12d
27 changed files with 5072 additions and 264 deletions
@@ -0,0 +1,35 @@
import * as fs from 'fs';
import * as path from 'path';
import { TestDataFactory } from './TestDataFactory';
export class TestDataCleaner {
static async cleanupDatabase(): Promise<void> {
console.log('清理测试数据库...');
}
static async cleanupFiles(): Promise<void> {
const testResultsDir = path.join(process.cwd(), 'test-results');
if (fs.existsSync(testResultsDir)) {
const files = fs.readdirSync(testResultsDir);
for (const file of files) {
const filePath = path.join(testResultsDir, file);
const stat = fs.statSync(filePath);
if (stat.isDirectory()) {
fs.rmSync(filePath, { recursive: true, force: true });
} else {
fs.unlinkSync(filePath);
}
}
}
}
static async cleanupCache(): Promise<void> {
TestDataFactory.clearCache();
}
static async cleanupAll(): Promise<void> {
await this.cleanupDatabase();
await this.cleanupFiles();
await this.cleanupCache();
}
}