GuidesSpeed up your suite

Replace Playwright sharding

Replace a matrix of Playwright --shard jobs and a merge-reports job in GitHub Actions with one Endform run that schedules every test and merges the reports.

Endform schedules your tests across isolated remote runners and merges reports for you, so you do not need Playwright sharding at all. Instead of maintaining a matrix of CI jobs, downloading browser binaries on every runner, uploading blob artifacts, and running a downstream merge-reports job, one lightweight CI job runs npx endform@latest test.

Why Endform does away with Playwright sharding

Playwright's --shard=i/N flag splits a suite across multiple CI jobs so you can throw more CI runners at a slow suite. That works up to a point, then breaks down in four predictable ways:

  • Every shard repeats the same setup tax. Each CI job boots a fresh runner, checks out your repository, runs npm ci, and downloads or restores 300 to 500 MB of browser binaries and OS libraries before the first test starts.
  • Static file-order splits create straggler shards. --shard=i/N divides files statically without knowing how long each file takes. One heavy spec file holds up the entire matrix, and your shard count goes stale every time the suite grows.
  • Report merging lives in your CI YAML. Every shard has to switch to reporter: "blob", upload its blob-report/ directory as a CI artifact, and trigger a final merge-reports job just to produce one HTML or JUnit report.
  • Speed only works in CI. Sharding is wired into your CI matrix, so engineers and coding agents running tests from a laptop still wait on local workers.
Top shows a 4-shard CI matrix repeating setup and browser installs on 4 runners, trailing behind a straggler shard, uploading blobs, and running a 5th merge-reports job. Bottom shows a single lightweight Endform CI job fanning out directly to isolated remote machines and returning one auto-merged report.

With Endform:

  • One lightweight CI job runs npx endform@latest test with no browser downloads, no runner matrix, and no shard count to retune.
  • Endform schedules tests across isolated remote machines automatically so slow files do not strand idle shards.
  • Endform collects and merges reports automatically, running Playwright's merge-reports under the hood so your normal html, github, junit, or custom reporters work unchanged.
  • Same command locally and in CI. Engineers and coding agents run the exact same npx endform@latest test command from a laptop and get the same speed.

Migrate from a sharded GitHub Actions workflow

  1. Set up CI authentication

    Choose either the Endform GitHub App (OIDC, no secret to manage) or an ENDFORM_API_KEY secret:

    Connect the Endform GitHub App to your repository so workflows authenticate via GitHub OIDC (id-token: write) with no API key secret to rotate. The GitHub App is also required if you run tests against Vercel previews.

    npx endform@latest connect github

    If your organization already has the Endform GitHub App installed, verify in GitHub installation settings that this repository is included. See GitHub App and CI authentication for details.

  2. Collapse your sharded workflow into one Endform job

    Remove strategy.matrix.shard, the browser install and cache steps, blob-report artifact uploads, and the downstream merge-reports job. Replace them with a single job running npx endform@latest test:

    .github/workflows/playwright.yml
    name: Playwright Tests
    on: [push, pull_request]
    
    permissions:
      contents: read
      id-token: write
    
    jobs:
      test:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
          - uses: actions/setup-node@v4
            with:
              node-version: 22
              cache: npm
          - run: npm ci
          - run: npx endform@latest test
            env:
              BASE_URL: ${{ vars.STAGING_URL }}

    When using the GitHub App, keep contents: read alongside id-token: write, since specifying permissions in GitHub Actions drops any permissions you do not list.

  3. Clean up playwright.config.ts

    Remove any CI-only reporter: process.env.CI ? "blob" : "html" conditional and configure the reporters you actually want directly:

    playwright.config.ts
    export default defineConfig({
      reporter: [["html"], ["github"]],
    });

    Endform merges runner reports automatically and hands the combined result to every configured Playwright reporter (see Custom reporters). If you also want a downloadable playwright-report artifact in GitHub Actions in addition to the Endform dashboard, keep actions/upload-artifact@v4 after the test step. Leave workers: process.env.CI ? 1 : undefined alone if you still use it for local runs; it does not throttle Endform cloud runs. If a single spec file packs several long tests, see Fully parallel testing for enabling fullyParallel: true.

  4. Check globalSetup, runner files, and an in-CI webServer, then remove the old jobs

    • globalSetup and setup projects: Under sharding, globalSetup ran once per shard. On Endform it runs once per suite run on the CI runner itself, and any storageState files it writes are transferred to the remote runners automatically. If your globalSetup launches a browser directly (rather than using a Playwright setup project), keep npx playwright install --with-deps chromium in the CI job. Also check What is sent to runners if tests read non-imported files from disk.
    • An app webServer started inside CI: Under sharding, each CI runner started its own copy of your app to serve 1/N of the tests. With one Endform job, that single CI runner serves the whole suite over Endform's built-in tunnel. Make sure webServer runs a production build (npm run build && npm run start) and add a within-suite-run limit in endform.config.ts if needed, or point CI at a deployed preview URL for full parallelism. See Test against a local server and Optimize test load.

    If you want a zero-risk cutover on a large repository, run the new single-job Endform workflow alongside your existing sharded workflow on one pull request, confirm the test count, reporter outputs, and wall-clock time match or beat the matrix, then delete the old sharded jobs.

In BikeBook, a single lightweight GitHub Actions job runs all 103 tests in suites/03-scaled-suite across isolated Endform runners in about 30 seconds:

Live demo103 tests · clean app

Scaled BikeBook suite (103 tests)

103 tests backed by API-created users and office fleets, running concurrently across isolated machines in about 30 seconds.

Migration notes

Last updated