AI_UIAutomation/scripts/run-aihub-android.ts

38 lines
1.2 KiB
TypeScript

import { execSync } from 'child_process';
import { TestReporter } from '../utils/test-reporter';
TestReporter.clearSharedResults();
const testFiles = [
'tests/aihub/aihub_connect.test.ts',
'tests/aihub/aihub_setting.test.ts',
'tests/aihub/aihub_aicam.test.ts',
'tests/aihub/aihub_detection.test.ts',
'tests/aihub/aihub_playback.test.ts',
'tests/aihub/aihub_local_storage.test.ts',
'tests/aihub/aihub_camera_bind.test.ts',
];
console.log(`\n${'='.repeat(60)}`);
console.log(` AIHub Android 全量测试 - ${testFiles.length} 个测试文件`);
console.log(`${'='.repeat(60)}\n`);
for (const file of testFiles) {
console.log(`\n▶ 执行: ${file}`);
console.log('-'.repeat(50));
try {
execSync(`npx vitest run ${file} --reporter=verbose`, {
cwd: '/Users/woan/Desktop/AI_UIAutomation',
stdio: 'inherit',
timeout: 600000,
env: { ...process.env, PLATFORM: 'android' },
});
console.log(`${file} 完成`);
} catch (e: any) {
console.log(`${file} 部分用例失败 (继续执行下一个文件)`);
}
}
const reportPath = TestReporter.generateCombinedReport('AIHub_Android');
console.log(`\n报告已生成: ${reportPath}`);