11## WebPageTest API Wrapper for NodeJS
22
3- [ ![ Build Status] ( https://secure. travis-ci.org/marcelduran /webpagetest-api.svg?branch=master )] ( https://travis-ci.org/marcelduran /webpagetest-api )
3+ [ ![ Build Status] ( https://travis-ci.com/WebPageTest /webpagetest-api.svg?branch=master )] ( https://travis-ci.com/WebPageTest /webpagetest-api )
44[ ![ NPM Version] ( https://img.shields.io/npm/v/webpagetest.svg?style=flat )] ( https://www.npmjs.org/package/webpagetest )
55[ ![ NPM Downloads] ( https://img.shields.io/npm/dm/webpagetest.svg?style=flat )] ( https://www.npmjs.org/package/webpagetest )
6- [ ![ Dependencies Status] ( https://david-dm.org/marcelduran/webpagetest-api.svg )] ( https://david-dm.org/marcelduran/webpagetest-api )
6+ [ ![ Dependencies Status] ( https://david-dm.org/WebPageTest/webpagetest-api.svg )] ( https://david-dm.org/WebPageTest/webpagetest-api )
7+
8+ 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.
79
8- [ WebPageTest API Wrapper] ( https://marcelduran.com/webpagetest-api ) 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.
910
1011## Getting started
1112
@@ -17,7 +18,7 @@ $ npm install webpagetest -g
1718
1819### Command line
1920``` bash
20- $ webpagetest test http ://marcelduran.com/ webpagetest- api
21+ $ webpagetest test https ://docs. webpagetest.org/ api/integrations/
2122```
2223
2324### Docker
@@ -27,23 +28,19 @@ $ docker build -t webpagetest-api .
2728```
2829#### Run
2930``` bash
30- $ docker run -it --rm webpagetest-api -k YOURAPIKEY test http ://marcelduran.com/ webpagetest- api
31+ $ docker run -it --rm webpagetest-api -k YOURAPIKEY test https ://docs. webpagetest.org/ api/integrations/
3132```
3233
3334### Module
3435``` javascript
3536const WebPageTest = require (' webpagetest' );
3637const wpt = new WebPageTest (' www.webpagetest.org' );
3738
38- wpt .runTest (' http ://marcelduran.com/ webpagetest- api' , (err , data ) => {
39+ wpt .runTest (' https ://docs. webpagetest.org/ api/integrations/ ' , (err , data ) => {
3940 console .log (err || data);
4041});
4142```
4243
43- ## API Console Demo
44-
45- [ marcelduran.com/webpagetest-api] ( http://marcelduran.com/webpagetest-api/console/ )
46-
4744## Command Line
4845
4946### Help
@@ -128,6 +125,18 @@ _The default WPT server can also be specified via environment variable `WEBPAGET
128125* ** -B, --pingback** _ \< url\> _ : URL to ping when the test is complete (the test ID will be passed as an "id" parameter)
129126* ** -D, --bwdown** _ \< bandwidth\> _ : download bandwidth in Kbps (used when specifying a custom connectivity profile)
130127* ** -U, --bwup** _ \< bandwidth\> _ : upload bandwidth in Kbps (used when specifying a custom connectivity profile)
128+ * ** -bw, --browserwidth** _ \< pixels\> _ : Browser window width (in display pixels)
129+ * ** -bh, --browserheight** _ \< pixels\> _ : Browser window height (in display pixels)
130+ * ** -vh, --viewportheight** _ \< pixels\> _ : Viewport Height in css pixels
131+ * ** -vw, --viewportwidth** _ \< pixels\> _ : Viewport Width in css pixels
132+ * ** -dpr, --devicetopixelratio** _ \< ratio\> _ : Device To Pixel Ratio
133+ * ** -au, --appendua** _ \< string\> _ : String to append to the user agent string. This is in addition to the default PTST/ver string
134+ * ** -tt, --testtype** _ \< string\> _ : For running alternative test types, can specify traceroute or lighthouse
135+ * ** -pr, --profiler** _ \< number\> _ : Set to 1 to enable the V8 sampling profiler (Chromium only)
136+ * ** -avif, --disableAVIF** _ \< number\> _ : Set to 1 to disable AVIF support (Chromium 88+)
137+ * ** -webp, --disableWEBP** _ \< number\> _ : Set to 1 to disable WEBP support (Chromium 88+)
138+ * ** -jxl, --disableJXL** _ \< number\> _ : Set to 1 to disable JXL support (Chromium 88+)
139+ * ** -dts, --dtShaper** _ \< number\> _ : Set to 1 to use Chrome's built-in traffic-shaping instead of the packet-level netem shaping usually used by the test agents
131140* ** -Y, --latency** _ \< time\> _ : first-hop Round Trip Time in ms (used when specifying a custom connectivity profile)
132141* ** -P, --plr** _ \< percentage\> _ : packet loss rate - percent of packets to drop (used when specifying a custom connectivity profile)
133142* ** -z, --noopt** : disable optimization checks (for faster testing)
@@ -257,9 +266,9 @@ $ webpagetest locations --key 1F2A3K4E5
257266}
258267```
259268
260- #### 3. Run test on http ://marcelduran.com/ webpagetest- api from San Jose on IE9
269+ #### 3. Run test on https ://docs. webpagetest.org/ api/integrations/ from San Jose on IE9
261270``` bash
262- $ webpagetest test http ://marcelduran.com/ webpagetest- api --key 1F2A3K4E5 --location SanJose_IE9
271+ $ webpagetest test https ://docs. webpagetest.org/ api/integrations/ --key 1F2A3K4E5 --location SanJose_IE9
263272```
264273``` javascript
265274{
@@ -307,7 +316,7 @@ $ webpagetest results 121025_PT_N8K
307316 " data" : {
308317 " testId" : " 121025_PT_N8K" ,
309318 " summary" : " https://www.webpagetest.org/result/121025_PT_N8K/" ,
310- " testUrl" : " http ://marcelduran.com/ webpagetest- api" ,
319+ " testUrl" : " https ://docs. webpagetest.org/ api/integrations/ " ,
311320 " location" : " SanJose_IE9" ,
312321 " connectivity" : " DSL" ,
313322 " bwDown" : 1500 , " bwUp" : 384 , " latency" : 50 , " plr" : 0 ,
@@ -340,21 +349,21 @@ $ webpagetest waterfall 121025_PT_N8K --thumbnail --cached --uri
340349}
341350```
342351
343- #### Run test on http ://marcelduran.com/ webpagetest- api and poll results every 5 seconds timing out in 60 seconds
352+ #### Run test on https ://docs. webpagetest.org/ api/integrations/ and poll results every 5 seconds timing out in 60 seconds
344353``` bash
345- $ webpagetest test http ://marcelduran.com/ webpagetest- api --poll 5 --timeout 60
354+ $ webpagetest test https ://docs. webpagetest.org/ api/integrations/ --poll 5 --timeout 60
346355```
347- #### Or run test on http ://marcelduran.com/ webpagetest- api and wait for results listening on localhost\* port 8000\* *
356+ #### Or run test on https ://docs. webpagetest.org/ api/integrations/ and wait for results listening on localhost\* port 8000\* *
348357``` bash
349- $ webpagetest test http ://marcelduran.com/ webpagetest- api --wait 8000
358+ $ webpagetest test https ://docs. webpagetest.org/ api/integrations/ --wait 8000
350359```
351360``` javascript
352361{
353362 " response" : {
354363 " statusCode" : 200 , " statusText" : " Ok" ,
355364 " data" : {
356365 " testId" : " 121025_PT_N8K" ,
357- " testUrl" : " http ://marcelduran.com/ webpagetest- api" ,
366+ " testUrl" : " https ://docs. webpagetest.org/ api/integrations/ " ,
358367 ...
359368 " median" : {
360369 " firstView" : {
@@ -484,6 +493,18 @@ wpt.runTest(script, (err, data) => {
484493* ** pingback** : _ String_ , URL to ping when the test is complete (the test ID will be passed as an "id" parameter)
485494* ** bandwidthDown** : _ String_ , download bandwidth in Kbps (used when specifying a custom connectivity profile)
486495* ** bandwidthUp** : _ String_ , upload bandwidth in Kbps (used when specifying a custom connectivity profile)
496+ * ** browserwidth** : _ String_ , Browser window width (in display pixels)
497+ * ** browserheight** : _ String_ , Browser window height (in display pixels)
498+ * ** viewportheight** : _ String_ , Viewport Height in css pixels
499+ * ** viewportwidth** : _ String_ , Viewport Width in css pixels
500+ * ** devicetopixelratio** : _ String_ , Device To Pixel Ratio
501+ * ** appendua** : _ String_ , String to append to the user agent string. This is in addition to the default PTST/ver string
502+ * ** testtype** : _ String_ , For running alternative test types, can specify traceroute or lighthouse
503+ * ** profiler** : _ Number_ , Set to 1 to enable the V8 sampling profiler (Chromium only)
504+ * ** disableAVIF** : _ Number_ , Set to 1 to disable AVIF support (Chromium 88+)
505+ * ** disableWEBP** : _ Number_ , Set to 1 to disable WEBP support (Chromium 88+)
506+ * ** disableJXL** : _ Number_ , Set to 1 to disable JpegXL support (Chromium 88+)
507+ * ** dtShaper** : _ Number_ , Set to 1 to use Chrome's built-in traffic-shaping instead of the packet-level netem shaping usually used by the test agents
487508* ** latency** : _ String_ , first-hop Round Trip Time in ms (used when specifying a custom connectivity profile)
488509* ** packetLossRate** : _ Number_ , packet loss rate - percent of packets to drop (used when specifying a custom connectivity profile)
489510* ** disableOptimization** : _ Boolean_ , disable optimization checks (for faster testing)
@@ -574,9 +595,9 @@ wpt.getLocations((err, data) => {
574595});
575596```
576597
577- #### 3. Run test on http ://marcelduran.com/ webpagetest- api from San Jose on IE9
598+ #### 3. Run test on https ://docs. webpagetest.org/ api/integrations/ from San Jose on IE9
578599``` javascript
579- wpt .runTest (' http ://marcelduran.com/ webpagetest- api' , {location: ' SanJose_IE9' }, (err , data ) => {
600+ wpt .runTest (' https ://docs. webpagetest.org/ api/integrations/ ' , {location: ' SanJose_IE9' }, (err , data ) => {
580601 console .log (err || data);
581602});
582603```
@@ -606,16 +627,16 @@ wpt.getWaterfallImage('121025_PT_N8K', {
606627});
607628```
608629
609- #### Run test on http ://marcelduran.com/ webpagetest- api and poll results every 5 seconds timing out in 60 seconds
630+ #### Run test on https ://docs. webpagetest.org/ api/integrations/ and poll results every 5 seconds timing out in 60 seconds
610631``` javascript
611- wpt .runTest (' http ://marcelduran.com/ webpagetest- api' , {pollResults: 5 , timeout: 60 }, (err , data ) => {
632+ wpt .runTest (' https ://docs. webpagetest.org/ api/integrations/ ' , {pollResults: 5 , timeout: 60 }, (err , data ) => {
612633 console .log (err || data);
613634});
614635```
615636
616- #### Or run test on http ://marcelduran.com/ webpagetest- api and wait results listening on localhost\* port 8000\*\*
637+ #### Or run test on https ://docs. webpagetest.org/ api/integrations/ and wait results listening on localhost\* port 8000\*\*
617638``` javascript
618- wpt .runTest (' http ://marcelduran.com/ webpagetest- api' , {waitResults: ' localhost:8000' }, (err , data ) => {
639+ wpt .runTest (' https ://docs. webpagetest.org/ api/integrations/ ' , {waitResults: ' localhost:8000' }, (err , data ) => {
619640 console .log (err || data);
620641});
621642```
@@ -636,7 +657,7 @@ http://localhost:8080
636657```
637658``` bash
638659$ curl http://localhost:8080/help
639- $ curl http://localhost:8080/test/marcelduran.com /? location=SanJose_IE9
660+ $ curl http://localhost:8080/test/webpagetest.org /? location=SanJose_IE9
640661```
641662``` bash
642663$ webpagetest listen 8443 --key key.pem --cert cert.pem --server wpt.foo.com
@@ -674,8 +695,8 @@ $ webpagetest batch commands.txt
674695```
675696where ` commands.txt ` contains:
676697```
677- test marcelduran.com --first --location foo
678- test marcelduran.com --first --location bar
698+ test https://docs.webpagetest.org/api/integrations/ --first --location foo
699+ test https://docs.webpagetest.org/api/integrations/ --first --location bar
679700```
680701It schedules the 2 tests above returning an array of size 2 in the same order as in ` commands.txt ` file:
681702``` javascript
@@ -706,15 +727,15 @@ By running multiple sync tests, i.e. with either `--poll` or `--wait`, all tests
706727
707728` commands.txt` :
708729` ` `
709- test marcelduran.com --first --location foo --poll --timeout 60
710- test marcelduran.com --first --location bar --poll --timeout 60
730+ test https://docs.webpagetest.org/api/integrations/ --first --location foo --poll --timeout 60
731+ test https://docs.webpagetest.org/api/integrations/ --first --location bar --poll --timeout 60
711732` ` `
712733
713734# # Test Specs (Continuous Integration)
714735
715736WebPageTest API Wrapper provides a simple seamless way to integrate WebPageTest with Continuous Integration tools.
716737
717- [See dedicated page](https://github.com/marcelduran /webpagetest-api/wiki/Test-Specs)
738+ [See dedicated page](https://github.com/WebPageTest /webpagetest-api/wiki/Test-Specs)
718739
719740# # Tests
720741` ` ` bash
@@ -725,18 +746,18 @@ $ npm test
725746
726747Have a bug/feature request? Please create an issue here on GitHub!
727748
728- https://github.com/marcelduran /webpagetest-api/issues
749+ https://github.com/WebPageTest /webpagetest-api/issues
729750
730751# # Author
731752
732- ** Marcel Duran **
753+ ** WebPageTest **
733754
734- + https://github.com/marcelduran
755+ + https://github.com/WebPageTest
735756
736757# # License
737758
738759Copyright 2013 Twitter Inc.
739760Copyright 2020 Google Inc.
740761Copyright 2020 Marcel Duran and other contributors
741762
742- Licensed under the [MIT License](https://github.com/marcelduran /webpagetest-api/raw/master/LICENSE)
763+ Licensed under the [MIT License](https://github.com/WebPageTest /webpagetest-api/raw/master/LICENSE)
0 commit comments