lost-pixel / lost-pixel

Open source alternative to Percy, Chromatic, Applitools.

Home Page:https://lost-pixel.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

support network request interception

redabacha opened this issue · comments

commented

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.

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!

commented

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.

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

commented

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! 😅

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!