We have a problem at our company of reliably testing service worker lifecycle and that currently blocks our MV2->MV3 migration, see details below 👇
We are using Puppeteer for testing our extension and was hoping to use it for testing the service worker lifecycle, our script does the following:
Open `chrome://serviceworker-internals` in a new tab
Loading our UI into another page
Click on stop button in `chrome://serviceworker-internals`
Click on the extension UI element that is supposed to wake up the extension.
The problem we are having is that when we are doing the test with automation framework (Puppeteer in our case) service worker is being killed for good, it never wakes up, even when the “start” button is clicked in chrome://serviceworker-internals page.
Was able to create a test case that actually reproduces that issue reliably here: https://github.com/Manvel/puppeteer-kill-extension-sw
Also filed a bug report here: https://crbug.com/1371432
One interesting observation is that the issue doesn’t happen when the service worker inspector page is open.
Wonder if you had a similar issue and how did you fix it?