4ec1a3f4dd
refactor(测试): 重构用户数据加载逻辑以支持数组格式 fix(数据库): 修正数据库连接配置和凭证 test: 添加新的导航和用户管理测试场景 docs: 生成UAT测试报告和最终报告 ci: 更新Woodpecker CI配置和测试命令 build: 添加application-test.yml配置文件 chore: 清理旧的测试场景文件
48 lines
1.5 KiB
JavaScript
48 lines
1.5 KiB
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
console.log('🚦 Checking UAT Quality Gate...');
|
|
|
|
const resultsPath = path.join(__dirname, 'test-results');
|
|
const lastRunPath = path.join(resultsPath, 'artifacts', '.last-run.json');
|
|
|
|
console.log('📁 Looking for results in:', resultsPath);
|
|
console.log('📄 Expected last-run file:', lastRunPath);
|
|
|
|
if (!fs.existsSync(resultsPath)) {
|
|
console.log('❌ Test results directory not found!');
|
|
process.exit(1);
|
|
}
|
|
|
|
if (!fs.existsSync(lastRunPath)) {
|
|
console.log('❌ Last run results not found!');
|
|
console.log('📁 Available files:', fs.readdirSync(resultsPath));
|
|
process.exit(1);
|
|
}
|
|
|
|
try {
|
|
const lastRun = JSON.parse(fs.readFileSync(lastRunPath, 'utf-8'));
|
|
|
|
console.log('📊 UAT Test Results:');
|
|
console.log(` Status: ${lastRun.status}`);
|
|
console.log(` Failed Tests: ${lastRun.failedTests.length}`);
|
|
|
|
if (lastRun.failedTests.length > 0) {
|
|
console.log('❌ Quality Gate FAILED:');
|
|
console.log(` - ${lastRun.failedTests.length} test(s) failed`);
|
|
lastRun.failedTests.forEach(test => console.log(` - ${test}`));
|
|
process.exit(1);
|
|
} else if (lastRun.status === 'passed') {
|
|
console.log('✅ Quality Gate PASSED');
|
|
console.log('🎉 All UAT tests meet quality standards!');
|
|
} else {
|
|
console.log('⚠️ Quality Gate WARNING:');
|
|
console.log(` - Test status: ${lastRun.status}`);
|
|
process.exit(1);
|
|
}
|
|
|
|
} catch (error) {
|
|
console.log('❌ Error reading test results:', error.message);
|
|
process.exit(1);
|
|
}
|