Skip to content

feat: add video on test failure - #206

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

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

Conversation

@veljkho

@veljkho veljkho commented Apr 6, 2026 •

Copy link
Copy Markdown

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.

@nexxai

nexxai commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

Holy crap, yes! This would be amazing.

@nunomaduro please merge!

Veljko Vujanovic and others added 3 commits October 9, 2026 16:46
@veljkho
veljkho force-pushed the add/feature/video-on-failure branch from fdb81af to 3d5b93a Compare October 9, 2026 14:47
@veljkho

veljkho commented Oct 9, 2026

Copy link
Copy Markdown
Author

Hi @nunomaduro 👋

I opened this in April and it's had no review yet, so I wanted to check whether this is something you'd want in Pest Browser.

It keeps a .webm recording when a browser test fails and deletes it when the test passes. You turn it on with browser()->recordVideoOnFailure() or --record-video.

Two questions:

Is this a feature you'd accept? If not, I'll close the PR.
Should it target 4.x or 5.x? I based it on 4.x, but I see 5.x is the default branch. I'm happy to rebase or retarget it.
I've just rebased it onto the latest 4.x. If you're interested, I can add more tests or docs, or change the API. Thanks!

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