Home / Services / Playwright CI/CD integration

Playwright CI/CD integration that stops the build being a checkbox

Your suite runs in the pipeline, the report and the trace reach a person, and whoever is on call has a page telling them what a red build means and what to do with it.

Short answer

We put your Playwright suite into your pipeline and settle what a red build causes: the job that runs it, the shard layout behind that number, where the report and the trace land, who gets told, and a runbook for whoever is on call. A suite that already fails at random is a different engagement.

Who this is for

The suite is real. Somebody wrote fixtures, somebody wrote page objects, and it goes green on a laptop. Nobody has decided what happens to it between that laptop and a merge.

  • Nothing runs it. Someone typed npx playwright test before the last three releases and then stopped, because it is not anybody's job and there is no step in the process where it would happen.
  • The job exists and the team has learned to re-run it. It went red, somebody pressed the button again, it went green, and that was the day red stopped meaning anything. The report is a zip behind a download link that has been opened twice.
  • Eleven minutes on the laptop, forty in the pipeline, and nobody can say where the other twenty-nine went.

You can write a workflow file. Playwright's documentation will hand you one that works on the first push, for nothing, and if a workflow file were the whole problem you would not be reading a services page. You are missing a set of decisions: how long a pull request is allowed to take, how many shards that is worth, what blocks a merge, where a failure goes so that a person sees it, and what that person does at three in the morning.

If the suite already fails at random, this is not the work to buy. Putting a flaky suite into the pipeline faster makes it fail faster. Sharding a suite that fails one run in four gives you four jobs that fail one run in four, on a schedule, with a report nobody opens. The specs have to be diagnosed and fixed first, and that is flaky test remediation. If there is no suite yet worth putting anywhere, building one is its own engagement.

What you get

All four are yours: files in your repository, settings in your pipeline.

The pipeline definition, in your repository

The job or jobs that run the suite, checked in, reviewable in a pull request, with the action, image and browser versions pinned to something somebody chose. It is a file your team owns on the day we stop, and there is no configuration living in a console only we can reach. Your reviewers see a diff when it changes.

The shard and worker layout, with the timings behind it

A number, and the two measurements that produced it written down beside it. The reasoning is the deliverable as much as the value is: the value stops being right the day the suite doubles, and the team that has the timings can re-derive it without calling anybody.

A report and a trace that reach a person

Where the HTML report is published, how long it is retained, and which machine-readable output the pipeline reads to render failures where the reviewer already is. The target is a notification, one link, and the trace open on the step that failed. Playwright's traces open locally or in a browser at trace.playwright.dev, so the distance from a failing job to the evidence is a design decision and not a constraint.

The runbook

One page for whoever is on call. How to tell an application failure from an infrastructure failure, how to open the trace, which failures hold a merge open and which are recorded and let through, what may be re-run and what has to be looked at, and who gets told when it breaks.

How it works

  1. Read what runs today

    The suite, its wall-clock, and the pipeline if there is one. Two numbers get measured here: how long the tests take, and how long everything that is not tests takes. From your side this needs read access to the repository, as much CI history as your platform still holds, and a plain statement of which environments the suite points at and who else deploys into them.

  2. One job, unoptimised

    The whole suite runs in the pipeline once, serially, and the number is read off it. Nothing is sharded before it has been timed, and this phase is short.

  3. The layout

    Shards, workers, retries, browser projects, what a red job stops and what it only records. These are your decisions and we bring the measurements to them; the one we need from you is how long a pull request may sit before the wait changes how your team works. We work inside the pipeline you already have wherever there is one, so this is a job added to it rather than a replacement for it.

  4. Make it mean something

    Report and trace distribution, the notification and where it lands, the runbook, and the handover to whoever will be on the end of it. The engineer who wrote the layout walks the person who will be woken by it through a real failure.

The length of the job is set by how many pipelines run any part of the suite, how many environments it points at, whether it passes anywhere except the laptop it was written on, how much CI history survives, and how many browser projects are in scope. A suite that runs green in one pipeline against one environment is the short end of it.

The decisions, in one config block

There is no workflow file on this page. Playwright's own CI walkthrough is a complete GitHub Actions setup that works on the first push and costs nothing, and arguing with it would be arguing with something you have already used. The sample below is the other half: the part of playwright.config.ts that behaves differently in a pipeline than on a laptop. Every line in it is a decision, and none of them is in the YAML.

import { defineConfig } from '@playwright/test';

export default defineConfig({
  forbidOnly: !!process.env.CI,
  retries: process.env.CI ? 2 : 0,
  failOnFlakyTests: !!process.env.CI,
  workers: process.env.CI ? 1 : undefined,
  reporter: process.env.CI
    ? [['html', { open: 'never' }], ['junit', { outputFile: 'results.xml' }]]
    : [['list']],
  use: {
    trace: 'on-first-retry',
  },
});
Playwright 1.62 · TypeScript · run with CI set and unset

A test.only left in a file passes on a laptop and silently skips the rest of the suite, so the build is green and the build did not run. forbidOnly, keyed on the CI variable, fails that run instead.

retries is the declared version of the re-run habit. A retry in the config is counted and reported; a person clicking re-run is not. failOnFlakyTests is the decision underneath it: with that on, a test that only went green on a retry fails the run instead of being filed as flaky and forgotten. Whether that counts as green is a policy question, and it is one of the ones this engagement makes somebody answer.

workers and reporter are both about who is on the other end. Playwright's CI guidance is a single worker, on the reasoning that a test with the whole machine to itself is more reproducible, and that wider parallelism should be bought by sharding across jobs instead. Whether it holds on your runners is measured in phase two. The reporter already differs between a laptop and a pipeline by default, and the decision is which output your team reads: an HTML report a person opens, a machine-readable file the pipeline turns into annotations on the pull request, or both.

trace set to on-first-retry keeps evidence only for the runs that needed it. It is the line that decides whether the person reading a red build at three in the morning has the failing step in front of them or a log to guess from.

Where this stops

DevOps consulting is a real thing to buy, and a reader can arrive here thinking that is what this is. This engagement owns the test job inside a pipeline you already have, and nothing underneath it.

  • This is not DevOps consulting. We do not design, build or own your deployment pipeline, your infrastructure, your cluster, your observability stack or your secrets management. Which environment the pipeline points the suite at is your decision, and the credentials it uses stay in the secret store you already have.
  • No promise about your release process. We make the test signal readable and we say which failures we would treat as blocking. You decide what gates a release, and we do not take responsibility for that decision.
  • Not a flaky-suite repair. A suite that fails at random keeps failing at random in a faster pipeline. That work is flaky test remediation, sold separately, and this engagement does not quietly absorb it.
  • Not runner infrastructure. Provisioning a self-hosted runner fleet, autoscaling it or paying for it is not this engagement.
  • Native mobile applications. Playwright drives browsers. If a stage of your pipeline runs Appium against an iOS or Android application, that stage is not ours and we do not sell its replacement. What Playwright reaches at that boundary is mobile web: a viewport the size of a phone, a mobile user agent and touch input, and never an application that was installed from an app store.
  • Not load or performance testing. Playwright measures one real browser doing one thing well. It is not k6, JMeter or Gatling, and a pipeline stage that puts your application under load is not something sold here in any engagement.
  • Security and penetration testing. Not offered by this company, inside a pipeline or outside one.

What it costs

Engineers are billed hourly, from $50 an hour, depending on where the engineer sits. The minimum engagement is one full-time engineer for one month.

The estimate here comes from how many pipelines run any part of it, how many environments it has to answer for, how many browser projects are in scope, whether it passes anywhere except the laptop it was written on, and whether there is an existing pipeline to work inside or an empty repository. A green suite in one pipeline is a different engagement from the same suite in four, and the second one is priced by the number of places a decision has to be repeated.

There is a second cost and it is yours, not ours: the CI bill. Sharding cuts wall-clock time and raises billed minutes, because the variable part of a run divides across jobs and the fixed part multiplies. Every shard is a job that checks out again, installs again, and downloads a browser or pulls an image again. So the question we answer is not how many shards you can run but where the next one stops buying anything, and concurrency caps decide part of it for you, because shards above the cap queue and queueing is still time. The arithmetic behind that cut-off is in our article on parallel runs and sharding.

One thing that does not pay for itself: caching browser binaries between runs. Playwright's CI documentation advises against it, because restoring the cache takes about as long as downloading the binaries does, and on Linux the operating system dependencies that go with them are not cacheable at all. If cutting that fixed cost is where you were going to start, start somewhere else. It is a decision we make once, in your pipeline, and then stop spending engineering time on.

Read first

Questions

Which CI platforms do you work with?

Tell us which one you are on and we will answer it for that one, because this page publishes no list. Playwright's own CI documentation carries configurations for GitHub Actions, Docker, Azure Pipelines, CircleCI, Jenkins, Bitbucket Pipelines, GitLab CI, Google Cloud Build and Drone, which describes the framework rather than this company's staffing. The config block above is the same block on all of them, which is the part of this work that does not move when the platform does.

Our tests are flaky. Will running them in CI properly fix that?

No. A suite that fails one run in four will fail one run in four in the pipeline, on a schedule, and sharding it gives you four jobs doing that instead of one. The specs have to be diagnosed and fixed before a build signal is worth wiring anything to, and that is the flaky test remediation engagement. Buy that first and this work afterwards.

How many shards will we need?

Nobody can answer that before measuring, and any number on a services page is a guess about a suite it has never seen. It comes out of two timings: how long the tests take, and how long everything that is not tests takes — checkout, install, browser download or image pull. The second is usually the surprise, because it is the part that every extra shard pays again. The arithmetic behind a shard count is a separate read.

Will this make our CI bill go up?

Yes. Sharding cuts wall-clock time and raises billed minutes, because the variable part of a run divides across jobs and the fixed part multiplies. Four shards means four checkouts and four installs. Those minutes buy a pull request that returns an answer inside the window your team will wait, and the point where the next shard stops buying anything is a number we read off your own timings.

Who gets told when the build breaks, and what are they supposed to do?

That is the runbook, and it is settled with you rather than assumed. It names where the failure is announced and which people or channel it reaches, how to tell an application failure from an infrastructure one, how to open the trace for the failing step, which failures hold a merge open and which are recorded and let through, and what may be re-run against what has to be looked at. A build that goes red into a channel nobody owns is the state most teams are already in.

Do we need the audit before you start?

No. Most clients arrive knowing the job, and we scope that and start. The audit is for the team that wants to know what it has before it picks a direction, so it is a route in and never a gate. It is optional, it is billed by the hour, and how long it takes depends on the project. The minimum of one full-time engineer for one month does not apply to it.

How long does the suite take, and how long may a pull request wait?

Neither is a number you have to look up, and together they are most of phase one. Send them, with the name of the CI system the rest of your build already runs on. We do not need an audit to start. The pipeline still needs a reader, and that can be one of our engineers, by the month.