Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

webpagetest

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpagetest - npm Package Compare versions

Comparing version 0.3.9 to 0.4.0

4

lib/helper.js
/**
* Copyright (c) 2013, Twitter Inc.
* Copyright (c) 2015, Google Inc.
* Copyright (c) 2015, Marcel Duran and other contributors
* Copyright (c) 2020, Google Inc.
* Copyright (c) 2020, Marcel Duran and other contributors
* Released under the MIT License

@@ -6,0 +6,0 @@ */

/**
* Copyright (c) 2013, Twitter Inc.
* Copyright (c) 2015, Google Inc.
* Copyright (c) 2015, Marcel Duran and other contributors
* Copyright (c) 2020, Google Inc.
* Copyright (c) 2020, Marcel Duran and other contributors
* Released under the MIT License

@@ -6,0 +6,0 @@ */

/**
* Copyright (c) 2013, Twitter Inc.
* Copyright (c) 2015, Google Inc.
* Copyright (c) 2015, Marcel Duran and other contributors
* Copyright (c) 2020, Google Inc.
* Copyright (c) 2020, Marcel Duran and other contributors
* Released under the MIT License

@@ -6,0 +6,0 @@ */

/**
* Copyright (c) 2013, Twitter Inc.
* Copyright (c) 2015, Google Inc.
* Copyright (c) 2015, Marcel Duran and other contributors
* Copyright (c) 2020, Google Inc.
* Copyright (c) 2020, Marcel Duran and other contributors
* Released under the MIT License

@@ -9,9 +9,9 @@ */

var fs = require('fs'),
Mocha = require('mocha'),
assert = require('assert');
Mocha = require('mocha'),
assert = require('assert');
function buildSuite(defaults, tests) {
describe(defaults.suiteName || 'WebPageTest', function() {
tests.forEach(function(test) {
it(test.text, function() {
describe(defaults.suiteName || 'WebPageTest', function () {
tests.forEach(function (test) {
it(test.text, function () {
if (test.result instanceof Error) {

@@ -103,3 +103,6 @@ return assert.ifError(test.result);

return {text: text, result: result};
return {
text: text,
result: result
};
}

@@ -109,4 +112,4 @@

var defaults = {},
tests = [],
path = [];
tests = [],
path = [];

@@ -119,3 +122,3 @@ // bail if test not complete

function traverse(specs, data) {
Object.keys(specs).forEach(function(key) {
Object.keys(specs).forEach(function (key) {
// bail on default

@@ -135,10 +138,33 @@ if (key === 'defaults' && !path.length) {

}
if (Array.isArray(data[key]) && specs[key].find && specs[key].find.length) {
specs[key].find.forEach(find => {
if (find.key && find.pattern && find.spec) {
var arrData = data[key];
var filteredData = arrData.find(function (item) {
var regex = new RegExp(find.pattern);
return regex.test(item[find.key]);
});
if (filteredData) {
path.push(find.key + "." + filteredData[find.key]);
traverse(find.spec, filteredData);
path.pop();
} else if (find.required) {
tests.push({
text: path.join('.') + "." + find.key + ".match(" + find.pattern + ")",
result: new Error('not found')
});
}
}
});
path.pop();
return;
}
var spec = specs[key];
if (typeof spec === 'object' && !spec.min && !spec.max) {
traverse(spec, data[key]);
} else if(typeof spec === 'number' && Array.isArray(data[key])) {
tests.push(
buildTest(path.join('.'), spec, data[key].length, defaults));
path.pop();
path.pop();
} else if (typeof spec === 'number' && Array.isArray(data[key])) {
tests.push(
buildTest(path.join('.'), spec, data[key].length, defaults));
path.pop();
} else {

@@ -162,3 +188,6 @@ tests.push(buildTest(path.join('.'), spec, data[key], defaults));

if (err) {
tests.push({text: err.message, result: err});
tests.push({
text: err.message,
result: err
});
} else {

@@ -170,6 +199,8 @@ defaults = specs.defaults || {};

// run mocha suite
var mocha = new Mocha({reporter: reporter});
var mocha = new Mocha({
reporter: reporter
});
mocha.suite.emit('pre-require', global, null, mocha);
buildSuite(defaults, tests);
mocha.run(callback || function(failures) {
mocha.run(callback || function (failures) {
process.exit(failures);

@@ -179,2 +210,2 @@ });

module.exports = specsRunner;
module.exports = specsRunner;
/**
* Copyright (c) 2013, Twitter Inc.
* Copyright (c) 2015, Google Inc.
* Copyright (c) 2015, Marcel Duran and other contributors
* Copyright (c) 2020, Google Inc.
* Copyright (c) 2020, Marcel Duran and other contributors
* Released under the MIT License

@@ -365,2 +365,5 @@ */

} else {
if (!data) {
data = {testId: testId};
}
resultsCallback(err, data);

@@ -367,0 +370,0 @@ }

{
"name": "webpagetest",
"version": "0.3.9",
"version": "0.4.0",
"description": "WebPageTest API wrapper for NodeJS",

@@ -28,14 +28,14 @@ "author": "Marcel Duran <github@marcelduran.com> (http://github.com/marcelduran)",

"engines": {
"node": ">=0.10.1"
"node": ">=10.18.1"
},
"dependencies": {
"commander": "2.10.0",
"csv": "^1.1.1",
"entities": "^1.1.1",
"mocha": "^3.4.1",
"xml2js": "^0.4.17"
"commander": "^5.1.0",
"csv": "^5.3.2",
"entities": "^2.0.3",
"mocha": "^8.0.1",
"xml2js": "^0.4.23"
},
"devDependencies": {
"nock": "~9.0.13"
"nock": "^12.0.3"
}
}

@@ -20,3 +20,3 @@ ## WebPageTest API Wrapper for NodeJS

```bash
$ webpagetest test https://twitter.com/marcelduran
$ webpagetest test http://marcelduran.com/webpagetest-api
```

@@ -31,3 +31,3 @@

```bash
$ docker run -it --rm webpagetest-api -k YOURAPIKEY test https://twitter.com/marcelduran
$ docker run -it --rm webpagetest-api -k YOURAPIKEY test http://marcelduran.com/webpagetest-api
```

@@ -40,3 +40,3 @@

wpt.runTest('https://twitter.com/marcelduran', (err, data) => {
wpt.runTest('http://marcelduran.com/webpagetest-api', (err, data) => {
console.log(err || data);

@@ -235,5 +235,5 @@ });

#### 2. Run test on https://twitter.com/marcelduran from San Jose on IE9
#### 2. Run test on http://marcelduran.com/webpagetest-api from San Jose on IE9
```bash
$ webpagetest test https://twitter.com/marcelduran --key 1F2A3K4E5 --location SanJose_IE9
$ webpagetest test http://marcelduran.com/webpagetest-api --key 1F2A3K4E5 --location SanJose_IE9
```

@@ -286,3 +286,3 @@ ```javascript

"summary": "https://www.webpagetest.org/result/121025_PT_N8K/",
"testUrl": "https://twitter.com/marcelduran",
"testUrl": "http://marcelduran.com/webpagetest-api",
"location": "SanJose_IE9",

@@ -320,9 +320,9 @@ "connectivity": "DSL",

#### Run test on https://twitter.com/marcelduran and poll results every 5 seconds timing out in 60 seconds
#### Run test on http://marcelduran.com/webpagetest-api and poll results every 5 seconds timing out in 60 seconds
```bash
$ webpagetest test https://twitter.com/marcelduran --poll 5 --timeout 60
$ webpagetest test http://marcelduran.com/webpagetest-api --poll 5 --timeout 60
```
#### Or run test on https://twitter.com/marcelduran and wait for results listening on localhost\* port 8000\**
#### Or run test on http://marcelduran.com/webpagetest-api and wait for results listening on localhost\* port 8000\**
```bash
$ webpagetest test https://twitter.com/marcelduran --wait 8000
$ webpagetest test http://marcelduran.com/webpagetest-api --wait 8000
```

@@ -335,3 +335,3 @@ ```javascript

"testId": "121025_PT_N8K",
"testUrl": "https://twitter.com/marcelduran",
"testUrl": "http://marcelduran.com/webpagetest-api",
...

@@ -553,5 +553,5 @@ "median": {

#### 3. Run test on https://twitter.com/marcelduran from San Jose on IE9
#### 3. Run test on http://marcelduran.com/webpagetest-api from San Jose on IE9
```javascript
wpt.runTest('https://twitter.com/marcelduran', {location: 'SanJose_IE9'}, (err, data) => {
wpt.runTest('http://marcelduran.com/webpagetest-api', {location: 'SanJose_IE9'}, (err, data) => {
console.log(err || data);

@@ -586,5 +586,5 @@ });

#### Run test on https://twitter.com/marcelduran and poll results every 5 seconds timing out in 60 seconds
#### Run test on http://marcelduran.com/webpagetest-api and poll results every 5 seconds timing out in 60 seconds
```javascript
wpt.runTest('https://twitter.com/marcelduran', {pollResults: 5, timeout: 60}, (err, data) => {
wpt.runTest('http://marcelduran.com/webpagetest-api', {pollResults: 5, timeout: 60}, (err, data) => {
console.log(err || data);

@@ -594,5 +594,5 @@ });

#### Or run test on https://twitter.com/marcelduran and wait results listening on localhost\* port 8000\*\*
#### Or run test on http://marcelduran.com/webpagetest-api and wait results listening on localhost\* port 8000\*\*
```javascript
wpt.runTest('https://twitter.com/marcelduran', {waitResults: 'localhost:8000'}, (err, data) => {
wpt.runTest('http://marcelduran.com/webpagetest-api', {waitResults: 'localhost:8000'}, (err, data) => {
console.log(err || data);

@@ -618,3 +618,3 @@ });

$ curl http://localhost:8080/help
$ curl http://localhost:8080/test/twitter.com/?location=SanJose_IE9
$ curl http://localhost:8080/test/marcelduran.com/?location=SanJose_IE9
```

@@ -657,4 +657,4 @@ ```bash

```
test twitter.com/marcelduran --first --location foo
test twitter.com/marcelduran --first --location bar
test marcelduran.com --first --location foo
test marcelduran.com --first --location bar
```

@@ -690,4 +690,4 @@ It schedules the 2 tests above returning an array of size 2 in the same order as in `commands.txt` file:

```
test twitter.com/marcelduran --first --location foo --poll --timeout 60
test twitter.com/marcelduran --first --location bar --poll --timeout 60
test marcelduran.com --first --location foo --poll --timeout 60
test marcelduran.com --first --location bar --poll --timeout 60
```

@@ -721,5 +721,5 @@

Copyright 2013 Twitter Inc.
Copyright 2017 Google Inc.
Copyright 2017 Marcel Duran and other contributors
Copyright 2020 Google Inc.
Copyright 2020 Marcel Duran and other contributors
Licensed under the [MIT License](https://github.com/marcelduran/webpagetest-api/raw/master/LICENSE)
/**
* Copyright (c) 2013, Twitter Inc.
* Copyright (c) 2015, Google Inc.
* Copyright (c) 2015, Marcel Duran and other contributors
* Copyright (c) 2020, Google Inc.
* Copyright (c) 2020, Marcel Duran and other contributors
* Released under the MIT License

@@ -6,0 +6,0 @@ */

/**
* Copyright (c) 2013, Twitter Inc.
* Copyright (c) 2015, Google Inc.
* Copyright (c) 2015, Marcel Duran and other contributors
* Copyright (c) 2020, Google Inc.
* Copyright (c) 2020, Marcel Duran and other contributors
* Released under the MIT License

@@ -6,0 +6,0 @@ */

/**
* Copyright (c) 2013, Twitter Inc.
* Copyright (c) 2015, Google Inc.
* Copyright (c) 2015, Marcel Duran and other contributors
* Copyright (c) 2020, Google Inc.
* Copyright (c) 2020, Marcel Duran and other contributors
* Released under the MIT License

@@ -6,0 +6,0 @@ */

@@ -0,9 +1,6 @@

Usage: webpagetest batch [options] <file>
Usage: batch [options] <file>
run commands in batch, i.e. one command per line from <file> in parallel
run commands in batch, i.e. one command per line from <file> in parallel
Options:
-h, --help output usage information
Options:
-h, --help display help for command

@@ -0,10 +1,8 @@

Usage: webpagetest cancel [options] <id>
Usage: cancel [options] <id>
cancel running/pending test
cancel running/pending test
Options:
-h, --help output usage information
-k, --key <api_key> API key (if assigned). Contact the WebPageTest server administrator for a key if required
Options:
-k, --key <api_key> API key (if assigned). Contact the WebPageTest server
administrator for a key if required
-h, --help display help for command

@@ -0,11 +1,9 @@

Usage: webpagetest chrometrace [options] <id>
Usage: chrometrace [options] <id>
get the Chrome Trace data (if available) from test
get the Chrome Trace data (if available) from test
Options:
-h, --help output usage information
-r, --run <number> which run number on a multiple runs test [1]
-c, --cached get the Repeat View (cached view) instead of default First View (primed cache)
Options:
-r, --run <number> which run number on a multiple runs test [1]
-c, --cached get the Repeat View (cached view) instead of default
First View (primed cache)
-h, --help display help for command

@@ -0,11 +1,9 @@

Usage: webpagetest console [options] <id>
Usage: console [options] <id>
get the browser console log data (if available) from test
get the browser console log data (if available) from test
Options:
-h, --help output usage information
-r, --run <number> which run number on a multiple runs test [1]
-c, --cached get the Repeat View (cached view) instead of default First View (primed cache)
Options:
-r, --run <number> which run number on a multiple runs test [1]
-c, --cached get the Repeat View (cached view) instead of default
First View (primed cache)
-h, --help display help for command

@@ -0,11 +1,9 @@

Usage: webpagetest googlecsi [options] <id>
Usage: googlecsi [options] <id>
get Google CSI data (Client Side Instrumentation)
get Google CSI data (Client Side Instrumentation)
Options:
-h, --help output usage information
-r, --run <number> which run number on a multiple runs test [1]
-c, --cached get the Repeat View (cached view) instead of default First View (primed cache)
Options:
-r, --run <number> which run number on a multiple runs test [1]
-c, --cached get the Repeat View (cached view) instead of default
First View (primed cache)
-h, --help display help for command

@@ -0,9 +1,6 @@

Usage: webpagetest har [options] <id>
Usage: har [options] <id>
get the HTTP Archive (HAR) from test
get the HTTP Archive (HAR) from test
Options:
-h, --help output usage information
Options:
-h, --help display help for command

@@ -0,9 +1,6 @@

Usage: webpagetest history [options] [days]
Usage: history [options] [days]
get history of previously run tests
get history of previously run tests
Options:
-h, --help output usage information
Options:
-h, --help display help for command

@@ -0,11 +1,8 @@

Usage: webpagetest listen [options] [hostname:port]
Usage: listen [options] [hostname:port]
start webpagetest-api proxy server on <hostname>:<port> [hostname:7791]
start webpagetest-api proxy server on <hostname>:<port> [hostname:7791]
Options:
-h, --help output usage information
-k, --key <file> private key file to use for SSL
-c, --cert <file> public x509 certificate file to use for SSL
Options:
-k, --key <file> private key file to use for SSL
-c, --cert <file> public x509 certificate file to use for SSL
-h, --help display help for command

@@ -0,10 +1,7 @@

Usage: webpagetest locations [options]
Usage: locations [options]
list locations and the number of pending tests
list locations and the number of pending tests
Options:
-h, --help output usage information
-e, --request <id> echo request ID, useful to track asynchronous requests
Options:
-e, --request <id> echo request ID, useful to track asynchronous requests
-h, --help display help for command

@@ -0,11 +1,9 @@

Usage: webpagetest netlog [options] <id>
Usage: netlog [options] <id>
get the Chrome Developer Tools Net log data (if available) from test
get the Chrome Developer Tools Net log data (if available) from test
Options:
-h, --help output usage information
-r, --run <number> which run number on a multiple runs test [1]
-c, --cached get the Repeat View (cached view) instead of default First View (primed cache)
Options:
-r, --run <number> which run number on a multiple runs test [1]
-c, --cached get the Repeat View (cached view) instead of default
First View (primed cache)
-h, --help display help for command

@@ -0,11 +1,9 @@

Usage: webpagetest pagespeed [options] <id>
Usage: pagespeed [options] <id>
get the Google Page Speed results (if available) from test
get the Google Page Speed results (if available) from test
Options:
-h, --help output usage information
-r, --run <number> which run number on a multiple runs test [1]
-c, --cached get the Repeat View (cached view) instead of default First View (primed cache)
Options:
-r, --run <number> which run number on a multiple runs test [1]
-c, --cached get the Repeat View (cached view) instead of default
First View (primed cache)
-h, --help display help for command

@@ -0,9 +1,6 @@

Usage: webpagetest player [options] <id>
Usage: player [options] <id>
get a html5 player for a video <id>
get a html5 player for a video <id>
Options:
-h, --help output usage information
Options:
-h, --help display help for command

@@ -0,11 +1,9 @@

Usage: webpagetest request [options] <id>
Usage: request [options] <id>
get the request data from test
get the request data from test
Options:
-h, --help output usage information
-r, --run <number> which run number on a multiple runs test [1]
-c, --cached get the Repeat View (cached view) instead of default First View (primed cache)
Options:
-r, --run <number> which run number on a multiple runs test [1]
-c, --cached get the Repeat View (cached view) instead of default
First View (primed cache)
-h, --help display help for command

@@ -0,12 +1,10 @@

Usage: webpagetest response [options] <id>
Usage: response [options] <id>
get response body for text resources
get response body for text resources
Options:
-h, --help output usage information
-r, --run <number> which run number on a multiple runs test [1]
-c, --cached get the Repeat View (cached view) instead of default First View (primed cache)
-R, --request <number> the request number [1]
Options:
-r, --run <number> which run number on a multiple runs test [1]
-c, --cached get the Repeat View (cached view) instead of default
First View (primed cache)
-R, --request <number> the request number [1]
-h, --help display help for command

@@ -0,10 +1,8 @@

Usage: webpagetest restart [options] <id>
Usage: restart [options] <id>
restart test
restart test
Options:
-h, --help output usage information
-k, --key <api_key> API key (if assigned). Contact the WebPageTest server administrator for a key if required
Options:
-k, --key <api_key> API key (if assigned). Contact the WebPageTest server
administrator for a key if required
-h, --help display help for command

@@ -0,17 +1,23 @@

Usage: webpagetest results [options] <id>
Usage: results [options] <id>
get test results
get test results
Options:
-h, --help output usage information
-b, --breakdown include the breakdown of requests and bytes by mime type
-D, --domains include the breakdown of requests and bytes by domain
-p, --pagespeed include the PageSpeed score in the response (may be slower)
-R, --requests include the request data in the response (slower and results in much larger responses)
-m, --median <metric> set the metric used to calculate median for multiple runs tests [loadTime]
--medianrun <metric> set the run used for median for multiple runs tests [median]
-S, --specs <json_or_file> set the specs for performance test suite
-r, --reporter <name> set performance test suite reporter output: [dot]|spec|tap|xunit|list|progress|min|nyan|landing|json|doc|markdown|teamcity
-e, --request <id> echo request ID, useful to track asynchronous requests
Options:
-b, --breakdown include the breakdown of requests and bytes by
mime type
-D, --domains include the breakdown of requests and bytes by
domain
-p, --pagespeed include the PageSpeed score in the response (may
be slower)
-R, --requests include the request data in the response (slower
and results in much larger responses)
-m, --median <metric> set the metric used to calculate median for
multiple runs tests [loadTime]
--medianrun <metric> set the run used for median for multiple runs
tests [median]
-S, --specs <json_or_file> set the specs for performance test suite
-r, --reporter <name> set performance test suite reporter output:
[dot]|spec|tap|xunit|list|progress|min|nyan|landing|json|doc|markdown|teamcity
-e, --request <id> echo request ID, useful to track asynchronous
requests
-h, --help display help for command

@@ -0,16 +1,17 @@

Usage: webpagetest screenshot [options] <id>
Usage: screenshot [options] <id>
get the fully loaded page screenshot in JPG format (PNG if in full resolution)
get the fully loaded page screenshot in JPG format (PNG if in full resolution)
Options:
-h, --help output usage information
-r, --run <number> which run number on a multiple runs test [1]
-c, --cached get the Repeat View (cached view) instead of default First View (primed cache)
-t, --thumbnail get the thumbnail of actual image
-u, --uri return the base64 string representation (inline) of actual image
-f, --full get full resolution screenshot in PNG format if available
-n, --render get the page screenshot at the Start Render point (i.e.: when something was first displayed on screen)
-p, --complete get the page screenshot at the Document Complete point (i.e.: when window.onload was fired)
Options:
-r, --run <number> which run number on a multiple runs test [1]
-c, --cached get the Repeat View (cached view) instead of default
First View (primed cache)
-t, --thumbnail get the thumbnail of actual image
-u, --uri return the base64 string representation (inline) of
actual image
-f, --full get full resolution screenshot in PNG format if available
-n, --render get the page screenshot at the Start Render point (i.e.:
when something was first displayed on screen)
-p, --complete get the page screenshot at the Document Complete point
(i.e.: when window.onload was fired)
-h, --help display help for command

@@ -0,10 +1,7 @@

Usage: webpagetest status [options] <id>
Usage: status [options] <id>
check test status
check test status
Options:
-h, --help output usage information
-e, --request <id> echo request ID, useful to track asynchronous requests
Options:
-e, --request <id> echo request ID, useful to track asynchronous requests
-h, --help display help for command

@@ -0,78 +1,151 @@

Usage: webpagetest test [options] <url_or_script>
Usage: test [options] <url_or_script>
run test
run test
Options:
-h, --help output usage information
-k, --key <api_key> API key (if assigned). Contact the WebPageTest server administrator for a key if required
-l, --location <location> location to test from
-y, --connectivity <profile> connectivity profile (Cable|DSL|3GSlow|3G|3GFast|4G|LTE|Edge|2G|Dial|FIOS|Native|custom) [Cable]
-r, --runs <number> number of test runs [1]
-f, --first skip the Repeat View test
-v, --video capture video
-p, --private keep the test hidden from the test log
-L, --label <label> label for the test
-i, --onload stop test at document complete. typically, tests run until all activity stops
-S, --noscript disable JavaScript (IE, Chrome, Firefox)
-C, --clearcerts clear SSL certificate caches
-R, --ignoressl ignore SSL certificate errors, e.g. name mismatch, self-signed certificates, etc
-T, --standards forces all pages to load in standards mode (IE only)
-u, --tcpdump capture network packet trace (tcpdump)
-O, --bodies save response bodies for text resources
-K, --keepua do not add PTST to the original browser User Agent string
-m, --dom <element> DOM element to record for sub-measurement
-N, --duration <seconds> minimum test duration in seconds
-E, --tester <name> run the test on a specific PC (name must match exactly or the test will not run)
-W, --mobile (experimental) emulate mobile browser: Chrome mobile user agent, 640x960 screen, 2x scaling and fixed viewport (Chrome only)
--device <string> device name from mobile_devices.ini to use for mobile emulation (only when mobile=1 is specified to enable emulation and only for Chrome)
-M, --timeline capture Developer Tools Timeline (Chrome only)
-J, --callstack set between 1-5 to include the JS call stack. must be used in conjunction with timeline (increases overhead) (Chrome only)
-q, --chrometrace capture chrome trace (about://tracing) (Chrome only)
--tracecategories <categories> trace categories (when chrometrace enabled) (Chrome only)
-G, --netlog capture Network Log (Chrome only)
-Q, --datareduction enable data reduction on Chrome 34+ Android (Chrome only)
-x, --useragent <string> custom user agent string (Chrome only)
-X, --cmdline <switches> use a list of custom command line switches (Chrome only)
--lighthouse perform lighthouse test (Chrome only, Linux agent only)
-g, --login <username> username for authenticating tests (http authentication)
-w, --password <password> password for authenticating tests (http authentication)
-t, --sensitive discard script and http headers in the result
-H, --noheaders disable saving of the http headers (as well as browser status messages and CPU utilization)
-b, --block <urls> space-delimited list of urls to block (substring match)
-Z, --spof <domains> space-delimited list of domains to simulate failure by re-routing to blackhole.webpagetest.org to silently drop all requests
-c, --custom <script> execute arbitrary JavaScript at the end of a test to collect custom metrics
-a, --authtype <type> type of authentication: 0 = Basic, 1 = SNS [0]
-n, --notify <e-mail> e-mail address to notify with the test results
-B, --pingback <url> URL to ping when the test is complete (the test ID will be passed as an "id" parameter)
-D, --bwdown <bandwidth> download bandwidth in Kbps (used when specifying a custom connectivity profile)
-U, --bwup <bandwidth> upload bandwidth in Kbps (used when specifying a custom connectivity profile)
-Y, --latency <time> first-hop Round Trip Time in ms (used when specifying a custom connectivity profile)
-P, --plr <percentage> packet loss rate - percent of packets to drop (used when specifying a custom connectivity profile)
-z, --noopt disable optimization checks (for faster testing)
-I, --noimages disable screen shot capturing
-F, --full save a full-resolution version of the fully loaded screen shot as a PNG
-j, --jpeg <level> jpeg compression level (30-100) for the screen shots and video capture
-A, --medianvideo store the video from the median run when capturing video is enabled
--htmlbody save the content of only the base HTML response
--tsview <id> test name to use when submitting results to tsviewdb (for private instances that have integrated with tsviewdb)
--tsviewconfigs <string> configs to use when submitting results to tsviewdb (for private instances that have integrated with tsviewdb)
--affinity <string> string to hash test to a specific test agent. tester will be picked by index among available testers
--priority <number> change test priority (0-9) [enforced by API key, otherwise 5]
--noads block ads defined by adblockrules.org
--continuous capture video continuously (unstable/experimental, may cause tests to fail)
--spdy3 force SPDY version 3 (Chrome only)
--swrender force software rendering, disable GPU acceleration (Chrome only)
--poll [interval] poll for results after test is scheduled at every <interval> seconds [5]
--wait [hostname:port] wait for test results informed by agent once complete listening on <hostname>:<port> [hostname:first port available above 8000]
--timeout <seconds> timeout for polling and waiting results [no timeout]
-e, --request <id> echo request ID, useful to track asynchronous requests
--breakdown include the breakdown of requests and bytes by mime type
--domains include the breakdown of requests and bytes by domain
--pagespeed include the PageSpeed score in the response (may be slower)
--requests include the request data in the response (slower and results in much larger responses)
--median <metric> set the metric used to calculate median for multiple runs tests [loadTime]
--medianrun <metric> set the run used for median for multiple runs tests [median]
--specs <json_or_file> set the specs for performance test suite
--reporter <name> set performance test suite reporter output: [dot]|spec|tap|xunit|list|progress|min|nyan|landing|json|doc|markdown|teamcity
Options:
-k, --key <api_key> API key (if assigned). Contact the
WebPageTest server administrator for a
key if required
-l, --location <location> location to test from
-y, --connectivity <profile> connectivity profile
(Cable|DSL|3GSlow|3G|3GFast|4G|LTE|Edge|2G|Dial|FIOS|Native|custom)
[Cable]
-r, --runs <number> number of test runs [1]
-f, --first skip the Repeat View test
-v, --video capture video
-p, --private keep the test hidden from the test log
-L, --label <label> label for the test
-i, --onload stop test at document complete.
typically, tests run until all activity
stops
-S, --noscript disable JavaScript (IE, Chrome, Firefox)
-C, --clearcerts clear SSL certificate caches
-R, --ignoressl ignore SSL certificate errors, e.g. name
mismatch, self-signed certificates, etc
-T, --standards forces all pages to load in standards
mode (IE only)
-u, --tcpdump capture network packet trace (tcpdump)
-O, --bodies save response bodies for text resources
-K, --keepua do not add PTST to the original browser
User Agent string
-m, --dom <element> DOM element to record for sub-measurement
-N, --duration <seconds> minimum test duration in seconds
-E, --tester <name> run the test on a specific PC (name must
match exactly or the test will not run)
-W, --mobile (experimental) emulate mobile browser:
Chrome mobile user agent, 640x960 screen,
2x scaling and fixed viewport (Chrome
only)
--device <string> device name from mobile_devices.ini to
use for mobile emulation (only when
mobile=1 is specified to enable emulation
and only for Chrome)
-M, --timeline capture Developer Tools Timeline (Chrome
only)
-J, --callstack set between 1-5 to include the JS call
stack. must be used in conjunction with
timeline (increases overhead) (Chrome
only)
-q, --chrometrace capture chrome trace (about://tracing)
(Chrome only)
--tracecategories <categories> trace categories (when chrometrace
enabled) (Chrome only)
-G, --netlog capture Network Log (Chrome only)
-Q, --datareduction enable data reduction on Chrome 34+
Android (Chrome only)
-x, --useragent <string> custom user agent string (Chrome only)
-X, --cmdline <switches> use a list of custom command line
switches (Chrome only)
--lighthouse perform lighthouse test (Chrome only,
Linux agent only)
-g, --login <username> username for authenticating tests (http
authentication)
-w, --password <password> password for authenticating tests (http
authentication)
-t, --sensitive discard script and http headers in the
result
-H, --noheaders disable saving of the http headers (as
well as browser status messages and CPU
utilization)
-b, --block <urls> space-delimited list of urls to block
(substring match)
-Z, --spof <domains> space-delimited list of domains to
simulate failure by re-routing to
blackhole.webpagetest.org to silently
drop all requests
-c, --custom <script> execute arbitrary JavaScript at the end
of a test to collect custom metrics
-a, --authtype <type> type of authentication: 0 = Basic, 1 =
SNS [0]
-n, --notify <e-mail> e-mail address to notify with the test
results
-B, --pingback <url> URL to ping when the test is complete
(the test ID will be passed as an "id"
parameter)
-D, --bwdown <bandwidth> download bandwidth in Kbps (used when
specifying a custom connectivity profile)
-U, --bwup <bandwidth> upload bandwidth in Kbps (used when
specifying a custom connectivity profile)
-Y, --latency <time> first-hop Round Trip Time in ms (used
when specifying a custom connectivity
profile)
-P, --plr <percentage> packet loss rate - percent of packets to
drop (used when specifying a custom
connectivity profile)
-z, --noopt disable optimization checks (for faster
testing)
-I, --noimages disable screen shot capturing
-F, --full save a full-resolution version of the
fully loaded screen shot as a PNG
-j, --jpeg <level> jpeg compression level (30-100) for the
screen shots and video capture
-A, --medianvideo store the video from the median run when
capturing video is enabled
--htmlbody save the content of only the base HTML
response
--tsview <id> test name to use when submitting results
to tsviewdb (for private instances that
have integrated with tsviewdb)
--tsviewconfigs <string> configs to use when submitting results to
tsviewdb (for private instances that have
integrated with tsviewdb)
--affinity <string> string to hash test to a specific test
agent. tester will be picked by index
among available testers
--priority <number> change test priority (0-9) [enforced by
API key, otherwise 5]
--noads block ads defined by adblockrules.org
--continuous capture video continuously
(unstable/experimental, may cause tests
to fail)
--spdy3 force SPDY version 3 (Chrome only)
--swrender force software rendering, disable GPU
acceleration (Chrome only)
--poll [interval] poll for results after test is scheduled
at every <interval> seconds [5]
--wait [hostname:port] wait for test results informed by agent
once complete listening on
<hostname>:<port> [hostname:first port
available above 8000]
--timeout <seconds> timeout for polling and waiting results
[no timeout]
-e, --request <id> echo request ID, useful to track
asynchronous requests
--breakdown include the breakdown of requests and
bytes by mime type
--domains include the breakdown of requests and
bytes by domain
--pagespeed include the PageSpeed score in the
response (may be slower)
--requests include the request data in the response
(slower and results in much larger
responses)
--median <metric> set the metric used to calculate median
for multiple runs tests [loadTime]
--medianrun <metric> set the run used for median for multiple
runs tests [median]
--specs <json_or_file> set the specs for performance test suite
--reporter <name> set performance test suite reporter
output:
[dot]|spec|tap|xunit|list|progress|min|nyan|landing|json|doc|markdown|teamcity
-h, --help display help for command

@@ -0,10 +1,7 @@

Usage: webpagetest testers [options]
Usage: testers [options]
list testers status and details
list testers status and details
Options:
-h, --help output usage information
-e, --request <id> echo request ID, useful to track asynchronous requests
Options:
-e, --request <id> echo request ID, useful to track asynchronous requests
-h, --help display help for command

@@ -0,9 +1,6 @@

Usage: webpagetest testinfo [options] <id>
Usage: testinfo [options] <id>
get test request info/details
get test request info/details
Options:
-h, --help output usage information
Options:
-h, --help display help for command

@@ -0,11 +1,9 @@

Usage: webpagetest timeline [options] <id>
Usage: timeline [options] <id>
get the Chrome Developer Tools Timeline data (if available) from test
get the Chrome Developer Tools Timeline data (if available) from test
Options:
-h, --help output usage information
-r, --run <number> which run number on a multiple runs test [1]
-c, --cached get the Repeat View (cached view) instead of default First View (primed cache)
Options:
-r, --run <number> which run number on a multiple runs test [1]
-c, --cached get the Repeat View (cached view) instead of default
First View (primed cache)
-h, --help display help for command

@@ -0,11 +1,9 @@

Usage: webpagetest utilization [options] <id>
Usage: utilization [options] <id>
get the CPU, bandwidth and memory utilization data from test
get the CPU, bandwidth and memory utilization data from test
Options:
-h, --help output usage information
-r, --run <number> which run number on a multiple runs test [1]
-c, --cached get the Repeat View (cached view) instead of default First View (primed cache)
Options:
-r, --run <number> which run number on a multiple runs test [1]
-c, --cached get the Repeat View (cached view) instead of default
First View (primed cache)
-h, --help display help for command

@@ -0,10 +1,9 @@

Usage: webpagetest video [options] <tests>
Usage: video [options] <tests>
create a video from <tests> (comma separated test ids)
create a video from <tests> (comma separated test ids)
Options:
-h, --help output usage information
-e, --end <end_point> frame comparison end point: [visual]=visually complete | all=last change | doc=document complete | full=fully loaded
Options:
-e, --end <end_point> frame comparison end point: [visual]=visually complete
| all=last change | doc=document complete | full=fully
loaded
-h, --help display help for command

@@ -0,22 +1,22 @@

Usage: webpagetest waterfall [options] <id>
Usage: waterfall [options] <id>
get the waterfall PNG image
get the waterfall PNG image
Options:
-h, --help output usage information
-r, --run <number> which run number on a multiple runs test [1]
-c, --cached get the Repeat View (cached view) instead of default First View (primed cache)
-t, --thumbnail get the thumbnail of actual image
-u, --uri return the base64 string representation (inline) of actual image
-T, --type <chart> set the chart type: waterfall or connection [waterfall]
-M, --mime set chart coloring by MIME type [false]
-w, --width <px> chart image width in px (300-2000) [930]
-m, --max <seconds> set maximum time in seconds [automatic]
-R, --requests <items> filter requests (e.g.:1,2,3,4-9,8) [all]
-C, --nocpu hide CPU utilization [false]
-b, --nobandwidth hide bandwidth utilization [false]
-i, --noellipsis hide ellipsis (...) for missing items [false]
-l, --nolabels hide labels for requests (URL) [false]
Options:
-r, --run <number> which run number on a multiple runs test [1]
-c, --cached get the Repeat View (cached view) instead of default
First View (primed cache)
-t, --thumbnail get the thumbnail of actual image
-u, --uri return the base64 string representation (inline) of
actual image
-T, --type <chart> set the chart type: waterfall or connection
[waterfall]
-M, --mime set chart coloring by MIME type [false]
-w, --width <px> chart image width in px (300-2000) [930]
-m, --max <seconds> set maximum time in seconds [automatic]
-R, --requests <items> filter requests (e.g.:1,2,3,4-9,8) [all]
-C, --nocpu hide CPU utilization [false]
-b, --nobandwidth hide bandwidth utilization [false]
-i, --noellipsis hide ellipsis (...) for missing items [false]
-l, --nolabels hide labels for requests (URL) [false]
-h, --help display help for command

@@ -0,40 +1,50 @@

Usage: webpagetest [options] [command]
Usage: webpagetest [options] [command]
Options:
-V, --version output the version number
-s, --server <server> the WPT server URL
[https://www.webpagetest.org]
-d, --dryrun just return the RESTful API URL
-o, --out <file> place the output into <file>. Defaults to
stdout
-h, --help display help for command
Commands:
status [options] <id> check test status
results [options] <id> get test results
locations [options] list locations and the number of pending tests
testers [options] list testers status and details
test [options] <url_or_script> run test
restart [options] <id> restart test
cancel [options] <id> cancel running/pending test
har <id> get the HTTP Archive (HAR) from test
pagespeed [options] <id> get the Google Page Speed results (if available) from test
utilization [options] <id> get the CPU, bandwidth and memory utilization data from test
request [options] <id> get the request data from test
timeline [options] <id> get the Chrome Developer Tools Timeline data (if available) from test
netlog [options] <id> get the Chrome Developer Tools Net log data (if available) from test
chrometrace [options] <id> get the Chrome Trace data (if available) from test
console [options] <id> get the browser console log data (if available) from test
testinfo <id> get test request info/details
history [days] get history of previously run tests
googlecsi [options] <id> get Google CSI data (Client Side Instrumentation)
response [options] <id> get response body for text resources
waterfall [options] <id> get the waterfall PNG image
screenshot [options] <id> get the fully loaded page screenshot in JPG format (PNG if in full resolution)
video [options] <tests> create a video from <tests> (comma separated test ids)
player <id> get a html5 player for a video <id>
listen [options] [hostname:port] start webpagetest-api proxy server on <hostname>:<port> [hostname:7791]
batch <file> run commands in batch, i.e. one command per line from <file> in parallel
Options:
-h, --help output usage information
-V, --version output the version number
-s, --server <server> the WPT server URL [https://www.webpagetest.org]
-d, --dryrun just return the RESTful API URL
-o, --out <file> place the output into <file>. Defaults to stdout
Commands:
status [options] <id> check test status
results [options] <id> get test results
locations [options] list locations and the number of pending
tests
testers [options] list testers status and details
test [options] <url_or_script> run test
restart [options] <id> restart test
cancel [options] <id> cancel running/pending test
har <id> get the HTTP Archive (HAR) from test
pagespeed [options] <id> get the Google Page Speed results (if
available) from test
utilization [options] <id> get the CPU, bandwidth and memory
utilization data from test
request [options] <id> get the request data from test
timeline [options] <id> get the Chrome Developer Tools Timeline
data (if available) from test
netlog [options] <id> get the Chrome Developer Tools Net log
data (if available) from test
chrometrace [options] <id> get the Chrome Trace data (if available)
from test
console [options] <id> get the browser console log data (if
available) from test
testinfo <id> get test request info/details
history [days] get history of previously run tests
googlecsi [options] <id> get Google CSI data (Client Side
Instrumentation)
response [options] <id> get response body for text resources
waterfall [options] <id> get the waterfall PNG image
screenshot [options] <id> get the fully loaded page screenshot in
JPG format (PNG if in full resolution)
video [options] <tests> create a video from <tests> (comma
separated test ids)
player <id> get a html5 player for a video <id>
listen [options] [hostname:port] start webpagetest-api proxy server on
<hostname>:<port> [hostname:7791]
batch <file> run commands in batch, i.e. one command
per line from <file> in parallel
help [command] display help for command
/**
* Copyright (c) 2013, Twitter Inc.
* Copyright (c) 2015, Google Inc.
* Copyright (c) 2015, Marcel Duran and other contributors
* Copyright (c) 2020, Google Inc.
* Copyright (c) 2020, Marcel Duran and other contributors
* Released under the MIT License

@@ -6,0 +6,0 @@ */

/**
* Copyright (c) 2013, Twitter Inc.
* Copyright (c) 2015, Google Inc.
* Copyright (c) 2015, Marcel Duran and other contributors
* Copyright (c) 2020, Google Inc.
* Copyright (c) 2020, Marcel Duran and other contributors
* Released under the MIT License

@@ -6,0 +6,0 @@ */

/**
* Copyright (c) 2013, Twitter Inc.
* Copyright (c) 2015, Google Inc.
* Copyright (c) 2015, Marcel Duran and other contributors
* Copyright (c) 2020, Google Inc.
* Copyright (c) 2020, Marcel Duran and other contributors
* Released under the MIT License

@@ -6,0 +6,0 @@ */

/**
* Copyright (c) 2013, Twitter Inc.
* Copyright (c) 2015, Google Inc.
* Copyright (c) 2015, Marcel Duran and other contributors
* Copyright (c) 2020, Google Inc.
* Copyright (c) 2020, Marcel Duran and other contributors
* Released under the MIT License

@@ -6,0 +6,0 @@ */

/**
* Copyright (c) 2013, Twitter Inc.
* Copyright (c) 2015, Google Inc.
* Copyright (c) 2015, Marcel Duran and other contributors
* Copyright (c) 2020, Google Inc.
* Copyright (c) 2020, Marcel Duran and other contributors
* Released under the MIT License

@@ -19,35 +19,45 @@ */

// proxy for test on 9001 port
http.createServer(function(req, res) {
var requestUrl = url.parse(req.url);
var body = [];
var server;
req.on('data', function(data) {
body.push(data);
});
req.on('end', function() {
var orgreq = https.request({
host: req.headers.host,
port: requestUrl.port || 80,
path: requestUrl.path,
method: req.method,
headers: req.headers
},
function (orgres) {
res.writeHead(orgres.statusCode, orgres.headers);
orgres.on('data', function(chunk) {
res.write(chunk);
describe('Run via proxy', function() {
before(function () {
// proxy for test on 9001 port
server = http.createServer(function(req, res) {
var requestUrl = url.parse(req.url);
var body = [];
req.on('data', function(data) {
body.push(data);
});
orgres.on('end', function() {
res.end();
req.on('end', function() {
var orgreq = https.request({
host: req.headers.host,
port: requestUrl.port || 80,
path: requestUrl.path,
method: req.method,
headers: req.headers
},
function (orgres) {
res.writeHead(orgres.statusCode, orgres.headers);
orgres.on('data', function(chunk) {
res.write(chunk);
});
orgres.on('end', function() {
res.end();
});
});
if (body.length > 0) {
orgreq.write(body.join(''));
}
orgreq.end();
});
});
if (body.length > 0) {
orgreq.write(body.join(''));
}
orgreq.end();
server.listen(9001);
});
}).listen(9001);
describe('Run via proxy', function() {
after(function () {
server.close();
});
describe('An Example WebPageTest Server', function() {

@@ -54,0 +64,0 @@

/**
* Copyright (c) 2013, Twitter Inc.
* Copyright (c) 2015, Google Inc.
* Copyright (c) 2015, Marcel Duran and other contributors
* Copyright (c) 2020, Google Inc.
* Copyright (c) 2020, Marcel Duran and other contributors
* Released under the MIT License

@@ -6,0 +6,0 @@ */

/**
* Copyright (c) 2013, Twitter Inc.
* Copyright (c) 2015, Google Inc.
* Copyright (c) 2015, Marcel Duran and other contributors
* Copyright (c) 2020, Google Inc.
* Copyright (c) 2020, Marcel Duran and other contributors
* Released under the MIT License

@@ -6,0 +6,0 @@ */

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc