# ๐ŸŽญ 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 `/tmp` usage** 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** * `.gitkeep` ensures 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: ## โš™๏ธ Installation (one-time) Prepare the recorder script: ```bash make install ``` This makes `scripts/codegen.sh` executable. --- ## ๐ŸŽฅ Start recording ```bash make codegen ``` Or with a start URL: ```bash ./scripts/codegen.sh https://example.com/login ``` --- ## ๐Ÿ“ค Output * ๐Ÿ“„ Generated test: ```text recordings/codegen.spec.ts ``` * ๐Ÿงผ Ephemeral workspace (auto-deleted): ```text 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: ```bash 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](mailto:kevin@veen.world) ๐Ÿก [www.veen.world](https://www.veen.world) --- ## ๐Ÿ“œ License MIT License โ€“ see [LICENSE](LICENSE)