# playwright

> For the complete documentation index, see [llms.txt](https://docs.ringleader.dev/llms.txt).


> Playwright with its browsers and their system libraries, ready for a project's browser tests.


Installs the Playwright CLI, downloads the browser engines you ask for, and installs the
operating-system libraries those browsers need, so a project's browser tests run on the
workstation with no further setup:

```yaml
devtools:
  - name: nodejs
    version: "24"
  - name: playwright
    config:
      browsers: [chromium, firefox]
```

Omit `config` and you get Chromium. Declare `nodejs` first to choose the Node the CLI
runs on; otherwise the distribution's Node is installed for it. A configuration that also
declares `npm` [packages](https://docs.ringleader.dev/workstations/packages-tools-settings/package-installation/#language-toolchains)
gets the `nodejs` devtool added first when the workstation has no npm, so on Debian and
Ubuntu the CLI runs on Node 24.

## `config` fields

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `browsers` | `array` of `string` | `["chromium"]` | The engines to install: `chromium`, `firefox`, `webkit`. An empty or unrecognized list falls back to `chromium`. |

## Version behavior

| `version` | Result |
|-----------|--------|
| omitted | the latest published Playwright |
| `1.48.0` | that exact npm version |

A workstation that already has `playwright` on PATH keeps the release it has. A changed
`version` replaces that release, with the browser engines it needs, on the next configuration
pass. A changed `browsers` list installs the engines that are missing.

## Updates

With `updatePolicy: latest` and no `version`, Playwright takes the
[npm route](https://docs.ringleader.dev/reference/tools/devtools/#update-routes): about once a day, it moves to the newest npm release. The workstation downloads the browser engines the new
release needs before it switches the `playwright` command, and keeps the engines it downloaded
before.

A `playwright-core` or `@playwright/test` package you declare with `updatePolicy: latest`
moves only to the release the devtool has, so it never runs ahead of the browser engines.
Declaring the `playwright` npm package as well as the devtool keeps the devtool from moving.

## Browser location

Engines are installed once, as root, into a shared cache at `/opt/ms-playwright`, made
world-readable, and every login shell gets `PLAYWRIGHT_BROWSERS_PATH` pointing at it. So
the workstation user's test runs find the same browsers the install produced, which a
per-user `npx playwright install` cannot give you.

On Debian and Ubuntu the browsers' system libraries are installed too. On Alpine only
the engines are installed; the dependency step is skipped.

## Example

A test workstation that runs a project's browser suite:

```yaml
apiVersion: workstations.ringleader.dev/v1
kind: WorkstationConfig
metadata:
  name: e2e-box
  namespace: local
spec:
  selector:
    matchLabels:
      role: e2e
  identity:
    user: dev
    shell: /bin/bash
  packages:
    - git
  devtools:
    - name: nodejs
      version: "24"
    - name: playwright
      config:
        browsers: [chromium, firefox]
  sources:
    - name: app
      git:
        url: https://github.com/acme/app.git
        ref: main
      path: /home/dev/src/app
  scripts:
    - name: install-deps
      phase: user
      runPolicy: onChange
      content: |
        set -e
        cd ~/src/app && npm ci
```

## Notes

- The first setup run is slow: browser downloads take minutes. Keep `playwright` off
  workstations that do not need it.
- Changing `browsers` re-runs the recipe, but `playwright install` skips engines that
  are already present, so adding `webkit` to an existing workstation downloads only
  WebKit.

