Sign inSign up

sbx/playwright-kit:20260813-76b68da5d7615bc50701d6823f5133fab1b263c3

Manifest digest

sha256:49956c9e082ec8cc6851e40cf06c4a2c86a4fe6cebd112afc4ea16e09d97e8a3

Last pushed

about 1 month by dockerpublicbot

Type

Sandbox Kit

Manifest digest

sha256:49956c9e082ec8cc6851e40cf06c4a2c86a4fe6cebd112afc4ea16e09d97e8a3

yaml
schemaVersion: "2"
kind: mixin
name: playwright
displayName: Playwright
description: Playwright browser-automation toolchain for sandbox agents — the playwright CLI and @playwright/test v1.61.1 with Chromium, installed to a shared system browsers path so the agent user can run headless browser automation and end-to-end tests entirely inside the sandbox.
agentInstructions:
    content: |
        ## Playwright

        playwright and @playwright/test v1.61.1 are installed globally (the
        `playwright` CLI is on PATH). Chromium and its headless shell live in
        /opt/ms-playwright; PLAYWRIGHT_BROWSERS_PATH points there system-wide —
        don't unset or override it, or Playwright will look in ~/.cache and try to
        re-download.

        - Run test suites with `npx playwright test`; drive a browser from a script
          with `const { chromium } = require('playwright')`. Zero-config works: a
          bare `smoke.spec.js` with no package.json resolves `@playwright/test`
          from the global install via NODE_PATH. Projects with their own
          node_modules use their local copy as usual.
        - Headless only: the sandbox has no display server, so `--headed`, `--ui`,
          and `codegen` will not work. Screenshots, PDFs, traces, and videos all
          work headless.
        - If a project pins a different Playwright version, its first run may need
          the matching browser build: `npx playwright install chromium` fetches it
          at runtime (the browser CDN domains are allowed, and /opt/ms-playwright
          is writable).
        - Only Chromium is installed. `npx playwright install firefox webkit` can
          download the other engines, but their extra system libraries are not
          installed — prefer Chromium, or extend the kit if you need cross-engine
          runs.
        - Sites under test must be reachable through the sandbox network policy:
          localhost servers always work; external sites will fail with a proxy
          error unless their domains are in the sandbox's allowed domains.
permissions:
    network:
        allow:
            - registry.npmjs.org:443
            - cdn.playwright.dev:443
            - playwright.download.prss.microsoft.com:443
            - storage.googleapis.com:443
            - archive.ubuntu.com:80
            - security.ubuntu.com:80
            - ports.ubuntu.com:80
            - download.docker.com:443
environment:
    variables:
        NODE_PATH: /usr/local/share/npm-global/lib/node_modules
        PLAYWRIGHT_BROWSERS_PATH: /opt/ms-playwright
setup:
    install:
        - command: |
            set -euo pipefail
            command -v npm >/dev/null || { echo "npm not found: this mixin needs a base image with Node.js >= 18 (all standard agent templates ship it)" >&2; exit 1; }
            if [ -n "${HTTP_PROXY:-}" ]; then
              npm config set proxy "$HTTP_PROXY"
              npm config set https-proxy "$HTTP_PROXY"
            fi
            PLAYWRIGHT_VERSION=1.61.1
            npm install -g "playwright@${PLAYWRIGHT_VERSION}" "@playwright/test@${PLAYWRIGHT_VERSION}"
            ln -sf "$(command -v playwright)" /usr/local/bin/playwright
            playwright --version
          user: "0"
          description: Install playwright + @playwright/test v1.61.1 from registry.npmjs.org, version pinned
        - command: |
            set -euo pipefail
            export PLAYWRIGHT_BROWSERS_PATH=/opt/ms-playwright
            playwright install --with-deps chromium
            rm -rf /var/lib/apt/lists/*
            # World-writable like the official Playwright image: lets the agent
            # user (uid 1000) add matching browser builds at runtime when a
            # project pins a different Playwright version.
            chmod -R 777 /opt/ms-playwright
          user: "0"
          description: Install Chromium (+ headless shell) into /opt/ms-playwright and its system libraries via apt