Skip to content
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

support network request interception #219

Open
redabacha opened this issue Oct 27, 2022 · 5 comments
Open

support network request interception #219

redabacha opened this issue Oct 27, 2022 · 5 comments

Comments

@redabacha
Copy link

Mode

Storybook

Feature description

would be nice if there was a config option allowing us to setup custom page routes before loading the page https://playwright.dev/docs/network#modify-requests. however, the current storybook solution uses file:// urls when loading pages which are known to be problematic with this, see microsoft/playwright#8412.

@d-ivashchuk
Copy link
Collaborator

Hey @redabacha! I am myself very keen on the idea that lost-pixel supports something like MSW out of the box so you can just write your handlers and render different pages with different responses! Could you elaborate a little bit more on your use case? I think in Storybook you'd already be able to use MSW to render different stories with different responses. You'd use msw plugin storybook.

Still, I would want to know a bit more about the problem you are trying to solve and see how we can be of help!

@redabacha
Copy link
Author

hi @d-ivashchuk, msw is great however since it runs in a service worker it doesn't have access to the nodejs environment which is very useful when needing to interact with the local filesystem for example and it also doesn't have a capability of being able to record / replay network requests unlike alternatives such as polly.js (which has a working playwright integration https://netflix.github.io/pollyjs/#/adapters/playwright). being able to record / replay network requests is very helpful on larger apps where the maintenance burden of writing mocks for many requests is quite high.

@d-ivashchuk
Copy link
Collaborator

Okay, gotcha! So you want to have more access to native playwright integrations when it comes to working with network?

@redabacha
Copy link
Author

redabacha commented Nov 3, 2022

So you want to have more access to native playwright integrations when it comes to working with network?

yes exactly, that would be awesome if that could be supported! 😅

@d-ivashchuk
Copy link
Collaborator

we can definitely look into it! If you will have any idea on specific tools or maybe would want to do a PR to enable this - I'd be more than happy to assist you!

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

No branches or pull requests

2 participants