record-e2e-gif Skill
Record Playwright e2e tests as GIF animations, one GIF per test case.
Prerequisites
ffmpegmust be installed (/opt/homebrew/bin/ffmpegon macOS)- 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/environment/environment.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)
/opt/homebrew/bin/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
IMPORTANT: GIF files must NEVER be committed to git. e2e/recordings/ is in .gitignore.
Image upload MUST use Chrome DevTools MCP — do NOT use gh CLI, GitHub releases, or any other method.
CRITICAL: GIF table MUST be added to the PR body (본문), NEVER as a PR comment.
The workflow:
- Navigate to the PR page via
mcp__chrome-devtools__navigate_page - Enter edit mode on the PR body (click "Show options" → "Edit comment")
- Upload GIFs via the "Attach files" button (
mcp__chrome-devtools__upload_file) to get CDN URLs - Extract CDN URLs (
github.com/user-attachments/assets/...) from the textarea - If uploads went to the comment textarea, extract URLs and clear it
- Set the PR body textarea content (preserve existing body + append GIF table) using
nativeInputValueSetter - Submit via the "Update comment" button on the PR body form
This produces persistent GitHub CDN URLs that render correctly in markdown. The user must be logged into GitHub in Chrome for this to work.
See .claude/agents/playwright-e2e-pr-updater.md for the full step-by-step Chrome DevTools upload workflow.
Output Format
Return a markdown table suitable for embedding in a PR description:
| Test | Recording |
|------|-----------|
| Admin can see the BAIPropertyFilter |  |
| Admin can filter by name |  |