For the complete documentation index, see llms.txt. This page is also available as Markdown.

Buildkite

Running Playwright tests in parallel on Buildkite with Currents

Run Playwright tests in parallel on Buildkite using the native Playwright Sharding to split tests between multiple containers. Parallelizing tests helps decrease overall run duration.

Currents collects results from distributed parallel Buildkite builds for efficient troubleshooting. Each container receives a unique set of tests to run, providing faster feedback from your test suite.

Setup

Sharding

Buildkite provides BUILDKITE_PARALLEL_JOB (0-indexed) and BUILDKITE_PARALLEL_JOB_COUNT environment variables for parallel jobs. Since Playwright shards are 1-indexed, compute the shard index as BUILDKITE_PARALLEL_JOB + 1:

npx playwright test --shard=$((BUILDKITE_PARALLEL_JOB + 1))/$BUILDKITE_PARALLEL_JOB_COUNT

Configuration

Configure the Currents reporter in your playwright.config.ts:

Create a currents.config.ts file:

Example Pipeline

This pipeline:

  • Runs 3 parallel containers using Buildkite's parallelism feature

  • Uses the official Microsoft Playwright Docker image

  • Splits tests using Playwright's native sharding with Buildkite environment variables

  • Reports results to Currents via the Playwright Reporter

Environment Variables

Variable
Description

CURRENTS_PROJECT_ID

Your Currents project ID

CURRENTS_RECORD_KEY

Your Currents record key (store as secret)

BUILDKITE_PARALLEL_JOB

Current job index (0-indexed, provided by Buildkite)

BUILDKITE_PARALLEL_JOB_COUNT

Total number of parallel jobs (provided by Buildkite)

Looking for more ways to speed up CI? Read our CI Optimization guide.

Last updated

Was this helpful?