|

Advanced Playwright CI/CD: Docker Caching, Parallel Shards, and Merge Reports

Basic CI runs tests. Advanced CI caches browsers, shards across runners, merges reports, and publishes to GitHub Pages — all under 5 minutes.

🎭 Want to master this with real projects? Join the Playwright Automation Mastery course at The Testing Academy.

Contents

Docker Layer Caching

- uses: actions/cache@v4
  with:
    path: ~/.cache/ms-playwright
    key: playwright-${{ hashFiles('package-lock.json') }}
# Saves 60-90 seconds per run

Advanced Sharding with Report Merge

jobs:
  test:
    strategy:
      matrix:
        shard: [1/4, 2/4, 3/4, 4/4]
    steps:
      - run: npx playwright test --shard=${{ matrix.shard }}
      - uses: actions/upload-artifact@v4
        with:
          name: blob-${{ strategy.job-index }}
          path: blob-report/

  merge:
    needs: test
    steps:
      - uses: actions/download-artifact@v4
        with:
          pattern: blob-*
          merge-multiple: true
          path: all-blob-reports
      - run: npx playwright merge-reports --reporter html all-blob-reports
      - uses: actions/upload-artifact@v4
        with:
          name: html-report
          path: playwright-report/

🚀 Level Up Your Playwright

From locators to CI pipelines — build a production-grade Playwright + TypeScript framework step by step.

Publish to GitHub Pages

  deploy-report:
    needs: merge
    permissions:
      pages: write
      id-token: write
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    steps:
      - uses: actions/download-artifact@v4
        with: { name: html-report, path: playwright-report/ }
      - uses: actions/configure-pages@v4
      - uses: actions/upload-pages-artifact@v4
        with: { path: playwright-report/ }
      - uses: actions/deploy-pages@v4
        id: deployment

Optimization Comparison

OptimizationTime Saved
Browser caching60-90 seconds
npm cache30-60 seconds
4-shard parallel4x speedup
Chromium only (skip FF/WK)Skip 200MB download
Blob report mergeSingle HTML report from shards

🎓 Master Playwright End to End

Join hundreds of SDETs building real automation frameworks. Lifetime access, hands-on projects, and a job-ready portfolio.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.