1
1
## WebPageTest API Wrapper for NodeJS
2
2
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 )
4
4
[ ![ NPM Version] ( https://img.shields.io/npm/v/webpagetest.svg?style=flat )] ( https://www.npmjs.org/package/webpagetest )
5
5
[ ![ 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.
7
9
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.
9
10
10
11
## Getting started
11
12
@@ -17,7 +18,7 @@ $ npm install webpagetest -g
17
18
18
19
### Command line
19
20
``` bash
20
- $ webpagetest test http ://marcelduran.com/ webpagetest- api
21
+ $ webpagetest test https ://docs. webpagetest.org/ api/integrations/
21
22
```
22
23
23
24
### Docker
@@ -27,23 +28,19 @@ $ docker build -t webpagetest-api .
27
28
```
28
29
#### Run
29
30
``` 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/
31
32
```
32
33
33
34
### Module
34
35
``` javascript
35
36
const WebPageTest = require (' webpagetest' );
36
37
const wpt = new WebPageTest (' www.webpagetest.org' );
37
38
38
- wpt .runTest (' http ://marcelduran.com/ webpagetest- api' , (err , data ) => {
39
+ wpt .runTest (' https ://docs. webpagetest.org/ api/integrations/ ' , (err , data ) => {
39
40
console .log (err || data);
40
41
});
41
42
```
42
43
43
- ## API Console Demo
44
-
45
- [ marcelduran.com/webpagetest-api] ( http://marcelduran.com/webpagetest-api/console/ )
46
-
47
44
## Command Line
48
45
49
46
### Help
@@ -128,6 +125,18 @@ _The default WPT server can also be specified via environment variable `WEBPAGET
128
125
* ** -B, --pingback** _ \< url\> _ : URL to ping when the test is complete (the test ID will be passed as an "id" parameter)
129
126
* ** -D, --bwdown** _ \< bandwidth\> _ : download bandwidth in Kbps (used when specifying a custom connectivity profile)
130
127
* ** -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
131
140
* ** -Y, --latency** _ \< time\> _ : first-hop Round Trip Time in ms (used when specifying a custom connectivity profile)
132
141
* ** -P, --plr** _ \< percentage\> _ : packet loss rate - percent of packets to drop (used when specifying a custom connectivity profile)
133
142
* ** -z, --noopt** : disable optimization checks (for faster testing)
@@ -257,9 +266,9 @@ $ webpagetest locations --key 1F2A3K4E5
257
266
}
258
267
```
259
268
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
261
270
``` 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
263
272
```
264
273
``` javascript
265
274
{
@@ -307,7 +316,7 @@ $ webpagetest results 121025_PT_N8K
307
316
" data" : {
308
317
" testId" : " 121025_PT_N8K" ,
309
318
" summary" : " https://www.webpagetest.org/result/121025_PT_N8K/" ,
310
- " testUrl" : " http ://marcelduran.com/ webpagetest- api" ,
319
+ " testUrl" : " https ://docs. webpagetest.org/ api/integrations/ " ,
311
320
" location" : " SanJose_IE9" ,
312
321
" connectivity" : " DSL" ,
313
322
" bwDown" : 1500 , " bwUp" : 384 , " latency" : 50 , " plr" : 0 ,
@@ -340,21 +349,21 @@ $ webpagetest waterfall 121025_PT_N8K --thumbnail --cached --uri
340
349
}
341
350
```
342
351
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
344
353
``` 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
346
355
```
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\* *
348
357
``` bash
349
- $ webpagetest test http ://marcelduran.com/ webpagetest- api --wait 8000
358
+ $ webpagetest test https ://docs. webpagetest.org/ api/integrations/ --wait 8000
350
359
```
351
360
``` javascript
352
361
{
353
362
" response" : {
354
363
" statusCode" : 200 , " statusText" : " Ok" ,
355
364
" data" : {
356
365
" testId" : " 121025_PT_N8K" ,
357
- " testUrl" : " http ://marcelduran.com/ webpagetest- api" ,
366
+ " testUrl" : " https ://docs. webpagetest.org/ api/integrations/ " ,
358
367
...
359
368
" median" : {
360
369
" firstView" : {
@@ -484,6 +493,18 @@ wpt.runTest(script, (err, data) => {
484
493
* ** pingback** : _ String_ , URL to ping when the test is complete (the test ID will be passed as an "id" parameter)
485
494
* ** bandwidthDown** : _ String_ , download bandwidth in Kbps (used when specifying a custom connectivity profile)
486
495
* ** 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
487
508
* ** latency** : _ String_ , first-hop Round Trip Time in ms (used when specifying a custom connectivity profile)
488
509
* ** packetLossRate** : _ Number_ , packet loss rate - percent of packets to drop (used when specifying a custom connectivity profile)
489
510
* ** disableOptimization** : _ Boolean_ , disable optimization checks (for faster testing)
@@ -574,9 +595,9 @@ wpt.getLocations((err, data) => {
574
595
});
575
596
```
576
597
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
578
599
``` 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 ) => {
580
601
console .log (err || data);
581
602
});
582
603
```
@@ -606,16 +627,16 @@ wpt.getWaterfallImage('121025_PT_N8K', {
606
627
});
607
628
```
608
629
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
610
631
``` 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 ) => {
612
633
console .log (err || data);
613
634
});
614
635
```
615
636
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\*\*
617
638
``` 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 ) => {
619
640
console .log (err || data);
620
641
});
621
642
```
@@ -636,7 +657,7 @@ http://localhost:8080
636
657
```
637
658
``` bash
638
659
$ 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
640
661
```
641
662
``` bash
642
663
$ webpagetest listen 8443 --key key.pem --cert cert.pem --server wpt.foo.com
@@ -674,8 +695,8 @@ $ webpagetest batch commands.txt
674
695
```
675
696
where ` commands.txt ` contains:
676
697
```
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
679
700
```
680
701
It schedules the 2 tests above returning an array of size 2 in the same order as in ` commands.txt ` file:
681
702
``` javascript
@@ -706,15 +727,15 @@ By running multiple sync tests, i.e. with either `--poll` or `--wait`, all tests
706
727
707
728
` commands.txt` :
708
729
` ` `
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
711
732
` ` `
712
733
713
734
# # Test Specs (Continuous Integration)
714
735
715
736
WebPageTest API Wrapper provides a simple seamless way to integrate WebPageTest with Continuous Integration tools.
716
737
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)
718
739
719
740
# # Tests
720
741
` ` ` bash
@@ -725,18 +746,18 @@ $ npm test
725
746
726
747
Have a bug/feature request? Please create an issue here on GitHub!
727
748
728
- https://github.com/marcelduran /webpagetest-api/issues
749
+ https://github.com/WebPageTest /webpagetest-api/issues
729
750
730
751
# # Author
731
752
732
- ** Marcel Duran **
753
+ ** WebPageTest **
733
754
734
- + https://github.com/marcelduran
755
+ + https://github.com/WebPageTest
735
756
736
757
# # License
737
758
738
759
Copyright 2013 Twitter Inc.
739
760
Copyright 2020 Google Inc.
740
761
Copyright 2020 Marcel Duran and other contributors
741
762
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