Skip to content

Add slow motion support for easy debugging - #248

Open
nicoverbruggen wants to merge 2 commits into
pestphp:5.xfrom
spatie:port/slow-mo-5x
Open

Add slow motion support for easy debugging#248
nicoverbruggen wants to merge 2 commits into
pestphp:5.xfrom
spatie:port/slow-mo-5x

Conversation

@nicoverbruggen

Copy link
Copy Markdown

Playwright has a slowMo launch option that delays each interaction, which is what you want when you are watching a headed run to check that a test does the right things in the right order.

At Spatie, we're using more AI to generate browser tests. This way we can run individual tests with --slow-mo and tests tend to play out like they would with real users, who slow down between clicking on buttons, links and interacting with elements on the website.

Currently, Pest's browser plugin does not expose this Playwright flag, and a hacky workaround is required to get this to work today.

I looked at prior PRs and found #230, which was created for Pest 4. I've ported this PR and improved for Pest 5.

It adds a --slow-mo flag, optionally with a value in milliseconds, and pest()->browser()->slowMo(250). I've credited the original author of that PR in my first commit, but I've made adjustments in the second that make the argument parsing etc. more in line with the rest of the code of the project.

This PR also refuses slow motion under --parallel, next to headed mode, screenshot diffing and debug assertions. Slow motion is only really useful when you can watch a run, and headed mode is already refused there, so the combination just makes things slower.

nicoverbruggen and others added 2 commits August 10, 2026 16:51
Ports pestphp#230 to the 5.x branch, which lets
users run Playwright's `slowMo` mode, which is very useful to review
AI-generated browser tests.

Co-authored-by: Peter Elmered <peter@elmered.com>
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.

1 participant