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

Prepare service worker without registering it #343

Open
PaperStrike opened this issue Nov 22, 2021 · 0 comments
Open

Prepare service worker without registering it #343

PaperStrike opened this issue Nov 22, 2021 · 0 comments

Comments

@PaperStrike
Copy link
Contributor

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:

  1. When using the sw option, playwright-test registers the service worker immediately on the page load.
  2. Unlike workers, service workers can't be terminated.
  3. 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.)
  4. Using a controllable iframe or new window doesn't help, it inherits the service worker.
  5. When not using the sw option, I have to create my own bundle to pass it as an asset to playwright-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.

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

1 participant