Home:ALL Converter>Lighthouse dev tools - site with authentication

Lighthouse dev tools - site with authentication

Ask Time:2019-09-19T22:32:15         Author:Kermit

Json Formatter

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?

Author:Kermit,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/58013387/lighthouse-dev-tools-site-with-authentication
coderrr22 :

If you are using local storage in order to preserve an authenticated state after refresh\n(for example storing a user's token, and on refresh using that token in order to login like a lot of SPA's)\nI found a solution that might work :\nhttps://github.com/GoogleChrome/lighthouse/issues/1418#issuecomment-397753583\nIf using chrome dev tools to run light house :\n\nOn the lighthouse tab in chrome dev tools simply click the settings icon\nUncheck the clear storage check box.\nGenerate the report, and on refresh it will use the local storage data therefore will keep you logged in.\n\nIf using the lighthouse cli tool :\n\nInstall and execute as explained in JoostS answer, just add to the lighthouse command the --disable-storage-reset flag , and you can also add the --view flag in order to open a tab for the report.\n\nSo the command will be :\nlighthouse <url> --port <port_chrome_debugger_opened> --disable-storage-reset --view\n\nVerifying it tested the logged in page\n\nYou can verify it tested the logged in page by looking at the report under the performance metrics there are images of the page that was loaded, so if the images correspond to the logged in page I believe it means it was tested correctly.\n",
2020-09-22T09:34:24
Mr. Hugo :

See Testing on a site with authentication in the official readme:\n\n\n\nWhen 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.\n\n\nRun chrome-debug. This will log the debugging port of your Chrome instance\nNavigate to your site and log in.\nIn a separate terminal tab, run lighthouse [siteurl] --port port-number using the port number from chrome-debug.\n",
2019-09-25T14:00:45
yy