Lighthouse Plugin
The plugin provides the ability to generate Lighthouse performance reports on the user experience of a page on both mobile and desktop devices, and provides suggestions on how that page may be improved.
Installation
-
Copy the below line to
dependencies
section of the projectbuild.gradle
fileExample 1. build.gradleimplementation(group: 'org.vividus', name: 'vividus-plugin-lighthouse', version: '0.5.12')
-
If the project was imported to the IDE before adding new dependency, re-generate the configuration files for the used IDE and then refresh the project in the used IDE.
Properties
Property Name | Acceptable values | Default | Description |
---|---|---|---|
|
<string> |
The application name to be used in the User-Agent header. |
|
|
<string> |
The API key that identifies your project and provides you with API access, quota, and reports. Its recommended to specify the key if you plan to use the plugin in an automated way and make multiple queries per second. |
|
|
comma-separated list of categories ( |
|
The audit catigories to run, by default the scan includes all 5 categories, but you can select particular ones depending on which aspects of your website you wish to analyze. |
Steps
Perform Lighthouse scan
Performs Lighthouse scan of the specified web page and validates performance metrics against expected thresholds.
When I perform Lighthouse $scanType scan of `$webPageUrl` page:$metricsValidations
-
$scanType
- The scan type to use:-
full
- The scan is performed on bothdesktop
andmobile
devices. -
desktop
- The scan is performed ondesktop
device. -
mobile
- The scan is performed onmobile
device.
-
-
$webPageUrl
- The page URL to perform scan on. -
$metricsValidations
- The metric validations:-
$metric
- The Lighthouse metric name.-
Performance metrics:
-
First Contentful Paint
-
Largest Contentful Paint
-
Total Blocking Time
-
Cumulative Layout Shift
-
Speed Index
-
-
Audit scores:
-
Accessibility Score
-
Best Practices Score
-
Performance Score
-
PWA Score
-
SEO Score
-
-
-
$rule
- The comparison rule. -
$threshold
- The expected integer or floating (e.g.0.35
) number.
-
When I perform Lighthouse full scan of `https://dequeuniversity.com/demo/mars` page:
|metric |rule |threshold|
|First Contentful Paint |LESS_THAN |500 |
|Largest Contentful Paint|LESS_THAN |500 |
|Total Blocking Time |LESS_THAN |100 |
|Cumulative Layout Shift |LESS_THAN |100 |
|Speed Index |LESS_THAN |1500 |
|Accessibility Score |GREATER_THAN|90 |
|Best Practices Score |EQUAL_TO |100 |
|Performance Score |GREATER_THAN|95 |
|PWA Score |GREATER_THAN|20 |
|SEO Score |GREATER_THAN|85 |