diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e4708a3..1185839 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -180,6 +180,35 @@ jobs: env: BROUTER_URL: http://localhost:17777 + - name: Playwright job summary + if: ${{ !cancelled() }} + run: | + 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); + 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 += '\n'; + } + require('fs').appendFileSync(process.env.GITHUB_STEP_SUMMARY, md); + " + fi + - uses: actions/upload-artifact@v7 if: ${{ !cancelled() }} with: diff --git a/.gitignore b/.gitignore index 9c21597..774c9f9 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ dist/ e2e/results/ test-results/ playwright-report/ +playwright-results.json diff --git a/playwright.config.ts b/playwright.config.ts index 75733f5..410e250 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -6,7 +6,9 @@ export default defineConfig({ fullyParallel: true, retries: process.env.CI ? 2 : 0, workers: process.env.CI ? 1 : undefined, - reporter: process.env.CI ? [["github"], ["html", { open: "never" }]] : "list", + reporter: process.env.CI + ? [["github"], ["html", { open: "never" }], ["json", { outputFile: "playwright-results.json" }]] + : "list", use: { baseURL: "http://localhost:3000", trace: "on-first-retry",