const fs = require('fs'); const path = require('path'); 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')); function walk(suite) { for (const spec of suite.specs || []) { for (const test of spec.tests || []) { const title = spec.title; const m = title.match(/\[([^\]]+)\]/); if (m) results[m[1]] = test.outcome || test.status || 'unknown'; } } for (const child of suite.suites || []) walk(child); } for (const s of raw.suites || []) walk(s); } 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}`);