I'm trying to perform audit using Lighthouse DevTools. My site requires authentication. When I run the test the lighthouse logs me out and only anayses /login.
How can I get Lighthouse DevTools to analyse my site? Can I supply login credentials?
If you are using local storage in order to preserve an authenticated state after refresh (for example storing a user's token, and on refresh using that token in order to login like a lot of SPA's) I found a solution that might work : https://github.com/GoogleChrome/lighthouse/issues/1418#issuecomment-397753583
If using chrome dev tools to run light house :
If using the lighthouse cli tool :
--disable-storage-reset
flag , and you can also add the --view
flag in order to open a tab for the report.So the command will be :
lighthouse <url> --port <port_chrome_debugger_opened> --disable-storage-reset --view
Verifying it tested the logged in page
See Testing on a site with authentication in the official readme:
When installed globally via npm i -g lighthouse or yarn global add lighthouse, chrome-debug is added to your PATH. This binary launches a standalone Chrome instance with an open debugging port.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With