Skip to content

feat(image): add Playwright CLI + Chromium to code agent sandbox#17

Merged
durandom merged 10 commits into
redhat-developer:mainfrom
subhashkhileri:feat/e2e-agent-tooling
Jul 15, 2026
Merged

feat(image): add Playwright CLI + Chromium to code agent sandbox#17
durandom merged 10 commits into
redhat-developer:mainfrom
subhashkhileri:feat/e2e-agent-tooling

Conversation

@subhashkhileri

@subhashkhileri subhashkhileri commented Jun 19, 2026

Copy link
Copy Markdown
Member

Summary

Adds Playwright 1.61.1 + Chromium to the rhdh-fullsend-code sandbox image for E2E failure debugging.

Most trace CLI commands (actions, requests, console, errors) are pure Node.js JSON parsing. But trace snapshot and trace screenshot need a real headless Chromium to render frozen DOM snapshots and run accessibility tree queries — the most powerful debugging commands for UI failures.

Key decisions

  • Global install (npm install -g playwright) — binary lands at /usr/bin/playwright, directly accessible in the sandbox without npx
  • /tmp/playwright-browsers/sandbox/ (user home) is reset by OpenShell during sandbox init, wiping derived image layers. /tmp/ survives and is writable under the sandbox Landlock policy
  • PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 — prevents npm from auto-downloading during install; npx playwright install chromium --with-deps handles it explicitly so apt system deps are also installed

Test plan

  • Build: podman build --no-cache -t rhdh-fullsend-code:local -f images/code/Containerfile images/code/
  • Verify playwright --version returns Version 1.61.1
  • Verify playwright trace --help lists snapshot and screenshot subcommands
  • Verify Chromium binary exists under /tmp/playwright-browsers/
  • playwright trace snapshot renders frozen DOM without download errors

Assisted-by: Claude Code

The e2e-fix agent needs these tools for nightly failure analysis:

- gcloud CLI (pinned v526.0.0): downloads test artifacts from GCS
  buckets where Prow stores nightly/PR E2E results. Only the base
  SDK is installed (no extra components). Auth is runtime-only —
  no credentials baked into the image.

- pwtrace (pinned v0.3.0): Playwright trace analysis CLI that lets
  agents inspect browser actions, DOM state, console errors, and
  network requests from failed test traces.

Both are version-pinned for reproducible builds and installed under
USER root before dropping back to sandbox.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
curl and python3 are already in the base image. Use
dpkg --print-architecture instead of uname+sed for the
download URL.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@subhashkhileri subhashkhileri changed the title feat(image): add gcloud CLI and pwtrace to code agent image feat(image): add pwtrace to code agent image Jun 22, 2026
Replace the pwtrace npm package with the official Playwright CLI
(1.59.1) and baked-in Chromium browser. pwtrace was a thin wrapper;
the official `npx playwright trace` (added in Playwright 1.59) is
the upstream equivalent with full feature parity.

Most trace subcommands (actions, requests, console, errors) are pure
Node.js JSON parsing and don't need a browser. But `trace snapshot`
and `trace screenshot` launch headless Chromium to render frozen DOM
snapshots, run accessibility tree queries, and capture screenshots —
so the browser binary must be pre-installed.

- PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 prevents npm install auto-download
- `npx playwright install chromium --with-deps` installs browser + apt deps
- PLAYWRIGHT_BROWSERS_PATH=/opt/playwright-browsers for sandbox user access
- Pinned to 1.59.1 matching the E2E test suite version

Assisted-by: Claude Code
Co-Authored-By: Claude Code
@subhashkhileri subhashkhileri changed the title feat(image): add pwtrace to code agent image feat(image): add Playwright CLI + Chromium to code agent image Jul 13, 2026
@subhashkhileri

Copy link
Copy Markdown
Member Author

/fs-review

The workspace @playwright/test peer dep resolves to 1.61.1 which needs
chromium_headless_shell-1228. The previous 1.59.1 installed v1217,
causing "Executable doesn't exist" when running trace snapshot.

Assisted-by: Claude Code
Co-Authored-By: Claude Code
…bility

OpenShell sandbox isolation hides /opt/ from the agent. Move browsers to
/sandbox/playwright-browsers/ and symlink playwright binary to /sandbox/bin/
so both are accessible inside the sandbox.

Assisted-by: Claude Code
Co-Authored-By: Claude Code
…_PATH

The symlink to /usr/bin/playwright was broken in the sandbox because
OpenShell hides /usr/. npx playwright already respects the
PLAYWRIGHT_BROWSERS_PATH env var to find chromium — no global binary needed.

Assisted-by: Claude Code
Co-Authored-By: Claude Code
…solation

OpenShell mounts its own filesystem over /sandbox/ at sandbox creation,
discarding any content our derived image adds there. /tmp/ is NOT mounted
over, so content installed to /tmp/playwright-browsers/ persists into the
sandbox. Verified: /tmp/corepack/ (from base image) is accessible in
sandbox, confirming /tmp/ is preserved.

Also adds /tmp/bin/playwright symlink for direct invocation.

Assisted-by: Claude Code
Co-Authored-By: Claude Code
Both /tmp and /sandbox survive from derived image layers, but /sandbox
is more semantically appropriate for the sandbox user's space.
Also removed the /tmp/bin symlink — /usr/bin/playwright (from npm
install -g) is directly accessible in the sandbox.

Assisted-by: Claude Code
Co-Authored-By: Claude Code
OpenShell resets /sandbox during initialization, wiping derived-layer
additions. /tmp survives reliably. Verified end-to-end.

Assisted-by: Claude Code
Co-Authored-By: Claude Code
@subhashkhileri subhashkhileri changed the title feat(image): add Playwright CLI + Chromium to code agent image feat(image): extend code agent sandbox with yarn, Playwright+Chromium, and openspec Jul 15, 2026
@subhashkhileri subhashkhileri changed the title feat(image): extend code agent sandbox with yarn, Playwright+Chromium, and openspec feat(image): add Playwright CLI + Chromium to code agent sandbox Jul 15, 2026
@durandom
durandom merged commit 7b95d72 into redhat-developer:main Jul 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants