Skip to content

Commit 375141e

Browse files
authored
Added step to merge playwright reports (#25113)
After running tests, separate reports are generated on each shard. Added additional step to merge playwright reports, so that they are easier to download and read.
1 parent 87cbd97 commit 375141e

File tree

2 files changed

+63
-8
lines changed

2 files changed

+63
-8
lines changed

.github/workflows/ci-docker.yml

Lines changed: 62 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -344,17 +344,72 @@ jobs:
344344
GHOST_IMAGE_TAG: ${{ steps.load.outputs.image-tag }}
345345
run: yarn test:e2e --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
346346

347-
- name: Upload Playwright artifacts
347+
- name: Upload blob report to GitHub Actions Artifacts
348348
if: failure()
349349
uses: actions/upload-artifact@v4
350350
with:
351-
name: playwright-report-${{ matrix.shardIndex }}
352-
path: |
353-
e2e/playwright-report/
354-
e2e/test-results/
351+
name: blob-report-${{ matrix.shardIndex }}
352+
path: e2e/blob-report
353+
retention-days: 1
354+
355+
- name: Upload test results artifacts
356+
if: failure()
357+
uses: actions/upload-artifact@v4
358+
with:
359+
name: test-results-${{ matrix.shardIndex }}
360+
path: e2e/test-results
361+
retention-days: 7
362+
363+
merge_reports:
364+
name: Merge Playwright Reports
365+
if: always() && needs.test_e2e.result == 'failure'
366+
needs: [test_e2e, setup]
367+
runs-on: ubuntu-latest
368+
steps:
369+
- name: Checkout
370+
uses: actions/checkout@v4
371+
372+
- uses: actions/setup-node@v4
373+
with:
374+
node-version: ${{ env.NODE_VERSION }}
375+
376+
- name: Restore caches
377+
uses: ./.github/actions/restore-cache
378+
env:
379+
DEPENDENCY_CACHE_KEY: ${{ needs.setup.outputs.dependency_cache_key }}
380+
381+
- name: Download blob reports from GitHub Actions Artifacts
382+
uses: actions/download-artifact@v4
383+
with:
384+
path: e2e/all-blob-reports
385+
pattern: blob-report-*
386+
merge-multiple: true
387+
388+
- name: Download test results from GitHub Actions Artifacts
389+
uses: actions/download-artifact@v4
390+
with:
391+
path: e2e/all-test-results
392+
pattern: test-results-*
393+
merge-multiple: true
394+
395+
- name: Merge into HTML Report
396+
run: npx playwright merge-reports --reporter html ./all-blob-reports
397+
working-directory: e2e
398+
399+
- name: Upload HTML report
400+
uses: actions/upload-artifact@v4
401+
with:
402+
name: playwright-report
403+
path: e2e/playwright-report
404+
retention-days: 14
405+
406+
- name: Upload merged test results
407+
uses: actions/upload-artifact@v4
408+
with:
409+
name: test-results
410+
path: e2e/all-test-results
355411
retention-days: 7
356412

357413
- name: Output command to view report
358-
if: failure()
359414
run: |
360-
echo "::notice::To view the Playwright report locally, run: gh run download ${{ github.run_id }} -n playwright-report-${{ matrix.shardIndex }} -D /tmp/playwright-\$\$ && npx playwright show-report /tmp/playwright-\$\$/playwright-report"
415+
echo "::notice::To view the Playwright report locally, run: gh run download ${{ github.run_id }} -n playwright-report -D /tmp/playwright-\$\$ && npx playwright show-report /tmp/playwright-\$\$/playwright-report"

e2e/playwright.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const config = {
2222
retries: 0, // Retries open the door to flaky tests. If the test needs retries, it's not a good test or the app is broken.
2323
workers: process.env.CI ? 4 : getWorkerCount(),
2424
fullyParallel: true,
25-
reporter: process.env.CI ? [['list', {printSteps: true}], ['html']] : [['list', {printSteps: true}]],
25+
reporter: process.env.CI ? [['list', {printSteps: true}], ['blob']] : [['list', {printSteps: true}], ['html']],
2626
use: {
2727
// Base URL will be set dynamically per test via fixture
2828
baseURL: process.env.GHOST_BASE_URL || 'http://localhost:2368',

0 commit comments

Comments
 (0)