microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.18k stars 3.61k forks source link

[Feature]: expose router fixtures to "normal" tests (not component) #32043

Open Tallyb opened 2 months ago

Tallyb commented 2 months ago

🚀 Feature Request

The newly router fixture allows setting multiple handlers for page router request. However, it is limited to component testing only. is there are specific limitation it is limited to CT?

Example

We have routes to external systems in e2e that we want to mock (mostly due to charges imposed by the external system). Having them easily mocked can help in e2e tests and not just in component.

Motivation

can be useful for e2e tests as well.

dgozman commented 2 months ago

@Tallyb Thank you for trying the router fixture! It is currently experimental, so we are not bringing it yet to e2e tests.

Could you please explain why would you want it for e2e? Note that you can call page.route() as many times as you'd like, with the same effect as you'd call router.route(). Are you after the MSW-style syntax? Anything else?

Tallyb commented 1 month ago

one thing I can think of is that since this is a fixture, and assume my goto is also a fixture, I can now "enforce" the order between the fixtures.