Skip to main content
Playwright is a popular end-to-end testing framework for web applications. Namespace provides high-performance caching for Playwright test runs. By using Cache Volumes, you can cache Playwright’s browser binaries and system dependencies across workflow runs, significantly reducing test setup time. Making full use of the CPUs on our high-performance Compute Platform reduces test times by running tests faster and in parallel.

Getting started

1

Enable caching on your runner profile

Go to your runner profile configuration and enable caching.
2

Add the cache action to your workflow

Use namespacelabs/nscloud-cache-action to cache Playwright browsers and apt packages:
The playwright cache mode stores downloaded browsers, and apt caches system packages so that playwright install --with-deps runs faster on subsequent runs.
3

Cache npm dependencies

In addition to Playwright browsers, you can also cache your package manager’s dependencies:
For npm, add the npm cache mode:
4

Install and run Playwright as usual

After setting up the cache, install dependencies and run Playwright as you normally would:

What gets cached

See the nscloud-cache-action documentation for all available cache modes and configuration options.

Next steps

Increase the number of workers

Playwright’s default configuration uses only 1 worker when it detects a CI environment. To make better use of the available cores, you can increase this for faster test execution. A good starting point is 75% of the available cores—adjust this depending on your workload:
You can also configure this in your Playwright configuration.

Upload test reports

Use namespace-actions/upload-artifact to upload Playwright’s HTML report for easy debugging:
The if: ${{ !cancelled() }} condition ensures the report is uploaded even when tests fail.

Full example

Here’s a complete workflow using Namespace runners with caching:
View the full example repository at namespace-integration-demos/playwright.

Advanced: pre-install browsers and system dependencies

For the fastest and most consistent job startup, pre-install Playwright’s browsers and system dependencies directly into your runner profile with a custom base image. This removes the browser download and apt-get install from every job, so workflows start running tests immediately:
Pin the Playwright version to match your package.json; if the versions diverge, Playwright will re-download the matching browser at runtime. With this in place, your workflow can drop --with-deps and run plain npx playwright install (or skip the install step entirely if the versions match).
Last modified on August 19, 2026