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

webpagetest

Package Overview
Dependencies
Maintainers
3
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.6.0 to 0.7.0

test/fixtures/command-line/help-testAndWait.txt

2

lib/helper.js

@@ -112,3 +112,3 @@ /**

value = row[key].replace(/<b>|<\/b>/g, '');
row[key] = entities.decode(value, 2);
row[key] = entities.decodeHTML(value, 2);
}

@@ -115,0 +115,0 @@ return row;

@@ -555,2 +555,521 @@ /**

},
testAndWait: {
location: {
name: "location",
key: "l",
api: "location",
param: "location",
info: "location to test from",
},
// Test Setting tab
connectivity: {
name: "connectivity",
key: "y",
api: "connectivity",
param: "profile",
info: "connectivity profile (Cable|DSL|3GSlow|3G|3GFast|4G|LTE|Edge|2G|Dial|FIOS|Native|custom) [Cable]",
},
runs: {
name: "runs",
key: "r",
api: "runs",
param: "number",
info: "number of test runs [1]",
},
first: {
name: "firstViewOnly",
key: "f",
api: "fvonly",
bool: true,
info: "skip the Repeat View test",
},
video: {
name: "video",
key: "v",
api: "video",
bool: true,
info: "capture video",
},
private: {
name: "private",
key: "p",
api: "private",
bool: true,
info: "keep the test hidden from the test log",
},
label: {
name: "label",
key: "L",
api: "label",
param: "label",
info: "label for the test",
},
// Advanced tab
onload: {
name: "stopAtDocumentComplete",
key: "i",
api: "web10",
bool: true,
info: "stop test at document complete. typically, tests run until all activity stops",
},
noscript: {
name: "disableJavaScript",
key: "S",
api: "noscript",
bool: true,
info: "disable JavaScript (IE, Chrome, Firefox)",
},
clearcerts: {
name: "clearCerts",
key: "C",
api: "clearcerts",
bool: true,
info: "clear SSL certificate caches",
},
ignoressl: {
name: "ignoreSSL",
key: "R",
api: "ignoreSSL",
bool: true,
info: "ignore SSL certificate errors, e.g. name mismatch, self-signed certificates, etc",
},
standards: {
name: "disableCompatibilityView",
key: "T",
api: "standards",
bool: true,
info: "forces all pages to load in standards mode (IE only)",
},
tcpdump: {
name: "tcpDump",
key: "u",
api: "tcpdump",
bool: true,
info: "capture network packet trace (tcpdump)",
},
bodies: {
name: "saveResponseBodies",
key: "O",
api: "bodies",
bool: true,
info: "save response bodies for text resources",
},
keepua: {
name: "keepOriginalUserAgent",
key: "K",
api: "keepua",
bool: true,
info: "do not add PTST to the original browser User Agent string",
},
dom: {
name: "domElement",
key: "m",
api: "domelement",
param: "element",
info: "DOM element to record for sub-measurement",
},
duration: {
name: "minimumDuration",
key: "N",
api: "time",
param: "seconds",
info: "minimum test duration in seconds",
},
tester: {
name: "tester",
key: "E",
api: "tester",
param: "name",
info: "run the test on a specific PC (name must match exactly or the test will not run)",
},
injectScript: {
name: "injectScript",
api: "injectScript",
param: "injectScript",
info: "JavaScript to run after the document has started loading",
},
// Chrome tab
mobile: {
name: "emulateMobile",
key: "W",
api: "mobile",
bool: true,
info: "(experimental) emulate mobile browser: Chrome mobile user agent, 640x960 screen, 2x scaling and fixed viewport (Chrome only)",
},
device: {
name: "device",
api: "mobileDevice",
param: "string",
info: "device name from mobile_devices.ini to use for mobile emulation (only when mobile=1 is specified to enable emulation and only for Chrome)",
},
timeline: {
name: "timeline",
key: "M",
api: "timeline",
bool: true,
info: "capture Developer Tools Timeline (Chrome only)",
},
callstack: {
name: "timelineCallStack",
key: "J",
api: "timelineStack",
bool: true,
info: "set between 1-5 to include the JS call stack. must be used in conjunction with timeline (increases overhead) (Chrome only)",
valid: /[1-5]/,
},
chrometrace: {
name: "chromeTrace",
key: "q",
api: "trace",
bool: true,
info: "capture chrome trace (about://tracing) (Chrome only)",
},
tracecategories: {
name: "traceCategories",
api: "traceCategories",
param: "categories",
info: "trace categories (when chrometrace enabled) (Chrome only)",
},
netlog: {
name: "netLog",
key: "G",
api: "netlog",
bool: true,
info: "capture Network Log (Chrome only)",
},
datareduction: {
name: "dataReduction",
key: "Q",
api: "dataReduction",
bool: true,
info: "enable data reduction on Chrome 34+ Android (Chrome only)",
},
useragent: {
name: "userAgent",
key: "x",
api: "uastring",
param: "string",
info: "custom user agent string (Chrome only)",
},
cmdline: {
name: "commandLine",
key: "X",
api: "cmdline",
param: "switches",
info: "use a list of custom command line switches (Chrome only)",
},
lighthouse: {
name: "lighthouse",
api: "lighthouse",
bool: true,
info: "perform lighthouse test (Chrome only, Linux agent only)",
},
//throttle_cpu param
throttleCPU: {
name: "throttleCPU",
key: "thc",
api: "throttle_cpu",
param: "number",
info: "custom cpu throttling",
},
// Auth tab
login: {
name: "login",
key: "g",
api: "login",
param: "username",
info: "username for authenticating tests (http authentication)",
},
password: {
name: "password",
key: "w",
api: "password",
param: "password",
info: "password for authenticating tests (http authentication)",
},
// Script tab
sensitive: {
name: "sensitive",
key: "t",
api: "sensitive",
bool: true,
info: "discard script and http headers in the result",
},
noheaders: {
name: "disableHTTPHeaders",
key: "H",
api: "noheaders",
bool: true,
info: "disable saving of the http headers (as well as browser status messages and CPU utilization)",
},
// Block tab
block: {
name: "block",
key: "b",
api: "block",
param: "urls",
array: true,
info: "space-delimited list of urls to block (substring match)",
},
// SPOF tab
spof: {
name: "spof",
key: "Z",
api: "spof",
param: "domains",
array: true,
info: "space-delimited list of domains to simulate failure by re-routing to blackhole.webpagetest.org to silently drop all requests",
},
// Custom tab
custom: {
name: "customMetrics",
key: "c",
api: "custom",
param: "script",
info: "execute arbitrary JavaScript at the end of a test to collect custom metrics",
},
// API only settings
authtype: {
name: "authenticationType",
key: "a",
api: "authType",
param: "type",
info: "type of authentication: 0 = Basic, 1 = SNS [0]",
},
notify: {
name: "notifyEmail",
key: "n",
api: "notify",
param: "e-mail",
info: "e-mail address to notify with the test results",
},
pingback: {
name: "pingback",
key: "B",
api: "pingback",
param: "url",
info: 'URL to ping when the test is complete (the test ID will be passed as an "id" parameter)',
},
bwdown: {
name: "bandwidthDown",
key: "D",
api: "bwDown",
param: "bandwidth",
info: "download bandwidth in Kbps (used when specifying a custom connectivity profile)",
},
bwup: {
name: "bandwidthUp",
key: "U",
api: "bwUp",
param: "bandwidth",
info: "upload bandwidth in Kbps (used when specifying a custom connectivity profile)",
},
browserwidth: {
name: "browserwidth",
key: "bw",
api: "browser_width",
param: "pixels",
info: "Browser window width (in display pixels)",
},
browserheight: {
name: "browserheight",
key: "bh",
api: "browser_height",
param: "pixels",
info: "Browser window height (in display pixels)",
},
viewportheight: {
name: "viewportheight",
key: "vh",
api: "height",
param: "pixels",
info: "Viewport Height in css pixels",
},
viewportwidth: {
name: "viewportwidth",
key: "vw",
api: "width",
param: "pixels",
info: "Viewport Width in css pixels",
},
devicetopixelratio: {
name: "devicetopixelratio",
key: "dpr",
api: "dpr",
param: "ratio",
info: "Device To Pixel Ratio",
},
appendua: {
name: "appendua",
key: "au",
api: "appendua",
param: "string",
info: "String to append to the user agent string. This is in addition to the default PTST/ver string",
},
testtype: {
name: "testtype",
key: "tt",
api: "type",
param: "string",
info: "For running alternative test types, can specify traceroute or lighthouse",
},
profiler: {
name: "profiler",
key: "pr",
api: "profiler",
param: "number",
info: "Set to 1 to enable the V8 sampling profiler (Chromium only)",
},
disableAVIF: {
name: "disableAVIF",
key: "avif",
api: "disableAVIF",
param: "number",
info: "Set to 1 to disable AVIF support (Chromium 88+)",
},
disableWEBP: {
name: "disableWEBP",
key: "webp",
api: "disableWEBP",
param: "number",
info: "Set to 1 to disable WEBP support (Chromium 88+)",
},
disableJXL: {
name: "disableJXL",
key: "jxl",
api: "disableJXL",
param: "number",
info: "Set to 1 to disable JpegXL support (Chromium 88+)",
},
dtShaper: {
name: "dtShaper",
key: "dts",
api: "dtShaper",
param: "number",
info: "Set to 1 to use Chrome's built-in traffic-shaping instead of the packet-level netem shaping usually used by the test agents",
},
latency: {
name: "latency",
key: "Y",
api: "latency",
param: "time",
info: "first-hop Round Trip Time in ms (used when specifying a custom connectivity profile)",
},
plr: {
name: "packetLossRate",
key: "P",
api: "plr",
param: "percentage",
info: "packet loss rate - percent of packets to drop (used when specifying a custom connectivity profile)",
},
noopt: {
name: "disableOptimization",
key: "z",
api: "noopt",
bool: true,
info: "disable optimization checks (for faster testing)",
},
noimages: {
name: "disableScreenshot",
key: "I",
api: "noimages",
bool: true,
info: "disable screen shot capturing",
},
full: {
name: "fullResolutionScreenshot",
key: "F",
api: "pngss",
bool: true,
info: "save a full-resolution version of the fully loaded screen shot as a PNG",
},
jpeg: {
name: "jpegQuality",
key: "j",
api: "iq",
param: "level",
info: "jpeg compression level (30-100) for the screen shots and video capture",
},
medianvideo: {
name: "medianVideo",
key: "A",
api: "mv",
bool: true,
info: "store the video from the median run when capturing video is enabled",
},
htmlbody: {
name: "htmlBody",
api: "htmlbody",
bool: true,
info: "save the content of only the base HTML response",
},
tsview: {
name: "tsView",
api: "tsview_id",
param: "id",
info: "test name to use when submitting results to tsviewdb (for private instances that have integrated with tsviewdb)",
},
tsviewconfigs: {
name: "tsViewConfigs",
api: "tsview_configs",
param: "string",
info: "configs to use when submitting results to tsviewdb (for private instances that have integrated with tsviewdb)",
},
affinity: {
name: "affinity",
api: "affinity",
param: "string",
info: "string to hash test to a specific test agent. tester will be picked by index among available testers",
},
priority: {
name: "priority",
api: "priority",
param: "number",
info: "change test priority (0-9) [enforced by API key, otherwise 5]",
valid: /^\d$/,
},
// Undocumented/experimental/transitent/deprecated
noads: {
name: "blockAds",
api: "blockads",
bool: true,
info: "block ads defined by adblockrules.org",
},
continuous: {
name: "continuousVideoCapture",
api: "continuousVideo",
bool: true,
info: "capture video continuously (unstable/experimental, may cause tests to fail)",
},
spdy3: {
name: "forceSpdy3",
api: "spdy3",
bool: true,
info: "force SPDY version 3 (Chrome only)",
},
swrender: {
name: "forceSoftwareRendering",
api: "swrender",
bool: true,
info: "force software rendering, disable GPU acceleration (Chrome only)",
},
// Synchonous tests + results
wait: {
name: "waitResults",
param: "hostname:port",
optional: true,
info: "wait for test results informed by agent once complete listening on <hostname>:<port> [hostname:first port available above 8000]",
},
},
request: {

@@ -791,3 +1310,3 @@ request: {

param: "id",
options: [options.request],
options: [options.request, options.apikey],
info: "check test status",

@@ -823,2 +1342,14 @@ },

},
testAndWait: {
name: "runTestAndWait",
param: "url_or_script",
options: [
options.apikey,
options.testAndWait,
options.request,
options.results,
],
info: "run test and waits for the result",
nokey: [options.results],
},
restart: {

@@ -825,0 +1356,0 @@ name: "restartTest",

@@ -96,2 +96,3 @@ /**

options.headers["accept-encoding"] = "gzip,deflate";
options.headers["User-Agent"] = "WebpagetestNodeWrapper/v0.6.0";
}

@@ -399,2 +400,7 @@

) {
console.log(
data && data.data && data.data.statusText
? data.data.statusText
: "Testing is in progress, please be patient"
);
polling = setTimeout(

@@ -535,2 +541,13 @@ getTestResults.bind(this, testId, resultsOptions, poll.bind(this)),

function runTestAndWait(what, options, callback) {
delete options.pollResults;
options = Object.assign(options, { pollResults: 13 });
new Promise((resolve) => {
let test = runTest.bind(this, what, options, callback);
resolve(test());
});
}
function restartTest(id, options, callback) {

@@ -938,2 +955,3 @@ var query = { resubmit: id };

runTest: runTest,
runTestAndWait: runTestAndWait,
restartTest: restartTest,

@@ -967,2 +985,3 @@ cancelTest: cancelTest,

test: runTest,
testAndWait: runTestAndWait,
cancel: cancelTest,

@@ -969,0 +988,0 @@ pagespeed: getPageSpeedData,

{
"name": "webpagetest",
"version": "0.6.0",
"version": "0.7.0",
"description": "WebPageTest API wrapper for NodeJS",

@@ -27,3 +27,3 @@ "author": "WebPageTest <github@WebPageTest.com> (http://github.com/WebPageTest)",

"scripts": {
"test": "./node_modules/mocha/bin/mocha -R spec test/*-test.js"
"test": "mocha -R spec test/*-test.js"
},

@@ -35,10 +35,10 @@ "engines": {

"commander": "^5.1.0",
"csv": "^5.3.2",
"entities": "^2.0.3",
"mocha": "^8.0.1",
"csv": "^6.2.2",
"entities": "^4.4.0",
"mocha": "^10.1.0",
"xml2js": "^0.4.23"
},
"devDependencies": {
"nock": "^12.0.3"
"nock": "^13.2.9"
}
}

@@ -11,2 +11,4 @@ <p align="center"><img src="https://docs.webpagetest.org/img/wpt-navy-logo.png" alt="WebPageTest Logo" /></p>

WebPageTest API Wrapper is a [NPM](https://npmjs.org) package that wraps [WebPageTest](https://github.com/WPO-Foundation/webpagetest) API for [NodeJS](https://nodejs.org) as a module and a command-line tool.
For a better understanding of WebPageTest API Wrapper, here are some sample [Node Recipies](https://github.com/WebPageTest/WebPageTest-API-Recipes)

@@ -16,3 +18,3 @@ ## Getting started

```bash
$ npm install webpagetest -g
npm install webpagetest -g
```

@@ -25,3 +27,3 @@

```bash
$ webpagetest test https://docs.webpagetest.org/api/integrations/
webpagetest test https://docs.webpagetest.org/api/integrations/
```

@@ -34,3 +36,3 @@

```bash
$ docker build -t webpagetest-api .
docker build -t webpagetest-api .
```

@@ -41,3 +43,3 @@

```bash
$ docker run -it --rm webpagetest-api -k YOURAPIKEY test https://docs.webpagetest.org/api/integrations/
docker run -it --rm webpagetest-api -k YOURAPIKEY test https://docs.webpagetest.org/api/integrations/
```

@@ -61,3 +63,3 @@

```bash
$ webpagetest --help
webpagetest --help
```

@@ -72,2 +74,3 @@

- **test** _[options] \<url_or_script\>_: run test, _\<url_or_script\>_ can also be a path to a script file
- **testAndWait** _[options] \<url_or_script\>_: run test and waits for the result, _\<url_or_script\>_ can also be a path to a script file
- **testBalance** _[options]_: get remaining tests for the account

@@ -127,3 +130,3 @@ - **restart** _\<id\>_: restart test

- **-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)
- **--device** _\<string\>_: device name from [mobile_devices.ini](https://github.com/WPO-Foundation/webpagetest/blob/master/www/settings/mobile_devices.ini) to use for mobile emulation (only when --mobile is specified to enable emulation and only for Chrome)
- **-M, --timeline**: capture Developer Tools Timeline (Chrome only)

@@ -278,3 +281,3 @@ - **-J, --callstack**: set between 1-5 to include the JS call stack. must be used in conjunction with timeline (increases overhead) (Chrome only)

```bash
$ webpagetest locations --key 1F2A3K4E5
webpagetest locations --key 1F2A3K4E5
```

@@ -310,3 +313,3 @@

```bash
$ webpagetest test https://docs.webpagetest.org/api/integrations/ --key 1F2A3K4E5 --location SanJose_IE9
webpagetest test https://docs.webpagetest.org/api/integrations/ --key 1F2A3K4E5 --location SanJose_IE9
```

@@ -333,3 +336,3 @@

```bash
$ webpagetest status 121025_PT_N8K
webpagetest status 121025_PT_N8K
```

@@ -355,3 +358,3 @@

```bash
$ webpagetest results 121025_PT_N8K
webpagetest results 121025_PT_N8K
```

@@ -391,3 +394,3 @@

```bash
$ webpagetest waterfall 121025_PT_N8K --thumbnail --cached --uri
webpagetest waterfall 121025_PT_N8K --thumbnail --cached --uri
```

@@ -405,3 +408,3 @@

```bash
$ webpagetest testBalance --key 1F2A3K4E5
webpagetest testBalance --key 1F2A3K4E5
```

@@ -420,3 +423,3 @@

```bash
$ webpagetest test https://docs.webpagetest.org/api/integrations/ --poll 5 --timeout 60
webpagetest test https://docs.webpagetest.org/api/integrations/ --poll 5 --timeout 60
```

@@ -427,3 +430,3 @@

```bash
$ webpagetest test https://docs.webpagetest.org/api/integrations/ --wait 8000
webpagetest test https://docs.webpagetest.org/api/integrations/ --wait 8000
```

@@ -467,2 +470,3 @@

- `runTest(url_or_script, options, callback)`
- `runTestAndWait(url_or_script, options, callback)`
- `restartTest(id, options, callback)`

@@ -536,3 +540,3 @@ - `cancelTest(id, options, callback)`

#### Test (works for `runTest` method only)
#### Test (works with `runTest` and `runTestAndWait`)

@@ -558,2 +562,3 @@ - **location**: _String_, location to test from

- **emulateMobile**: _Boolean_, (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](https://github.com/WPO-Foundation/webpagetest/blob/master/www/settings/mobile_devices.ini) to use for mobile emulation (only when emulateMobile=true is specified to enable emulation and only for Chrome)
- **timeline**: _Boolean_, capture Developer Tools Timeline (Chrome only)

@@ -612,11 +617,11 @@ - **timelineCallStack**: _Boolean_, set between 1-5 to include the JS call stack. must be used in conjunction with timeline (increases overhead) (Chrome only)

#### API Key (works for `runTest`, `restartTest` and `cancelTest` methods)
#### API Key (works for `runTest`, `runTestAndWait`, `restartTest` and `cancelTest` methods)
- **key**: _String_, API key (if assigned). Contact the WebPageTest server administrator for a key if required
#### Request (works for `getTestStatus` `getResults` `getLocations` `getTesters` and `runTest` methods)
#### Request (works for `getTestStatus` `getResults` `getLocations` `getTesters` `runTest` and `runTestAndWait` methods)
- **requestId**: _String_, echo request ID, useful to track asynchronous requests
#### Results (works for `getResults` and `runTest` methods)
#### Results (works for `getResults` `runTest` and `runTestAndWait` methods)

@@ -774,3 +779,3 @@ - **breakDown**: _Boolean_, include the breakdown of requests and bytes by mime type

```bash
$ webpagetest listen 8080 --server wpt.foo.com
webpagetest listen 8080 --server wpt.foo.com
```

@@ -784,8 +789,8 @@

```bash
$ curl http://localhost:8080/help
$ curl http://localhost:8080/test/webpagetest.org/?location=SanJose_IE9
curl http://localhost:8080/help
curl http://localhost:8080/test/webpagetest.org/?location=SanJose_IE9
```
```bash
$ webpagetest listen 8443 --key key.pem --cert cert.pem --server wpt.foo.com
webpagetest listen 8443 --key key.pem --cert cert.pem --server wpt.foo.com
```

@@ -826,3 +831,3 @@

```bash
$ webpagetest batch commands.txt
webpagetest batch commands.txt
```

@@ -832,3 +837,3 @@

```
```bash
test https://docs.webpagetest.org/api/integrations/ --first --location foo

@@ -862,3 +867,3 @@ test https://docs.webpagetest.org/api/integrations/ --first --location bar

```bash
$ echo $?
echo $?
0

@@ -871,3 +876,3 @@ ```

```
```bash
test https://docs.webpagetest.org/api/integrations/ --first --location foo --poll --timeout 60

@@ -886,3 +891,3 @@ test https://docs.webpagetest.org/api/integrations/ --first --location bar --poll --timeout 60

```bash
$ npm test
npm test
```

@@ -889,0 +894,0 @@

@@ -327,3 +327,3 @@ /**

[
'', 'status', 'results', 'locations', 'testers', 'test', 'restart', 'cancel', 'har',
'', 'status', 'results', 'locations', 'testers', 'test', 'testAndWait', 'restart', 'cancel', 'har',
'pagespeed', 'utilization', 'request', 'timeline', 'netlog', 'chrometrace',

@@ -330,0 +330,0 @@ 'console', 'testinfo', 'history', 'googlecsi', 'response', 'waterfall',

@@ -20,2 +20,3 @@ Usage: webpagetest [options] [command]

test [options] <url_or_script> run test
testAndWait [options] <url_or_script> run test and waits for the result
restart [options] <id> restart test

@@ -22,0 +23,0 @@ cancel [options] <id> cancel running/pending test

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