Skip to content

Add playwright routes support - #235

Open
Jonathan-384481 wants to merge 3 commits into
pestphp:4.xfrom
Jonathan-384481:routes
Open

Add playwright routes support#235
Jonathan-384481 wants to merge 3 commits into
pestphp:4.xfrom
Jonathan-384481:routes

Conversation

@Jonathan-384481

Copy link
Copy Markdown

This pull request adds routes to pest-plugin-browser with minimal changes to the current code. Use with

visit('/')->withRoute('**/message', fn (PlaywrightRoute $route) => $route->continue());

or

$page->route('**/*', fn (PlaywrightRoute $route) => $route->abort());

Currently supported methods are continue, abort and fulfill

@KhyFee KhyFee left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Useful addition — withRoute / route covering continue/abort/fulfill matches the Playwright surface people reach for first.

Notes from the diff:

  1. setNetworkInterceptionPatterns with a glob is good; confirm overlapping patterns / multiple withRoute calls append rather than replace (tests only show a single pattern).
  2. PHPDoc says callable(Route): bool but fulfill/abort examples look side-effecting — clarify return-value expectations (ignored vs must return true).
  3. Route::reset() between tests is important; worth asserting in a test that handlers do not leak across visit() calls.
  4. Naming PlaywrightRoute in userland vs internal Route is fine; a short README snippet with the three verbs would help discoverability.

Happy to see this land once multi-route + reset behavior is confirmed.

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