Skip to content

Commit 6ba8784

Browse files
committed
added chrometrace command
1 parent e6a3dde commit 6ba8784

7 files changed

Lines changed: 118 additions & 25 deletions

File tree

lib/mapping.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,12 @@ var commands = {
714714
options: [options.run],
715715
info: 'get the Chrome Developer Tools Net log data (if available) from test'
716716
},
717+
'chrometrace': {
718+
name: 'getChromeTraceData',
719+
param: 'id',
720+
options: [options.run],
721+
info: 'get the Chrome Trace data (if available) from test'
722+
},
717723
'console': {
718724
name: 'getConsoleLogData',
719725
param: 'id',

lib/webpagetest.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ var filenames = {
4343
utilization: 'progress.csv',
4444
request: 'IEWTR.txt',
4545
netLog: 'netlog.txt',
46+
chromeTrace: 'trace.json',
4647
consoleLog: 'console_log.json',
4748
testInfo: 'testinfo.json',
4849
history: 'history.csv',
@@ -529,6 +530,17 @@ function getNetLogData(id, options, callback) {
529530
}, options);
530531
}
531532

533+
function getChromeTraceData(id, options, callback) {
534+
callback = callback || options;
535+
options = options === callback ? {} : options;
536+
options.parser = options.parser || helper.netLogParser;
537+
538+
return api.call(this, paths.gzip, callback, {
539+
test: id,
540+
file: setFilename(filenames.chromeTrace, options)
541+
}, options);
542+
}
543+
532544
function getConsoleLogData(id, options, callback) {
533545
callback = callback || options;
534546
options = options === callback ? {} : options;
@@ -729,6 +741,7 @@ WebPageTest.prototype = {
729741
getRequestData: getRequestData,
730742
getTimelineData: getTimelineData,
731743
getNetLogData: getNetLogData,
744+
getChromeTraceData: getChromeTraceData,
732745
getConsoleLogData: getConsoleLogData,
733746
getTestInfo: getTestInfo,
734747
getHistory: getHistory,
@@ -754,6 +767,7 @@ WebPageTest.prototype = {
754767
request: getRequestData,
755768
timeline: getTimelineData,
756769
netlog: getNetLogData,
770+
chrometrace: getChromeTraceData,
757771
console: getConsoleLogData,
758772
testinfo: getTestInfo,
759773
history: getHistory,

test/command-line-test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,9 @@ describe('WebPageTest Command Line', function() {
307307
// loop all commands help
308308
[
309309
'', 'status', 'results', 'locations', 'testers', 'test', 'cancel', 'har',
310-
'pagespeed', 'utilization', 'request', 'timeline', 'netlog', 'console',
311-
'testinfo', 'history', 'waterfall', 'screenshot', 'listen', 'video'
310+
'pagespeed', 'utilization', 'request', 'timeline', 'netlog', 'chrometrace',
311+
'console', 'testinfo', 'history', 'googlecsi', 'response', 'waterfall',
312+
'screenshot', 'video', 'player', 'listen', 'batch'
312313
].forEach(function eachCmd(command) {
313314
it('gets a ' + command + ' help input and returns the help text', function(done) {
314315
exec(mock(command + ' --help'), function(err, data) {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
Usage: batch [options] <file>
3+
4+
Options:
5+
6+
-h, --help output usage information
7+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
Usage: chrometrace [options] <id>
3+
4+
Options:
5+
6+
-h, --help output usage information
7+
-r, --run <number> which run number on a multiple runs test [1]
8+
-c, --cached get the Repeat View (cached view) instead of default First View (primed cache)
9+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
Usage: player [options] <id>
3+
4+
Options:
5+
6+
-h, --help output usage information
7+

test/fixtures/command-line/help.txt

Lines changed: 72 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,78 @@
33

44
Commands:
55

6-
status [options] <id> check test status
7-
results [options] <id> get test results
8-
locations [options] list locations and the number of pending tests
9-
testers [options] list testers status and details
10-
test [options] <url_or_script> run test
11-
cancel [options] <id> cancel running/pending test
12-
har <id> get the HTTPS Archive (HAR) from test
13-
pagespeed [options] <id> get the Google Page Speed results (if available) from test
14-
utilization [options] <id> get the CPU, bandwidth and memory utilization data from test
15-
request [options] <id> get the request data from test
16-
timeline [options] <id> get the Chrome Developer Tools Timeline data (if available) from test
17-
netlog [options] <id> get the Chrome Developer Tools Net log data (if available) from test
18-
console [options] <id> get the browser console log data (if available) from test
19-
testinfo <id> get test request info/details
20-
history [days] get history of previously run tests
21-
googlecsi [options] <id> get Google CSI data (Client Side Instrumentation)
22-
response [options] <id> get response body for text resources
23-
waterfall [options] <id> get the waterfall PNG image
24-
screenshot [options] <id> get the fully loaded page screenshot in JPG format (PNG if in full resolution)
25-
video [options] <tests> create a video from <tests> (comma separated test ids)
26-
player <id> get a html5 player for a video <id>
27-
listen [options] [hostname:port] start webpagetest-api proxy server on <hostname>:<port> [hostname:7791]
28-
batch <file> run commands in batch, i.e. one command per line from <file> in parallel
6+
status [options] <id>
7+
check test status
8+
9+
results [options] <id>
10+
get test results
11+
12+
locations [options]
13+
list locations and the number of pending tests
14+
15+
testers [options]
16+
list testers status and details
17+
18+
test [options] <url_or_script>
19+
run test
20+
21+
cancel [options] <id>
22+
cancel running/pending test
23+
24+
har <id>
25+
get the HTTPS Archive (HAR) from test
26+
27+
pagespeed [options] <id>
28+
get the Google Page Speed results (if available) from test
29+
30+
utilization [options] <id>
31+
get the CPU, bandwidth and memory utilization data from test
32+
33+
request [options] <id>
34+
get the request data from test
35+
36+
timeline [options] <id>
37+
get the Chrome Developer Tools Timeline data (if available) from test
38+
39+
netlog [options] <id>
40+
get the Chrome Developer Tools Net log data (if available) from test
41+
42+
chrometrace [options] <id>
43+
get the Chrome Trace data (if available) from test
44+
45+
console [options] <id>
46+
get the browser console log data (if available) from test
47+
48+
testinfo <id>
49+
get test request info/details
50+
51+
history [days]
52+
get history of previously run tests
53+
54+
googlecsi [options] <id>
55+
get Google CSI data (Client Side Instrumentation)
56+
57+
response [options] <id>
58+
get response body for text resources
59+
60+
waterfall [options] <id>
61+
get the waterfall PNG image
62+
63+
screenshot [options] <id>
64+
get the fully loaded page screenshot in JPG format (PNG if in full resolution)
65+
66+
video [options] <tests>
67+
create a video from <tests> (comma separated test ids)
68+
69+
player <id>
70+
get a html5 player for a video <id>
71+
72+
listen [options] [hostname:port]
73+
start webpagetest-api proxy server on <hostname>:<port> [hostname:7791]
74+
75+
batch <file>
76+
run commands in batch, i.e. one command per line from <file> in parallel
77+
2978

3079
Options:
3180

0 commit comments

Comments
 (0)