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
filePlease make sure to use the same version for all VIVIDUS dependencies. Example 1. build.gradleimplementation(group: 'org.vividus', name: 'vividus-plugin-lighthouse', version: '0.6.3')
-
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 categories 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. |
|
number between 0 and 100 exclusively |
empty |
Lighthouse performance scores are changed due to inherent variability in web and network technologies, even if there hasn’t been a code change, to alleviate these effects this property allows to choose a measurement for validation based on the specified percentile. This property requires |
|
positive number |
empty |
Specifies the number of Lighthouse measurements performed before validation. This property requires |
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 |
Compare Lighthouse audit scores of two pages
Performs a Lighthouse scan on both the baseline and checkpoint pages validating that the audit scores of the checkpoint page have not worsened compared to the audit scores of the baseline page.
Property Name | Acceptable values | Default | Description |
---|---|---|---|
|
number |
5 |
Lighthouse scan results may vary from one scan to another, to alleviate this variety the property enables acceptable percentage delta between checkpoint and baseline audit scores. |
Then Lighthouse $scanType audit scores for `$checkpointPage` page are not less than for `$baselinePage` page
-
$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.
-
-
$checkpointPage
- The checkpoint page. -
$baselinePage
- The baseline page.
Then Lighthouse desktop audit scores for `https://www.vividus-reactjs.com/` page are not less than for `https://www.vividus-vuejs.com/` page