diff --git a/lib/plugins/analysisstorer/index.js b/lib/plugins/analysisstorer/index.js index 3b1d58376..c351fac53 100644 --- a/lib/plugins/analysisstorer/index.js +++ b/lib/plugins/analysisstorer/index.js @@ -42,8 +42,8 @@ module.exports = { let fileName = message.type + '.json'; if (message.url) { - if (Number.isInteger(message.runIndex)) { - fileName = message.type + '-' + message.runIndex + '.json'; + if (Number.isInteger(message.iteration)) { + fileName = message.type + '-' + message.iteration + '.json'; } return this.storageManager.writeDataForUrl( diff --git a/lib/plugins/browsertime/index.js b/lib/plugins/browsertime/index.js index e1744381e..ce5a9c2bb 100644 --- a/lib/plugins/browsertime/index.js +++ b/lib/plugins/browsertime/index.js @@ -136,7 +136,8 @@ module.exports = { JSON.stringify(coachAdvice.errors), { url, - runIndex + runIndex, + iteration: runIndex + 1 } ) ); @@ -155,7 +156,8 @@ module.exports = { make('coach.run', total, { url, group, - runIndex + runIndex, + iteration: runIndex + 1 }) ) ); @@ -164,7 +166,8 @@ module.exports = { make('coach.run', coachAdvice, { url, group, - runIndex + runIndex, + iteration: runIndex + 1 }) ); } @@ -283,7 +286,8 @@ module.exports = { make('browsertime.run', run, { url, group, - runIndex + runIndex, + iteration: runIndex + 1 }) ); aggregator.addToAggregate(run, group); diff --git a/lib/plugins/coach/index.js b/lib/plugins/coach/index.js index 7d7aac9cc..f01e2ab76 100644 --- a/lib/plugins/coach/index.js +++ b/lib/plugins/coach/index.js @@ -43,7 +43,7 @@ module.exports = { break; } case 'coach.run': { - if (message.runIndex === 0) { + if (message.iteration === 1) { // For now, choose the first run to represent the whole page. // Later we might want to change the median run (based on some metric) similar to the WPT approach. const url = message.url; diff --git a/lib/plugins/html/htmlBuilder.js b/lib/plugins/html/htmlBuilder.js index 9e942a8ec..302503773 100644 --- a/lib/plugins/html/htmlBuilder.js +++ b/lib/plugins/html/htmlBuilder.js @@ -249,6 +249,7 @@ class HTMLBuilder { return this._renderUrlPage(url, 'index', data).tap(() => Promise.resolve(Object.keys(runPages)).map(runIndex => { + const iteration = Number(runIndex) + 1; const pugs = {}; const pageInfo = runPages[runIndex]; const runTimestamp = get( @@ -264,7 +265,7 @@ class HTMLBuilder { let data = { daurl: url, daurlAlias, - runIndex, + iteration, pageInfo, options, runPages, diff --git a/lib/plugins/html/templates/url/iteration/downloads.pug b/lib/plugins/html/templates/url/iteration/downloads.pug index 7029ec442..ca9578930 100644 --- a/lib/plugins/html/templates/url/iteration/downloads.pug +++ b/lib/plugins/html/templates/url/iteration/downloads.pug @@ -1,8 +1,8 @@ if options.browsertime.video - - var videoPath = 'data/video/' + (runIndex ? (Number(runIndex)+1) : 1) +'.mp4' + - var videoPath = 'data/video/' + (iteration ? iteration : 1) +'.mp4' a.button.button-download(href=videoPath, download=downloadName + '-video.mp4') Download video if options.browsertime.chrome && options.browsertime.chrome.timeline - - var tracePath = 'data/trace-' + (runIndex ? (Number(runIndex)+1) : 1) + '.json.gz' + - var tracePath = 'data/trace-' + (iteration ? iteration : 1) + '.json.gz' a.button.button-download(href=tracePath, download=downloadName + '-timeline.json.gz') Download timeline if d.browsertime && d.browsertime.har - var harEnding = options.gzipHAR ? '.har.gz' : '.har' diff --git a/lib/plugins/html/templates/url/iteration/index.pug b/lib/plugins/html/templates/url/iteration/index.pug index f0552bce0..e1c8cd9c2 100644 --- a/lib/plugins/html/templates/url/iteration/index.pug +++ b/lib/plugins/html/templates/url/iteration/index.pug @@ -2,7 +2,7 @@ extends ../../layout.pug block content - var d = pageInfo.data - - runNumber = Number(runIndex)+1 + - runNumber = iteration - var daTitle = daurlAlias ? daurlAlias : daurl - var downloadName = (daTitle + '-' + runNumber + '-' + options.browser + '-' + timestamp).replace(/(https?\:\/\/)|( )|(:)/ig, '') @@ -99,12 +99,12 @@ block content .one-half.column if hasScreenShots - - screenshotName = 'data/screenshots/' + (Number(runIndex)+1) + '.' + screenShotType + - screenshotName = 'data/screenshots/' + iteration + '.' + screenShotType - var width = options.mobile ? 150 : '100%'; a(href=screenshotName) img.screenshot(src=screenshotName, width=width, alt='Screenshot') else if !d.browsertime && d.webpagetest - - screenshotName = 'data/screenshots/wpt-' + (Number(runIndex)+1) + '-firstView.png' + - screenshotName = 'data/screenshots/wpt-' + iteration + '-firstView.png' a(href=screenshotName) img.screenshot(src=screenshotName, alt='Screenshot') .downloads diff --git a/lib/plugins/html/templates/url/summary/summaryBox.pug b/lib/plugins/html/templates/url/summary/summaryBox.pug index 8f145a775..264cb9488 100644 --- a/lib/plugins/html/templates/url/summary/summaryBox.pug +++ b/lib/plugins/html/templates/url/summary/summaryBox.pug @@ -7,7 +7,7 @@ mixin getLink(path, name, metric, type) if (run[name] === metric[type] && isSet === false) - isSet = true td.number(data-title=type) - a(href='./' + index + '.html', title='Go to the run with the ' + type + ' ' + name) #{metric[type]} + a(href='./' + (index+1) + '.html', title='Go to the run with the ' + type + ' ' + name) #{metric[type]} mixin getLinkTimings(path, name, metric, type) - isSet = false @@ -18,7 +18,7 @@ mixin getLinkTimings(path, name, metric, type) if (Number(run.timings[name]).toFixed(0) === Number(metric[name][type]).toFixed(0) && isSet === false) - isSet = true td.number(data-title=type) - a(href='./' + index + '.html', title='Go to the run with the ' + type + ' ' + name) #{metric[name][type]} + a(href='./' + (index+1) + '.html', title='Go to the run with the ' + type + ' ' + name) #{metric[name][type]} mixin getLinkPageTimings(path, name, metric, type) - isSet = false @@ -29,7 +29,7 @@ mixin getLinkPageTimings(path, name, metric, type) if (Number(run.timings.pageTimings[name]).toFixed(0) === Number(metric[name][type]).toFixed(0) && isSet === false) - isSet = true td.number(data-title=type) - a(href='./' + index + '.html', title='Go to the run with the ' + type + ' ' + name) #{metric[name][type]} + a(href='./' + (index+1) + '.html', title='Go to the run with the ' + type + ' ' + name) #{metric[name][type]} mixin getUserTimings(path, name, metric, type) - isSet = false @@ -41,7 +41,7 @@ mixin getUserTimings(path, name, metric, type) if (marks.name === name && Number(marks.startTime).toFixed(0) === Number(metric[type]).toFixed(0) && isSet === false) - isSet = true td.number(data-title=type) - a(href='./' + index + '.html', title='Go to the run with the ' + type + ' ' + name) #{metric[type]} + a(href='./' + (index+1) + '.html', title='Go to the run with the ' + type + ' ' + name) #{metric[type]} - btStatistics = h.get(pageInfo.data, 'browsertime.pageSummary.statistics') diff --git a/lib/plugins/html/templates/url/video/index.pug b/lib/plugins/html/templates/url/video/index.pug index 3d62e211a..9ce8ee166 100644 --- a/lib/plugins/html/templates/url/video/index.pug +++ b/lib/plugins/html/templates/url/video/index.pug @@ -1,4 +1,4 @@ -- var videoIndex = runIndex ? (Number(runIndex)+1) : 1; +- var videoIndex = iteration ? iteration : 1; - var width = options.mobile ? 'max-width: 400px;' : h.get(options, 'browsertime.chrome.android.package') ? 'max-width: 400px;' : 'width: 100%' a#video @@ -10,5 +10,5 @@ h3 Video script(src= rootPath + 'js/video.novtt.min.js') -- var videoPath = 'data/video/' + (runIndex ? (Number(runIndex)+1) : 1) +'.mp4' +- var videoPath = 'data/video/' + (iteration ? iteration : 1) +'.mp4' a.button.button-download(href=videoPath, download=downloadName + '-video.mp4') Download video diff --git a/lib/plugins/html/templates/url/waterfall/includeHARinHTML.pug b/lib/plugins/html/templates/url/waterfall/includeHARinHTML.pug index e4801b621..7aef2c892 100644 --- a/lib/plugins/html/templates/url/waterfall/includeHARinHTML.pug +++ b/lib/plugins/html/templates/url/waterfall/includeHARinHTML.pug @@ -15,7 +15,7 @@ script(type='text/javascript'). showMimeTypeIcon: true, leftColumnWidth: 30, legendHolder: legendHolderEl, - selectedPage: #{runIndex || medianRun.runIndex}, + selectedPage: #{iteration || medianRun.runIndex}, pageSelector: pageSelectorEl }; diff --git a/lib/plugins/pagexray/index.js b/lib/plugins/pagexray/index.js index 2f4c77ea1..e4b15f43e 100644 --- a/lib/plugins/pagexray/index.js +++ b/lib/plugins/pagexray/index.js @@ -81,7 +81,12 @@ module.exports = { pageSummary.forEach((run, runIndex) => { queue.postMessage( - make('pagexray.run', run, { url, group, runIndex }) + make('pagexray.run', run, { + url, + group, + runIndex, + iteration: runIndex + 1 + }) ); }); }