Run Playwright Docker containers with the current host UID/GID to avoid root-owned files in bind-mounted workspaces. - Add --user UID:GID and HOME override to codegen and replay - Harden replay workspace cleanup against leftover permission issues https://chatgpt.com/share/6984a73c-14a0-800f-a40d-778972e518b7
🎭 playwright-recorder
A small, reproducible Playwright recording / codegen tool
built around Docker, X11/XWayland, and ephemeral workspaces
🔗 Homepage: https://github.com/kevinveenbirkenbach/playwright-recorder
✨ What is this?
playwright-recorder is a developer tool for recording Playwright tests via
the official Playwright codegen feature — without polluting your project:
- 🎥 GUI-based recording (Playwright Inspector)
- 🧼 Always fresh (no reused state, no lockfile pain)
- 🐳 Runs fully in Docker
- 🗂️ Repo-local, git-ignored workspace
- 📄 Only generated tests are persisted
- 🚫 No
/tmpusage
Perfect for:
- recording login flows
- capturing UI regressions
- generating first test drafts
- infra-heavy projects where Playwright does not belong in the main repo
recordings/is ignored by git.gitkeepensures the folder exists- ephemeral workspace lives in
recordings/.work/and is auto-cleaned
🚀 Usage
1️⃣ Requirements
- Docker
- X11 or XWayland (Wayland-only will NOT work)
xhost
On Arch Linux:
sudo pacman -S --needed xorg-xhost
⚙️ Installation (one-time)
Prepare the recorder script:
make install
This makes scripts/codegen.sh executable.
🎥 Start recording
make codegen
Or with a start URL:
./scripts/codegen.sh https://example.com/login
▶ Replay recorded tests (headless)
Run all recorded tests:
make replay
Run a specific test file:
./scripts/replay.sh recordings/login.spec.ts
Replay runs headless, without X11, and does not require xhost.
📤 Output
-
📄 Generated test:
recordings/codegen.spec.ts -
🧼 Ephemeral workspace (auto-deleted):
recordings/.work/
Nothing else touches your repo.
⚙️ Configuration (optional)
Environment variables:
| Variable | Default | Description |
|---|---|---|
PLAYWRIGHT_VERSION |
1.58.1 |
Playwright version |
PLAYWRIGHT_IMAGE |
auto | Docker image tag |
RECORDINGS_DIR |
recordings |
Output directory |
OUTPUT_FILE |
codegen.spec.ts |
Generated file name |
TARGET |
playwright-test |
Codegen target |
DISPLAY |
:0 |
X11 display |
Example:
OUTPUT_FILE=login.spec.ts make codegen
🧠 Design philosophy
- ❌ Not a test runner
- ❌ Not CI tooling
- ❌ Not framework glue
- ✅ A focused recording utility
- ✅ One job, done well
🔐 Security note
xhost +local:docker is used temporarily to allow GUI access.
Access is revoked automatically when the script exits.
🧑💻 Author
Kevin Veen-Birkenbach 📧 kevin@veen.world 🏡 www.veen.world
📜 License
MIT License – see LICENSE