Playwright Docker Image Drift: Why a Pinned CI Tag Can Still Break

Your Playwright tests passed yesterday. Today the same commit fails during startup with a Node.js compatibility error. The package lockfile has not changed, the workflow still references the same Docker tag, and nobody touched the test code. This is not necessarily a flaky test. Your test environment may have changed underneath a tag that looked pinned.

The real incident: a released Playwright image changed after publication

In November 2026, Playwright users reported that pipelines using mcr.microsoft.com/playwright:v1.64.1-jammy began failing even though the image tag and Playwright package version had not changed. The image had been republished with Node.js 26 instead of Node.js 24. Dependencies that were not compatible with the newer runtime then failed at startup.

The maintainers acknowledged that changing the Node.js major version on an already released image tag was a mistake. They stated that the Node.js major version would remain stable within a Playwright minor version, and that a new Node.js major would ship with a new Playwright minor release. See the Playwright issue #44073 and the Playwright 1.65.0 release notes.

The lesson is broader than this incident: a human-readable image tag is a reference, not a cryptographic guarantee that the image bytes will never change. A pinned tag can still move if its publisher republishes it.

How to recognise runtime drift instead of blaming the test

Look for a failure pattern that starts across many unrelated tests at the same time. Typical signals include errors while loading Node modules, missing or changed runtime APIs, browser launch failures, or a mismatch between the browser bundled in the container and the Playwright package in the project.

Before changing selectors, increasing timeouts, or adding retries, compare the runtime evidence from the last successful build with the failing build.

Step 1: record the versions that actually ran

Do not rely only on the version written in package.json or the Docker tag in a workflow. Print the installed runtime and browser versions from inside the container.

node --version
npm ls @playwright/test playwright
npx playwright --version
npx playwright install --list
cat /etc/os-release

For a Playwright test suite, add a small diagnostic step before the test command:

- name: Record browser test runtime
  run: |
    node --version
    npm ls @playwright/test playwright
    npx playwright --version
    npx playwright install --list

Keep this output with the CI artifact or job log. A useful incident record includes the application commit, lockfile hash, image digest, Node.js version, Playwright package version, and browser revision.

Step 2: pin the container by digest

Use a versioned Playwright image and pin its immutable registry digest when reproducibility matters. The digest below is deliberately a placeholder. Replace it with the digest returned by your registry for the exact platform you deploy.

FROM mcr.microsoft.com/playwright:v1.65.1-noble@sha256:REPLACE_WITH_VERIFIED_DIGEST

WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
CMD ["npx", "playwright", "test"]

A digest pins the image content. A tag alone does not. When updating Playwright, resolve and review the new digest, commit it, and treat the change as a dependency update that requires CI validation.

Do not copy a digest from an example or another architecture. Resolve it from the registry for the exact image tag and platform your runner uses.

Step 3: keep the package and browser image aligned

Playwright recommends using the Docker image that corresponds to the Playwright version installed in the project. The browser binaries and the Playwright client are released together. A mismatch can produce confusing launch or protocol errors.

For example, if the project installs @playwright/test 1.65.1, use the matching 1.65.1 image line, rather than combining a newer package with an older browser image. Lock the npm dependency through the lockfile and install with npm ci.

{
  "devDependencies": {
    "@playwright/test": "1.65.1"
  },
  "scripts": {
    "test:e2e": "playwright test"
  }
}

Avoid floating package ranges for the browser test runner in a release pipeline. Upgrade the package, image tag, and digest together in one reviewed change.

Step 4: fail early when the runtime is outside the supported range

A simple guard turns an unexpected runtime change into a clear environment failure instead of dozens of misleading test failures. If your project standardises on Node.js 24, for example:

node -e "
const major = Number(process.versions.node.split('.')[0]);
if (major !== 24) {
  console.error('Expected Node.js 24, received ' + process.version);
  process.exit(1);
}
"

Use the major version your team has explicitly validated. Playwright 1.65 announced that it no longer tests on Node.js 20 and lists Node.js 22, 24, and 26 in its system requirements. That does not mean every application dependency is automatically compatible with every listed major. Validate your own dependency tree before changing the runtime.

Step 5: make upgrades deliberate in GitHub Actions

Build a small environment verification job that runs before the full browser suite. The following example assumes that your repository contains a Dockerfile pinned by digest and that the image is built in the workflow.

name: Browser tests

on:
  pull_request:
  push:
    branches: [main]

jobs:
  e2e:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Build pinned test image
        run: docker build --pull=false -t app-e2e .

      - name: Verify runtime
        run: |
          docker run --rm app-e2e node --version
          docker run --rm app-e2e npx playwright --version
          docker run --rm app-e2e npx playwright install --list

      - name: Run browser tests
        run: docker run --rm app-e2e npm run test:e2e

For production workflows, pin third-party GitHub Actions to reviewed commit SHAs as well. The example uses a familiar major tag for readability; your organisation's workflow policy should determine the exact action pinning standard.

Step 6: separate environment failures from product regressions

When a browser suite fails after an image or runtime update, use a controlled comparison:

  1. Re-run the same application commit with the last known-good image digest.
  2. Run it with the candidate image digest without changing test code.
  3. Compare Node.js, Playwright, browser, operating system, and dependency versions.
  4. Classify failures as runtime startup, browser launch, test framework, or application behaviour.
  5. Promote the candidate only after the same critical smoke tests pass on the target CI runner.

If the old digest passes and the new digest fails before application assertions, investigate the environment change first. Do not mask an environment regression by adding retries or extending every test timeout.

A practical CI environment checklist

What to do this week

Start by inspecting the last ten failed browser pipeline runs. Check whether failures cluster around a runner, image tag, or runtime change. Record the actual image digest and Node.js version for one passing run and one failing run. If the image is referenced only by a mutable tag, move it to a reviewed digest and add a runtime guard.

Then schedule a controlled Playwright upgrade. Change the package and image together, run the critical smoke tests, compare browser output, and only then promote the new digest. This process is usually faster than debugging a large suite whose execution environment silently changed.

Related QA resources

Read our guides to CI quality gates, test observability and debugging, flaky test root causes, and test failure triage. Use the flaky test rate calculator to measure instability separately from environment failures.

QA AUTOMATION HEALTH CHECK

Make CI failures explainable and actionable.

Review automation reliability, environment consistency, pipeline feedback, and quality risks with prioritised findings and practical next steps.

Explore the review →