feat: allow passing options to click() and press()#233
Open
DanielGSoftware wants to merge 1 commit into
Open
Conversation
Forwards an optional array of Playwright locator options through click() and press() to the underlying locator. This enables options such as noWaitAfter for actions that trigger a navigation, which otherwise hang (see pestphp/pest#1511).
This was referenced Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
click()andpress()currently call the underlying Playwright locator with no options, so there's no way to pass locator options such asnoWaitAfter,timeout,position, orbutton.This adds an optional
?array $options = nullparameter to both, forwarded straight through to the locator'sclick():Motivation
The main driver is
noWaitAfterfor actions that trigger a navigation. Today aclick()/press()that navigates can hang until the timeout on pages whose load doesn't settle quickly (e.g. Livewire/SPA pages that fire a request after theloadevent) — see pestphp/pest#1511.noWaitAfterlets the action dispatch without blocking on the navigation to settle; a followingassertPathIs/assertSee(still retried) then confirms the result. This is a narrow, opt-in option rather than a change to the global retry behavior.Tests
Added forwarding tests for both
clickandpress— they pass['button' => 'right']and assert acontextmenuhandler fired, which a plain click would not trigger, proving the option reaches the locator. Existing click/press tests are unchanged.composer lint(pint + rector),phpstan, and 100% type-coverage pass