Google Lighthouse Puppeteer is a package to generate reports on multiple urls that allows or not authentication
Usage no npm install needed!
<script type="module">
import googleLighthousePuppeteer from 'https://cdn.skypack.dev/google-lighthouse-puppeteer';
</script>
README
Lighthouse Puppeteer - NPM Package
DISCLAIMER: As-of 2021, this product does not have a free support team anymore. If you want this product to be maintained, please support on Patreon.
(This product is available under a free and permissive license, but needs financial support to sustain its continued improvements. In addition to maintenance and stability there are many desirable features yet to be added.)
Google Chrome Headless is the Google Chrome browser that can be started without graphical interface to accomplish several tasks (PDF printing, performance, automation...)
Google Lighthouse analyzes web apps and web pages, collecting modern performance metrics and insights on developer best practices.
Google Puppeteer is a tool to automate tasks on a Chrome (headless) browser.
Description
The purpose of this package image is to produce performance report for several pages in connected mode and in an automated (programmated) way.
It uses lighthouse-batch to be able to automate export of multiple
gt; lighthouse-puppeteer -h
Options
-f, --file FILE Path to your testcase REQUIRED (default option)
(example: /home/chrome/testcases/mytestcase.js)
-p, --port PORT Chrome headless debug port (default: 9222)
-c, --chromium_params Optional parameters to pass to chrome/chromium browser
(https://peter.sh/experiments/chromium-command-line-switches/)
(example: "- --no-sandbox --disable-setuid-sandbox --ssl-version-max=tls1.1")
-v, --verbose Providing this option once will show more info from Lighthouse.
Providing it twice will additionally provide info from `lighthouse-batch`.
-h, --help Print this usage guide.
Lighthouse
-d, --output_directory FOLDER Path to output reports
(default: /home/chrome/reports)
-w, --html Renders HTML reports alongside JSON reports
-l, --lighthouse_params Optional parameters to pass to lighthouse
(https://github.com/GoogleChrome/lighthouse/#cli-options)
(example: "- --quiet --perf")
Puppeteer
You can add your options for puppeteer by prefixing them with --puppeteer-
(https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions)
example: "--puppeteer-ignoreHTTPSErrors --puppeteer-slowMo 20"
If you want to use your own Chrome/Chromium instead of the provided by Puppeteer, you can add the following two environment variables:
# This environment is used by puppeteer to know where your chrome browser installed in located
CHROME_PATH=/usr/bin/chromium-browser
# This environment tells puppeteer and npm to not install the browser in node_modules
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
You should create a testcase file named whateverYouWant.js.
This file must module.exports an object which must contain two methods : connect and getUrls.
connect
This method must return a Promise which resolves the browser (first argument received of the method connect).
The purpose of this method is to connect the user to the browser.
getUrls
This method must return an array of string for the url to be tested. You can put url restricted by connection since the connect method will grant you access.