You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a service worker is designed to only operate on mobile devices (consider website owners who outsource the mobile development of their site), then either user agent inspection or feature detection is required to limit the worker's scope. This works fine for mobile devices, but does not play well with the lighthouse test in desktop Chrome Dev Tools.
The lighthouse test in Chrome Dev Tools emulates a mobile device for the page being tested, but the service worker is stuck with the desktop user agent. This causes some PWA tests to fail since the service worker is designed to only operate on mobile devices: e.g. Does not respond with a 200 when offline and Service worker does not successfully serve the manifest's start_url.
I realize it is possible to 1) run lighthouse directly on a mobile device, and 2) start chrome with a specific user agent via the --user-agent flag, but these solutions are too technical for some website operators that just want to verify lighthouse scores via point-and-click. Would it be possible to emulate a user agent for service workers running on the same domain as the test is being performed?
The text was updated successfully, but these errors were encountered:
Thanks for the thorough report and explanation @mattwomple!
Yes, it is possible, but requires some extra work blocked by #709. Essentially we need to replicate our emulation settings in both page and worker contexts.
If a service worker is designed to only operate on mobile devices (consider website owners who outsource the mobile development of their site), then either user agent inspection or feature detection is required to limit the worker's scope. This works fine for mobile devices, but does not play well with the lighthouse test in desktop Chrome Dev Tools.
The lighthouse test in Chrome Dev Tools emulates a mobile device for the page being tested, but the service worker is stuck with the desktop user agent. This causes some PWA tests to fail since the service worker is designed to only operate on mobile devices: e.g. Does not respond with a 200 when offline and Service worker does not successfully serve the manifest's start_url.
I realize it is possible to 1) run lighthouse directly on a mobile device, and 2) start chrome with a specific user agent via the
--user-agent
flag, but these solutions are too technical for some website operators that just want to verify lighthouse scores via point-and-click. Would it be possible to emulate a user agent for service workers running on the same domain as the test is being performed?The text was updated successfully, but these errors were encountered: