Upgrade Playwright suite to v2.5.1 SQLite deep testing
This commit is contained in:
@@ -1,8 +1,30 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { spawnSync } = require('child_process');
|
||||
|
||||
const sqliteDb = process.env.SQLITE_RESULTS_DB || 'results/uat_vapt_results.sqlite';
|
||||
const outPath = 'results/merged-results.json';
|
||||
|
||||
function exportFromSqliteIfAvailable() {
|
||||
if (!fs.existsSync(sqliteDb)) return false;
|
||||
const result = spawnSync('python3', ['scripts/sqlite_db.py', '--db', sqliteDb, '--output', outPath, 'export-json'], {
|
||||
cwd: process.cwd(),
|
||||
encoding: 'utf8',
|
||||
env: process.env,
|
||||
});
|
||||
if (result.status === 0) {
|
||||
console.log((result.stdout || '').trim());
|
||||
console.log(`Wrote ${outPath} from SQLite database ${sqliteDb}`);
|
||||
return true;
|
||||
}
|
||||
console.warn('SQLite export failed, falling back to Playwright JSON:', result.stderr || result.stdout);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (exportFromSqliteIfAvailable()) process.exit(0);
|
||||
|
||||
const matrix = JSON.parse(fs.readFileSync('data/generated-test-matrix.json','utf8'));
|
||||
const resultPath = 'results/playwright-results.json';
|
||||
const outPath = 'results/merged-results.json';
|
||||
let results = {};
|
||||
if (fs.existsSync(resultPath)) {
|
||||
const raw = JSON.parse(fs.readFileSync(resultPath,'utf8'));
|
||||
@@ -21,4 +43,4 @@ if (fs.existsSync(resultPath)) {
|
||||
const merged = matrix.map(v => ({...v, result: results[v.variantId] || (v.automation === 'manual' ? 'manual' : 'not_run')}));
|
||||
fs.mkdirSync(path.dirname(outPath), {recursive:true});
|
||||
fs.writeFileSync(outPath, JSON.stringify(merged,null,2));
|
||||
console.log(`Wrote ${outPath}`);
|
||||
console.log(`Wrote ${outPath} from Playwright JSON fallback`);
|
||||
|
||||
Reference in New Issue
Block a user