From 6d8e570afc5001d115c85c5b70b284a2ca8f10b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ullrich=20Sch=C3=A4fer?= Date: Wed, 25 Mar 2026 00:44:28 +0100 Subject: [PATCH] Fix Playwright job summary: handle nested suite structure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Playwright JSON has file → describe → specs nesting. Use stats.expected/unexpected for counts, iterate nested suites. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/ci.yml | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1185839..19a57c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -186,24 +186,25 @@ jobs: if [ -f playwright-results.json ]; then node -e " const r = require('./playwright-results.json'); - const total = r.suites.reduce((n, s) => n + s.specs.length, 0); - const passed = r.suites.reduce((n, s) => n + s.specs.filter(t => t.ok).length, 0); - const failed = total - passed; - const dur = (r.stats.duration / 1000).toFixed(1); + const s = r.stats; + const dur = (s.duration / 1000).toFixed(1); let md = '## Playwright E2E Results\n\n'; md += '| Status | Count |\n|--------|-------|\n'; - md += '| :white_check_mark: Passed | ${passed} |\n'; - if (failed > 0) md += '| :x: Failed | ${failed} |\n'; - md += '| Total | ${total} |\n'; - md += '| Duration | ${dur}s |\n\n'; - for (const suite of r.suites) { - md += '### ' + suite.title + '\n\n'; - for (const spec of suite.specs) { - const icon = spec.ok ? ':white_check_mark:' : ':x:'; - const time = spec.tests?.[0]?.results?.[0]?.duration; - md += '- ' + icon + ' ' + spec.title + (time ? ' (' + time + 'ms)' : '') + '\n'; + md += '| :white_check_mark: Passed | ' + s.expected + ' |\n'; + if (s.unexpected > 0) md += '| :x: Failed | ' + s.unexpected + ' |\n'; + if (s.flaky > 0) md += '| :warning: Flaky | ' + s.flaky + ' |\n'; + if (s.skipped > 0) md += '| :fast_forward: Skipped | ' + s.skipped + ' |\n'; + md += '| :stopwatch: Duration | ' + dur + 's |\n\n'; + for (const file of r.suites) { + for (const describe of (file.suites || [])) { + md += '### ' + describe.title + '\n\n'; + for (const spec of (describe.specs || [])) { + const icon = spec.ok ? ':white_check_mark:' : ':x:'; + const t = spec.tests?.[0]?.results?.[0]?.duration; + md += '- ' + icon + ' ' + spec.title + (t ? ' (' + t + 'ms)' : '') + '\n'; + } + md += '\n'; } - md += '\n'; } require('fs').appendFileSync(process.env.GITHUB_STEP_SUMMARY, md); "