-
-
Notifications
You must be signed in to change notification settings - Fork 12
Description
Is your feature request related to a problem? Please describe.
I want to test a script in a service worker's both presence and absence. However, there are something blocking this:
- When using the
swoption,playwright-testregisters the service worker immediately on the page load. - Unlike workers, service workers can't be terminated.
- Unregistering a service worker only take effects after the page unload. There isn't a reliable way to unregister immediately yet. (discuss in A way to immediately unregister a service worker w3c/ServiceWorker#614.)
- Using a controllable iframe or new window doesn't help, it inherits the service worker.
- When not using the
swoption, I have to create my own bundle to pass it as an asset toplaywright-test.
So there seems no easy way to tun tests in both the service worker's presence and absence.
Describe the solution you'd like
An option, that stops playwright-test from registering the service worker but keeps playwright-test preparing the bundle. Also, the path of the bundled sw should be exposed somewhere (maybe like PW_TEST.env.swURL) so that we can register it later. The user will have more control on the register option, too.
Describe alternatives you've considered
Stop using sw option, and prepare my own bundle for service worker before running playwright-test.
Additional context
None yet.