Gulp task for web performance analysis and budgeting via WebPageTest.
$ npm install --save-dev gulp-webpagetest
Here is an example of a small test with budget goals :
var gulp = require('gulp'),
webpagetest = require('gulp-webpagetest');
gulp.task('webpagetest', webpagetest({
url: 'http://www.google.com',
key: 'YOUR_WEBPAGETEST_API_KEY',
location: 'Dulles:Chrome',
firstViewOnly: true,
output: 'output/results.json',
budget: {
SpeedIndex: 1000,
visualComplete: 1000
},
callback: function() {
console.log('WPT test done !');
}
}));
Type: Object
Default value: {}
Check the budget part to get the full list of budget goals you're able to set.
Type: Function
Default value: NONE
Function to call back once the test is finished.
Type:
String
Default value:"Cable"
Connectivity type (DSL, Cable, FIOS, Dial, 3G, 3GFast, Native, custom).
Type: Boolean
Default value: false
Set to true
to skip the Repeat View test.
Type: String
Default value: NONE
The API Key for the public instance of WebPageTest. Not needed if using a private instance of webpagetest.
Type: String
Default value: NONE
First-hop Round Trip Time in ms (REQUIRES 'custom' connectivity).
Type: String
Default value: "Dulles:Chrome"
WebPageTest Location to test from.
Type: String
Default value: NONE
User name to use for authenticated tests (HTTP authentication).
Type: String
Default value: NONE
The file to output the JSON results to.
Type: Integer
Default value: 0
Packet loss rate - percent of packets to drop (REQUIRES 'custom' connectivity).
Type: String
Default value: NONE
Password to use for authenticated tests (HTTP authentication).
Type: Integer
Default value: 5
Poll for results after test is scheduled at every n seconds.
Type: Integer
Default value: 1
Number of test runs (1-10 on the public instance).
Type: Integer
Default value: 60
Timeout (in seconds) for the tests to run.
Type: Integer
Default value: 1
Set to 1 to capture video (video is required for calculating Speed Index).
Type: String
Default value: NONE
URL to be tested (MANDATORY option).
Type: String
Default value: "www.webpagetest.org"
The WPT instance to conduct the tests with.
All the budget properties are integers
. The goal is reached is the result is lower than the property value set.
- adult_site:
- aft:
- bytesIn:
- bytesInDoc:
- bytesOut:
- bytesOutDoc:
- cached:
- connections:
- date:
- docCPUms:
- docCPUpct:
- docTime:
- domContentLoadedEventEnd:
- domContentLoadedEventStart:
- domElements:
- domTime:
- effectiveBps:
- effectiveBpsDoc:
- firstPaint:
- fixed_viewport:
- fullyLoaded:
- fullyLoadedCPUms:
- fullyLoadedCPUpct:
- gzip_savings:
- gzip_total:
- image_savings:
- image_total:
- lastVisualChange:
- loadEventEnd:
- loadEventStart:
- loadTime:
- minify_savings:
- minify_total:
- optimization_checked:
- render:
- requestsDoc:
- requestsFull:
- responses_200:
- responses_404:
- responses_other:
- result:
- run:
- score_cache:
- score_cdn:
- score_combine:
- score_compress:
- score_cookies:
- score_etags:
- score_gzip:
- score_keep-: alive
- score_minify:
- score_progressive_jpeg:
- server_count:
- server_rtt:
- SpeedIndex: SpeedIndex
- titleTime:
- TTFB:
- visualComplete: