11## WebPageTest API Wrapper for NodeJS
22
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 )
56[ ![ Dependencies Status] ( https://david-dm.org/marcelduran/webpagetest-api.png )] ( https://david-dm.org/marcelduran/webpagetest-api )
67
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.
89
910## Getting started
1011
@@ -16,15 +17,15 @@ $ npm install webpagetest -g
1617
1718### Command line
1819``` bash
19- $ webpagetest test http ://twitter.com/marcelduran
20+ $ webpagetest test https ://twitter.com/marcelduran
2021```
2122
2223### Module
2324``` javascript
2425var WebPageTest = require (' webpagetest' );
2526var wpt = new WebPageTest (' www.webpagetest.org' );
2627
27- wpt .runTest (' http ://twitter.com/marcelduran' , function (err , data ) {
28+ wpt .runTest (' https ://twitter.com/marcelduran' , function (err , data ) {
2829 console .log (err || data);
2930});
3031```
@@ -123,7 +124,9 @@ _The default WPT server can also be specified via environment variable `WEBPAGET
123124* ** -A, --medianvideo** : store the video from the median run when capturing video is enabled
124125* ** --htmlbody** : save the content of only the base HTML response
125126* ** --tsview** _ \< id\> _ : test name to use when submitting results to tsviewdb (for private instances that have integrated with tsviewdb)
127+ * ** --tsviewconfigs** _ \< string\> _ : configs to use when submitting results to tsviewdb (for private instances that have integrated with tsviewdb)
126128* ** --affinity** _ \< string\> _ : string to hash test to a specific test agent. tester will be picked by index among available testers
129+ * ** --priority** _ \< number\> _ : change test priority (0-9) [ enforced by API key, otherwise 5]
127130* ** --noads** : block ads defined by adblockrules.org
128131* ** --continuous** : capture video continuously (unstable/experimental, may cause tests to fail)
129132* ** --spdy3** : force SPDY version 3 (Chrome only)
@@ -133,7 +136,7 @@ _The default WPT server can also be specified via environment variable `WEBPAGET
133136* ** --timeout** _ \< seconds\> _ : timeout for polling and waiting results [ no timeout]
134137
135138#### API Key (works for ** test** and ** cancel** commands)
136- * ** -k, --key** _ \< api_key\> _ : API key (if assigned). Contact the WebPageTest server administrator for a key if required
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 )
137140
138141#### Request (works for ** status** , ** results** , ** locations** , ** testers** and ** test** commands)
139142* ** -e, --request** _ \< id\> _ : echo request ID, useful to track asynchronous requests
@@ -212,9 +215,9 @@ $ webpagetest locations
212215}
213216```
214217
215- #### 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
216219``` bash
217- $ webpagetest test http ://twitter.com/marcelduran --key 1F2A3K4E5 --location SanJose_IE9
220+ $ webpagetest test https ://twitter.com/marcelduran --key 1F2A3K4E5 --location SanJose_IE9
218221```
219222``` javascript
220223{
@@ -223,11 +226,11 @@ $ webpagetest test http://twitter.com/marcelduran --key 1F2A3K4E5 --location San
223226 " data" : {
224227 " testId" : " 121025_PT_N8K" ,
225228 " ownerKey" : " 868cb2813a0f376a977dd1a24ab041b4f12361b3" ,
226- " jsonUrl" : " http ://localhost /results.php?test=121025_PT_N8K&f=json" ,
227- " xmlUrl" : " http ://localhost /xmlResult.php?test=121025_PT_N8K" ,
228- " userUrl" : " http ://localhost /results.php?test=121025_PT_N8K" ,
229- " summaryCSV" : " http ://localhost /csv.php?test=121025_PT_N8K" ,
230- " 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"
231234 }
232235}
233236```
@@ -261,8 +264,8 @@ $ webpagetest results 121025_PT_N8K
261264 " statusCode" : 200 , " statusText" : " Ok" ,
262265 " data" : {
263266 " testId" : " 121025_PT_N8K" ,
264- " summary" : " http ://www.webpagetest.org/result/121025_PT_N8K/" ,
265- " testUrl" : " http ://twitter.com/marcelduran" ,
267+ " summary" : " https ://www.webpagetest.org/result/121025_PT_N8K/" ,
268+ " testUrl" : " https ://twitter.com/marcelduran" ,
266269 " location" : " SanJose_IE9" ,
267270 " connectivity" : " DSL" ,
268271 " bwDown" : 1500 , " bwUp" : 384 , " latency" : 50 , " plr" : 0 ,
@@ -295,21 +298,21 @@ $ webpagetest waterfall 121025_PT_N8K --thumbnail --cached --uri
295298}
296299```
297300
298- #### 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
299302``` bash
300- $ webpagetest test http ://twitter.com/marcelduran --poll 5 --timeout 60
303+ $ webpagetest test https ://twitter.com/marcelduran --poll 5 --timeout 60
301304```
302- #### 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\* *
303306``` bash
304- $ webpagetest test http ://twitter.com/marcelduran --wait 8000
307+ $ webpagetest test https ://twitter.com/marcelduran --wait 8000
305308```
306309``` javascript
307310{
308311 " response" : {
309312 " statusCode" : 200 , " statusText" : " Ok" ,
310313 " data" : {
311314 " testId" : " 121025_PT_N8K" ,
312- " testUrl" : " http ://twitter.com/marcelduran" ,
315+ " testUrl" : " https ://twitter.com/marcelduran" ,
313316 ...
314317 " median" : {
315318 " firstView" : {
@@ -446,7 +449,9 @@ wpt.runTest(script, function(err, data) {
446449* ** medianVideo** : _ Boolean_ , store the video from the median run when capturing video is enabled
447450* ** htmlBody** : _ Boolean_ , save the content of only the base HTML response
448451* ** tsView** : _ String_ , test name to use when submitting results to tsviewdb (for private instances that have integrated with tsviewdb)
452+ * ** tsViewConfigs** : _ String_ , configs to use when submitting results to tsviewdb (for private instances that have integrated with tsviewdb)
449453* ** affinity** : _ String_ , string to hash test to a specific test agent. tester will be picked by index among available testers
454+ * ** priority** : _ Number_ , change test priority (0-9) [ enforced by API key, otherwise 5]
450455* ** blockAds** : _ Boolean_ , block ads defined by adblockrules.org
451456* ** continuousVideoCapture** : _ Boolean_ , capture video continuously (unstable/experimental, may cause tests to fail)
452457* ** forceSpdy3** : _ Boolean_ , force SPDY version 3 (Chrome only)
@@ -521,9 +526,9 @@ wpt.getLocations(function(err, data) {
521526});
522527```
523528
524- #### 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
525530``` javascript
526- 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 ) {
527532 console .log (err || data);
528533});
529534```
@@ -553,16 +558,16 @@ wpt.getWaterfallImage('121025_PT_N8K', {
553558});
554559```
555560
556- #### 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
557562``` javascript
558- 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 ) {
559564 console .log (err || data);
560565});
561566```
562567
563- #### 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\*\*
564569``` javascript
565- 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 ) {
566571 console .log (err || data);
567572});
568573```
@@ -670,13 +675,14 @@ $ npm test
670675
671676# # Changelog
672677
678+ * 0.3.2: Updated deps and fixed test runs with specs
673679* 0.3.1: Added dummy url when scripting, needed for webdriver scripting on mobbile agents
674680* 0.3.0: Replaced xmlResult.php by jsonResult.php WPT API endpoint for fetching test results
675681* 0.2.5: Added test options: custom, chrometrace, callstack, tester; Added chrometrace command (` getChromeTraceData` method)
676682* 0.2.4: Added test options: clearcerts, medianvideo, datareduction, useragent and tsview; HTTPS support to listen/proxy server
677683* 0.2.3: Updated DevTools Timeline API url endpoint for timeline command
678684* 0.2.2: Added response body command/method
679- * 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
680686* 0.2.0: Replaced jsonml by xml2js dependency
681687* 0.1.3: Test results extra data (breakdown, domains, requests, pagespeed)
682688* 0.1.0: Specs (CI); Run in batch; Node methods/options as command aliases; new Chrome test options
@@ -695,16 +701,15 @@ https://github.com/marcelduran/webpagetest-api/issues
695701
696702** Marcel Duran**
697703
698- + http ://github.com/marcelduran
704+ + https ://github.com/marcelduran
699705
700706# # License
701707
702- Copyright 2013 Twitter Inc.
703- Copyright 2014 Google Inc.
704- 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
705711
706- 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)
707713
708714
709715[! [Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/marcelduran/webpagetest-api/trend.png)](https://bitdeli.com/free " Bitdeli Badge" )
710-
0 commit comments