1
1
## WebPageTest API Wrapper for NodeJS
2
2
3
- [ ![ NPM] ( https://nodei.co/npm/webpagetest.png?downloads=true&downloadRank=true&stars=true )] ( https://nodei.co/npm/webpagetest/ )
4
- [ ![ Build Status] ( https://secure.travis-ci.org/marcelduran/webpagetest-api.png?branch=master )] ( http://travis-ci.org/marcelduran/webpagetest-api )
3
+ [ ![ Build Status] ( https://secure.travis-ci.org/marcelduran/webpagetest-api.png?branch=master )] ( https://travis-ci.org/marcelduran/webpagetest-api )
4
+ [ ![ NPM Version] ( https://img.shields.io/npm/v/webpagetest.svg?style=flat )] ( https://www.npmjs.org/package/webpagetest )
5
+ [ ![ NPM Downloads] ( https://img.shields.io/npm/dm/webpagetest.svg?style=flat )] ( https://www.npmjs.org/package/webpagetest )
5
6
[ ![ Dependencies Status] ( https://david-dm.org/marcelduran/webpagetest-api.png )] ( https://david-dm.org/marcelduran/webpagetest-api )
6
7
7
- [ WebPageTest API Wrapper] ( http ://marcelduran.com/webpagetest-api) is a [ NPM] ( http ://npmjs.org) package that wraps [ WebPageTest] ( https://github.com/WPO-Foundation/webpagetest ) API for [ NodeJS] ( http ://nodejs.org) as a module and a command-line tool.
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.
8
9
9
10
## Getting started
10
11
@@ -16,15 +17,15 @@ $ npm install webpagetest -g
16
17
17
18
### Command line
18
19
``` bash
19
- $ webpagetest test http ://twitter.com/marcelduran
20
+ $ webpagetest test https ://twitter.com/marcelduran
20
21
```
21
22
22
23
### Module
23
24
``` javascript
24
25
var WebPageTest = require (' webpagetest' );
25
26
var wpt = new WebPageTest (' www.webpagetest.org' );
26
27
27
- wpt .runTest (' http ://twitter.com/marcelduran' , function (err , data ) {
28
+ wpt .runTest (' https ://twitter.com/marcelduran' , function (err , data ) {
28
29
console .log (err || data);
29
30
});
30
31
```
@@ -135,7 +136,7 @@ _The default WPT server can also be specified via environment variable `WEBPAGET
135
136
* ** --timeout** _ \< seconds\> _ : timeout for polling and waiting results [ no timeout]
136
137
137
138
#### API Key (works for ** test** and ** cancel** commands)
138
- * ** -k, --key** _ \< api_key\> _ : API key (if assigned). Contact the WebPageTest server administrator for a key if required or request an API key for limited testing at [ webpagetest.org/getkey.php] ( http ://www.webpagetest.org/getkey.php)
139
+ * ** -k, --key** _ \< api_key\> _ : API key (if assigned). Contact the WebPageTest server administrator for a key if required or request an API key for limited testing at [ webpagetest.org/getkey.php] ( https ://www.webpagetest.org/getkey.php)
139
140
140
141
#### Request (works for ** status** , ** results** , ** locations** , ** testers** and ** test** commands)
141
142
* ** -e, --request** _ \< id\> _ : echo request ID, useful to track asynchronous requests
@@ -214,9 +215,9 @@ $ webpagetest locations
214
215
}
215
216
```
216
217
217
- #### 2. Run test on http ://twitter.com/marcelduran from San Jose on IE9
218
+ #### 2. Run test on https ://twitter.com/marcelduran from San Jose on IE9
218
219
``` bash
219
- $ webpagetest test http ://twitter.com/marcelduran --key 1F2A3K4E5 --location SanJose_IE9
220
+ $ webpagetest test https ://twitter.com/marcelduran --key 1F2A3K4E5 --location SanJose_IE9
220
221
```
221
222
``` javascript
222
223
{
@@ -225,11 +226,11 @@ $ webpagetest test http://twitter.com/marcelduran --key 1F2A3K4E5 --location San
225
226
" data" : {
226
227
" testId" : " 121025_PT_N8K" ,
227
228
" ownerKey" : " 868cb2813a0f376a977dd1a24ab041b4f12361b3" ,
228
- " jsonUrl" : " http ://localhost /results.php?test=121025_PT_N8K&f=json" ,
229
- " xmlUrl" : " http ://localhost /xmlResult.php?test=121025_PT_N8K" ,
230
- " userUrl" : " http ://localhost /results.php?test=121025_PT_N8K" ,
231
- " summaryCSV" : " http ://localhost /csv.php?test=121025_PT_N8K" ,
232
- " detailCSV" : " http ://localhost /csv.php?test=121025_PT_N8K&requests=1"
229
+ " jsonUrl" : " https ://www.webpagetest.org /results.php?test=121025_PT_N8K&f=json" ,
230
+ " xmlUrl" : " https ://www.webpagetest.org /xmlResult.php?test=121025_PT_N8K" ,
231
+ " userUrl" : " https ://www.webpagetest.org /results.php?test=121025_PT_N8K" ,
232
+ " summaryCSV" : " https ://www.webpagetest.org /csv.php?test=121025_PT_N8K" ,
233
+ " detailCSV" : " https ://www.webpagetest.org /csv.php?test=121025_PT_N8K&requests=1"
233
234
}
234
235
}
235
236
```
@@ -263,8 +264,8 @@ $ webpagetest results 121025_PT_N8K
263
264
" statusCode" : 200 , " statusText" : " Ok" ,
264
265
" data" : {
265
266
" testId" : " 121025_PT_N8K" ,
266
- " summary" : " http ://www.webpagetest.org/result/121025_PT_N8K/" ,
267
- " testUrl" : " http ://twitter.com/marcelduran" ,
267
+ " summary" : " https ://www.webpagetest.org/result/121025_PT_N8K/" ,
268
+ " testUrl" : " https ://twitter.com/marcelduran" ,
268
269
" location" : " SanJose_IE9" ,
269
270
" connectivity" : " DSL" ,
270
271
" bwDown" : 1500 , " bwUp" : 384 , " latency" : 50 , " plr" : 0 ,
@@ -297,21 +298,21 @@ $ webpagetest waterfall 121025_PT_N8K --thumbnail --cached --uri
297
298
}
298
299
```
299
300
300
- #### Run test on http ://twitter.com/marcelduran and poll results every 5 seconds timing out in 60 seconds
301
+ #### Run test on https ://twitter.com/marcelduran and poll results every 5 seconds timing out in 60 seconds
301
302
``` bash
302
- $ webpagetest test http ://twitter.com/marcelduran --poll 5 --timeout 60
303
+ $ webpagetest test https ://twitter.com/marcelduran --poll 5 --timeout 60
303
304
```
304
- #### Or run test on http ://twitter.com/marcelduran and wait for results listening on localhost\* port 8000\* *
305
+ #### Or run test on https ://twitter.com/marcelduran and wait for results listening on localhost\* port 8000\* *
305
306
``` bash
306
- $ webpagetest test http ://twitter.com/marcelduran --wait 8000
307
+ $ webpagetest test https ://twitter.com/marcelduran --wait 8000
307
308
```
308
309
``` javascript
309
310
{
310
311
" response" : {
311
312
" statusCode" : 200 , " statusText" : " Ok" ,
312
313
" data" : {
313
314
" testId" : " 121025_PT_N8K" ,
314
- " testUrl" : " http ://twitter.com/marcelduran" ,
315
+ " testUrl" : " https ://twitter.com/marcelduran" ,
315
316
...
316
317
" median" : {
317
318
" firstView" : {
@@ -525,9 +526,9 @@ wpt.getLocations(function(err, data) {
525
526
});
526
527
```
527
528
528
- #### 3. Run test on http ://twitter.com/marcelduran from San Jose on IE9
529
+ #### 3. Run test on https ://twitter.com/marcelduran from San Jose on IE9
529
530
``` javascript
530
- wpt .runTest (' http ://twitter.com/marcelduran' , {location: ' SanJose_IE9' }, function (err , data ) {
531
+ wpt .runTest (' https ://twitter.com/marcelduran' , {location: ' SanJose_IE9' }, function (err , data ) {
531
532
console .log (err || data);
532
533
});
533
534
```
@@ -557,16 +558,16 @@ wpt.getWaterfallImage('121025_PT_N8K', {
557
558
});
558
559
```
559
560
560
- #### Run test on http ://twitter.com/marcelduran and poll results every 5 seconds timing out in 60 seconds
561
+ #### Run test on https ://twitter.com/marcelduran and poll results every 5 seconds timing out in 60 seconds
561
562
``` javascript
562
- wpt .runTest (' http ://twitter.com/marcelduran' , {pollResults: 5 , timeout: 60 }, function (err , data ) {
563
+ wpt .runTest (' https ://twitter.com/marcelduran' , {pollResults: 5 , timeout: 60 }, function (err , data ) {
563
564
console .log (err || data);
564
565
});
565
566
```
566
567
567
- #### Or run test on http ://twitter.com/marcelduran and wait results listening on localhost\* port 8000\*\*
568
+ #### Or run test on https ://twitter.com/marcelduran and wait results listening on localhost\* port 8000\*\*
568
569
``` javascript
569
- wpt .runTest (' http ://twitter.com/marcelduran' , {waitResults: ' localhost:8000' }, function (err , data ) {
570
+ wpt .runTest (' https ://twitter.com/marcelduran' , {waitResults: ' localhost:8000' }, function (err , data ) {
570
571
console .log (err || data);
571
572
});
572
573
```
@@ -674,13 +675,14 @@ $ npm test
674
675
675
676
# # Changelog
676
677
678
+ * 0.3.2: Updated deps and fixed test runs with specs
677
679
* 0.3.1: Added dummy url when scripting, needed for webdriver scripting on mobbile agents
678
680
* 0.3.0: Replaced xmlResult.php by jsonResult.php WPT API endpoint for fetching test results
679
681
* 0.2.5: Added test options: custom, chrometrace, callstack, tester; Added chrometrace command (` getChromeTraceData` method)
680
682
* 0.2.4: Added test options: clearcerts, medianvideo, datareduction, useragent and tsview; HTTPS support to listen/proxy server
681
683
* 0.2.3: Updated DevTools Timeline API url endpoint for timeline command
682
684
* 0.2.2: Added response body command/method
683
- * 0.2.1: Added history, video, player, googleCsi commands and continuous option
685
+ * 0.2.1: Added history, video, player, googleCsi commands and continuous option
684
686
* 0.2.0: Replaced jsonml by xml2js dependency
685
687
* 0.1.3: Test results extra data (breakdown, domains, requests, pagespeed)
686
688
* 0.1.0: Specs (CI); Run in batch; Node methods/options as command aliases; new Chrome test options
@@ -699,16 +701,15 @@ https://github.com/marcelduran/webpagetest-api/issues
699
701
700
702
** Marcel Duran**
701
703
702
- + http ://github.com/marcelduran
704
+ + https ://github.com/marcelduran
703
705
704
706
# # License
705
707
706
- Copyright 2013 Twitter Inc.
707
- Copyright 2014 Google Inc.
708
- Copyright 2014 Marcel Duran and other contributors
708
+ Copyright 2013 Twitter Inc.
709
+ Copyright 2015 Google Inc.
710
+ Copyright 2015 Marcel Duran and other contributors
709
711
710
- Licensed under the [MIT License](http ://github.com/marcelduran/webpagetest-api/raw/master/LICENSE)
712
+ Licensed under the [MIT License](https ://github.com/marcelduran/webpagetest-api/raw/master/LICENSE)
711
713
712
714
713
715
[! [Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/marcelduran/webpagetest-api/trend.png)](https://bitdeli.com/free " Bitdeli Badge" )
714
-
0 commit comments