record-e2e-gif Skill
Record Playwright e2e tests as GIF animations, one GIF per test case.
Prerequisites
ffmpegmust be onPATH(command -v ffmpeg)gh2.99.0 or newer with push access, to attach the recordings to a PR- Playwright dev server must be running. The endpoint is read from
e2e/envs/.env.playwright(E2E_WEBUI_ENDPOINT). Do NOT hardcode the port — it varies per environment.
How It Works
- Run specified Playwright tests with
--video=on(Playwright saves.webmper test intest-results/) - For each
.webmfile, convert to.gifusing ffmpeg with palette optimization - Save GIFs to
e2e/recordings/{spec-name}/directory - Return a map of test name → GIF file path
Usage
When invoked, ask for or accept:
testFile: path to the spec file (e.g.e2e/project/session/session-lifecycle.spec.ts)grep: optional test name pattern to filter (e.g.BAIPropertyFilter)project: browser project, defaultchromiumoutputDir: output directory for GIFs, defaulte2e/recordings
Recording Command
pnpm exec playwright test {testFile} --grep "{grep}" --project={project} \
--video=on --reporter=list 2>&1
Videos are saved to test-results/*/video.webm (one directory per test).
Conversion Command (per video)
ffmpeg -y \
-i "{input.webm}" \
-vf "fps=8,scale=960:-1:flags=lanczos,split[s0][s1];[s0]palettegen=max_colors=128[p];[s1][p]paletteuse=dither=bayer" \
-loop 0 \
"{output.gif}"
fps=8: 8 frames per second (smooth enough, small file size)scale=960:-1: 960px wide, height autopalettegen/paletteuse: two-pass palette for high quality GIF
Finding Test Name from Directory
Playwright names test result directories as:
{spec-dir}-{describe-name}-{test-name}-{project}/
Parse the directory name to derive a slug for the GIF filename:
- Strip the browser suffix (
-chromium) - Replace spaces and special chars with
- - Truncate to 60 chars
Uploading GIFs to GitHub PR
GIFs stay out of git (e2e/recordings/ is in .gitignore). Attach them with
gh pr edit --attach, following Steps 5-6 of .claude/agents/playwright-e2e-pr-updater.md:
the table goes in the PR body, and each reference is the same path you pass to --attach.
Those steps assume the default outputDir.
If ffmpeg is unavailable, attach the videos instead of GIFs. Run
mkdir -p e2e/recordings and copy each test-results/{dir}/video.webm to
e2e/recordings/{slug}.webm first, since every recording has the same basename.  plays as a video, also inside a
table cell.
Output Format
Return a markdown table suitable for embedding in a PR description. Before the upload it
holds the local paths. After the upload, return the table from the saved PR body, since the
local paths render nowhere else:
| Test | Recording |
|------|-----------|
| Admin can see the BAIPropertyFilter |  |
| Admin can filter by name |  |