Skip to content

feat: add video on test failure#206

Open
veljkho wants to merge 3 commits intopestphp:4.xfrom
veljkho:add/feature/video-on-failure
Open

feat: add video on test failure#206
veljkho wants to merge 3 commits intopestphp:4.xfrom
veljkho:add/feature/video-on-failure

Conversation

@veljkho
Copy link
Copy Markdown

@veljkho veljkho commented Apr 6, 2026

Adds support for video recording of browser test sessions, automatically saving a .webm video when a test fails. Videos from passing tests are silently deleted to avoid unnecessary disk usage. This is optional just like in Playwright.

Playwright has a native recordVideo context option that writes a .webm file to a directory during the session. The video is finalized when the browser context closes — which already happens in the existing afterEach hook via Playwright::reset(). After reset, the plugin moves the video to tests/Browser/Videos/ on failure, or removes it on success.

Usage

Enable globally in Pest.php:

browser()->recordVideoOnFailure();

or call it via --record-video when running tests.

Videos are .webm format, playable in all modern browsers
No new dependencies — relies entirely on Playwright's built-in recording
Parallel runs are safe since each worker uses its own isolated temp directory

Added unit tests.
Tested locally with a local browser test that intentionally failed.

Veljko Vujanovic added 2 commits April 6, 2026 12:44
This adds a new feature to store video on test failure optionally just like in Playwright
@nexxai
Copy link
Copy Markdown
Contributor

nexxai commented Apr 6, 2026

Holy crap, yes! This would be amazing.

@nunomaduro please merge!

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