-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat(browser): add page.route intercept support #9011
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(browser): add page.route intercept support #9011
Conversation
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
2d5ec7e to
bbe315d
Compare
bbe315d to
a0ffdd7
Compare
sheremet-va
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your work, but we do not plan to have support for playwright Route API. If anything, we would prefer the MSW API.
|
@sheremet-va Thanks for the feedback. My thinking was that supporting the Playwright Route API would let us avoid bringing in third-party tooling like MSW and improve the developer experience. Could you explain why MSW would be preferable here? I may not fully understand Vitest’s direction, so I’d appreciate a bit more context. |
I am not saying MSW would be preferable, but MSW API, if we ever implement HTTP interception. I see several reasons:
In general, we don't provide all playwright APIs, we provide APIs that we consider to be good. I really like locators, for example. But I think the |
|
@sheremet-va Thank you very much for your explanation! That really helped me understand the situation. I appreciate your help. I'll go ahead and close this pull request. |
|
As a note, I think the interception you implemented is really good, I would just prefer if the user-facing API (page.*) would follow MSW interface |
|
@sheremet-va Taking the feedback into account, would it be alright if I submit another PR sometime? I’m not sure when yet, but I’d like to give it another shot. |
Yes, if you want to work on it |
Description
Adds first-class network interception support to Vitest browser mode. page.route, page.unroute, and page.unrouteAll are now available to tests, piping through new RPC commands and provider hooks. The Playwright backend reuses its native routing while WebdriverIO integrates with browser.mock (BiDi) so both providers can fulfill, continue, or abort requests. Tests cover fulfill/abort flows and cleanup guarantees.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.