Skip to content

Commit e78fafe

Browse files
committed
added command line for video/player and tests
1 parent 7849aa4 commit e78fafe

6 files changed

Lines changed: 41 additions & 2 deletions

File tree

lib/mapping.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,16 @@ var options = {
539539
param: 'api_key',
540540
info: 'API key (if assigned). Contact the WebPageTest server administrator for a key if required'
541541
}
542+
},
543+
'video': {
544+
'end': {
545+
name: 'comparisonEndPoint',
546+
key: 'e',
547+
api: 'end',
548+
param: 'end_point',
549+
info: 'frame comparison end point: [visual]=visually complete | all=last change | doc=document complete | full=fully loaded',
550+
valid: /^(?:visual|all|doc|full)$/
551+
}
542552
}
543553
};
544554

@@ -642,6 +652,17 @@ var commands = {
642652
options: [options.run, options.image, options.screenshot],
643653
info: 'get the fully loaded page screenshot in JPG format (PNG if in full resolution)'
644654
},
655+
'video': {
656+
name: 'createVideo',
657+
param: 'tests',
658+
options: [options.video],
659+
info: 'create a video from <tests> (comma separated test ids)'
660+
},
661+
'player': {
662+
name: 'getEmbedVideoPlayer',
663+
param: 'id',
664+
info: 'get a html5 player for a video <id>'
665+
},
645666
'listen': {
646667
name: 'listen',
647668
param: 'hostname:port',

lib/webpagetest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ function createVideo(tests, options, callback) {
626626
var params = {
627627
tests: tests,
628628
f: 'json',
629-
end: options.end || 'visual'
629+
end: options.comparisonEndPoint || 'visual'
630630
};
631631

632632
api.call(this, paths.videoCreation, callback, params, options);

test/command-line-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ describe('WebPageTest Command Line', function() {
298298
[
299299
'', 'status', 'results', 'locations', 'testers', 'test', 'cancel', 'har',
300300
'pagespeed', 'utilization', 'request', 'timeline', 'netlog', 'console',
301-
'testinfo', 'history', 'waterfall', 'screenshot', 'listen'
301+
'testinfo', 'history', 'waterfall', 'screenshot', 'listen', 'video'
302302
].forEach(function eachCmd(command) {
303303
it('gets a ' + command + ' help input and returns the help text', function(done) {
304304
exec(mock(command + ' --help'), function(err, data) {

test/dryrun-test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,14 @@ describe('Dry Run', function() {
372372
});
373373
});
374374

375+
it('create a video with document complete comparison end point', function (done) {
376+
wpt.createVideo('130416_YS_KD4-r:3-c:1,130416_W6_KEE-r:8-c:1', {dryRun: true, comparisonEndPoint: 'doc'}, function (err, data) {
377+
if (err) throw err;
378+
assert.equal(data.url, wptServer + 'video/create.php?tests=130416_YS_KD4-r%3A3-c%3A1%2C130416_W6_KEE-r%3A8-c%3A1&f=json&end=doc');
379+
done();
380+
});
381+
});
382+
375383
it('get the url of an embedded video', function (done) {
376384
wpt.getEmbedVideoPlayer('130416_36ed6e37013655a14b2b857cdccec99db72adcaa', {dryRun: true}, function (err, data) {
377385
if (err) throw err;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
Usage: video [options] <tests>
3+
4+
Options:
5+
6+
-h, --help output usage information
7+
-e, --end <end_point> frame comparison end point: [visual]=visually complete | all=last change | doc=document complete | full=fully loaded
8+

test/fixtures/command-line/help.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
history [days] get history of previously run tests
2121
waterfall [options] <id> get the waterfall PNG image
2222
screenshot [options] <id> get the fully loaded page screenshot in JPG format (PNG if in full resolution)
23+
video [options] <tests> create a video from <tests> (comma separated test ids)
24+
player <id> get a html5 player for a video <id>
2325
listen [hostname:port] start webpagetest-api server on <hostname>:<port> [hostname:7791]
2426
batch <file> run commands in batch, i.e. one command per line from <file> in parallel
2527

0 commit comments

Comments
 (0)