Show Android and WPT info (#2974)

This commit is contained in:
Peter Hedenskog 2020-04-30 15:37:03 +02:00 committed by GitHub
parent 8ad0090c21
commit b9767f2dc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 124 additions and 78 deletions

View File

@ -289,6 +289,12 @@ module.exports = {
run.description = result[resultIndex].info.description;
}
if (result[resultIndex].info.android) {
run.android = result[resultIndex].info.android;
run.android.batteryTemperature =
result[resultIndex].android.batteryTemperature[runIndex];
}
run.timestamp = dayjs(
result[resultIndex].timestamps[runIndex]
).format(TIME_FORMAT);

View File

@ -168,36 +168,10 @@ class HTMLBuilder {
coach: coachData
};
const summaryRenders = Object.keys(this.summary).map(name =>
this._renderSummaryPage(
name,
merge(
{
options,
noPages: dataCollector.getURLs().length,
css,
h: helpers,
rootPath: '',
assetsPath: assetsBaseURL || '',
menu: name,
pageTitle: name,
pageDescription: '',
headers: this.summary,
version: packageInfo.version,
timestamp: this.timestamp,
context: this.context,
get,
friendlyNames,
html: {
pageSummaryMetrics: toArray(options.html.pageSummaryMetrics)
}
},
dataCollector.getSummary(name),
this.summary[name]
)
)
);
let browser;
let android;
let usingBrowsertime;
let usingWebPageTest;
const urlPageRenders = [];
let pageNumber = 0;
const testedPages = Object.keys(validPages).length;
@ -210,8 +184,11 @@ class HTMLBuilder {
const harIndex = pageNumber + (medianRun.runIndex - 1) * testedPages;
let summaryPageHAR = get(pageInfo, 'data.browsertime.har');
pageNumber++;
// In the future we can fix so we just pickup the setup messages
usingBrowsertime = pageInfo.data.browsertime;
usingWebPageTest = pageInfo.data.webpagetest;
// if we don't use Browsertime, we don't get the browser version
const browser = summaryPageHAR
browser = summaryPageHAR
? {
name: summaryPageHAR.log.browser.name,
version: summaryPageHAR.log.browser.version
@ -220,6 +197,8 @@ class HTMLBuilder {
name: '',
version: ''
};
android = get(pageInfo, 'data.browsertime.pageSummary.info.android');
// if we are on the summary page we inline the HAR and then make sure
// we only pick one HAR run (medianRun). But you can also choose to
// fetch the HAR in the HTML, then it isn't included.
@ -278,6 +257,7 @@ class HTMLBuilder {
summaryPageHAR,
medianRun,
browser,
android,
hasScreenShots: dataCollector.browsertimeScreenshots,
screenShotType: dataCollector.browsertimeScreenshotsType,
css,
@ -344,6 +324,7 @@ class HTMLBuilder {
options,
runPages,
browser,
android,
hasScreenShots: dataCollector.browsertimeScreenshots,
screenShotType: dataCollector.browsertimeScreenshotsType,
css,
@ -378,6 +359,41 @@ class HTMLBuilder {
}
}
// do this late so we can pickup data (browser/android etc)
const summaryRenders = Object.keys(this.summary).map(name =>
this._renderSummaryPage(
name,
merge(
{
options,
noPages: dataCollector.getURLs().length,
css,
h: helpers,
rootPath: '',
assetsPath: assetsBaseURL || '',
menu: name,
pageTitle: name,
pageDescription: '',
browser,
android,
usingBrowsertime,
usingWebPageTest,
headers: this.summary,
version: packageInfo.version,
timestamp: this.timestamp,
context: this.context,
get,
friendlyNames,
html: {
pageSummaryMetrics: toArray(options.html.pageSummaryMetrics)
}
},
dataCollector.getSummary(name),
this.summary[name]
)
)
);
let res;
if (this.options.html.assetsBaseURL) {
res = Promise.resolve();

View File

@ -3,27 +3,27 @@ include _tableMixins
block content
include runInfo
.responsive
table(data-sortable, id='detailed')
thead
.responsive
table(data-sortable, id='detailed')
thead
tr
th name
th min
th median
th mean
th p90
th max
each metric in metrics
if metric.node && metric.node.min
tr
th name
th min
th median
th mean
th p90
th max
each metric in metrics
if metric.node && metric.node.min
tr
td(data-title='Metric', data-value=metric.name)
if (metric.metricName)
- url = 'help.html#' + metric.metricName
a(href=url) #{metric.name}
else
| #{metric.name}
td(data-title='min', data-value=metric.node.min) #{metric.h(metric.node.min)}
td(data-title='median', data-value=metric.node.median) #{metric.h(metric.node.median)}
td(data-title='mean', data-value=metric.node.mean) #{metric.h(metric.node.mean)}
td(data-title='p90', data-value=metric.node.p90) #{metric.h(metric.node.p90)}
td(data-title='max', data-value=metric.node.max) #{metric.h(metric.node.max)}
td(data-title='Metric', data-value=metric.name)
if (metric.metricName)
- url = 'help.html#' + metric.metricName
a(href=url) #{metric.name}
else
| #{metric.name}
td(data-title='min', data-value=metric.node.min) #{metric.h(metric.node.min)}
td(data-title='median', data-value=metric.node.median) #{metric.h(metric.node.median)}
td(data-title='mean', data-value=metric.node.mean) #{metric.h(metric.node.mean)}
td(data-title='p90', data-value=metric.node.p90) #{metric.h(metric.node.p90)}
td(data-title='max', data-value=metric.node.max) #{metric.h(metric.node.max)}

View File

@ -1,17 +1,26 @@
h2.url #{h.plural(noPages,'page')} analysed for #{options.name ? options.name : h.short(context.name, 30)}
- const profile = options.mobile ? 'mobile' : 'desktop'
- const connectivity = options.browsertime.connectivity.alias || options.browsertime.connectivity.profile
h2.url #{h.plural(noPages,'page')} analysed for #{options.name ? options.name : h.short(context.name, 30)}
p.small Tested #{timestamp} using #{h.cap(options.browsertime.browser)} for
| #{ h.get(options, 'browsertime.chrome.android.package') ? h.get(options, 'browsertime.chrome.android.package') + ' ': ''}
| #{options.preURL ? 'preURL ' + h.short(options.preURL, 60) + ' ' : ''}
| #{h.plural(options.browsertime.iterations, 'run')} with #{profile} profile and connectivity #{connectivity}.#{ options.replay ? ' Using WebPageReplay.' : ''}#{ options.multi ? ' Using multi mode.' : ''}
| #{options.chrome && options.chrome.CPUThrottlingRate ? ' CPU Throttle Rate ' + options.chrome.CPUThrottlingRate + '.':''}
if usingBrowsertime
- const profile = options.mobile ? 'mobile' : 'desktop'
- const connectivity = options.browsertime.connectivity.alias || options.browsertime.connectivity.profile
- const browserName = h.get(browser,'name');
- const browserVersion = h.get(browser,'version');
- const androidModel = h.get(android,'model');
- const androidVersion = h.get(android,'androidVersion');
p.small Tested #{timestamp} using #{h.cap(browserName || options.browsertime.browser)} #{browserVersion}
if (androidModel)
|  #{androidModel} (Android version #{androidVersion})
| .
if (options.safari && options.safari.deviceType)
| Testing using an #{options.safari.deviceType}.
| #{options.preURL ? ' preURL ' + h.short(options.preURL, 60) + ' ' : ''}
| #{h.plural(options.browsertime.iterations, 'run')} with #{profile} profile and connectivity #{connectivity}.#{ options.replay ? ' Using WebPageReplay.' : ''}#{ options.multi ? ' Using multi mode.' : ''}
| #{options.chrome && options.chrome.CPUThrottlingRate ? ' CPU Throttle Rate ' + options.chrome.CPUThrottlingRate + '.':''}
if options.multi && options.html.showScript
| (
a(href= rootPath + 'scripts.html')= 'script'
| ).
else if options.multi
| .
else if usingWebPageTest
p.small Tested #{timestamp} using WebPageTest #{options.webpagetest.location} using connectivity #{options.webpagetest.connectivity} for #{h.plural(options.webpagetest.runs, 'run')}.

View File

@ -1,16 +1,29 @@
- const profile = options.mobile ? 'mobile' : 'desktop'
- const runTime = h.get(pageInfo, 'pageInfo.data.browsertime.run.timestamp', timestamp)
- const connectivity = options.browsertime.connectivity.alias || options.browsertime.connectivity.profile
p.small Tested #{runTime} using #{h.cap(options.browsertime.browser)} #{browser.version} for
| #{ h.get(options, 'browsertime.chrome.android.package') ? ' ' + h.get(options, 'browsertime.chrome.android.package') + ' ': ''}
| #{options.preURL ? 'preURL ' + h.short(options.preURL, 60) + ' ': ''}
| #{h.plural(options.browsertime.iterations, 'run')} with #{profile} profile and connectivity #{connectivity}.#{ options.replay ? ' Using WebPageReplay.' : ''}#{ options.multi ? ' Using multi mode.' : ''}
| #{options.chrome && options.chrome.CPUThrottlingRate ? ' CPU Throttle Rate ' + options.chrome.CPUThrottlingRate + '.':''}
if (options.safari && options.safari.deviceType)
| Testing using an #{options.safari.deviceType}.
if options.multi && options.html.showScript
| (
a(href= rootPath + 'scripts.html')= 'script'
| ).
else if options.multi
if pageInfo.data.browsertime
- const profile = options.mobile ? 'mobile' : 'desktop'
- const runTime = h.get(pageInfo, 'pageInfo.data.browsertime.run.timestamp', timestamp)
- const android = pageInfo.data.browsertime.run ? pageInfo.data.browsertime.run.android : pageInfo.data.browsertime.pageSummary.info.android
- const browserName = h.get(browser,'name');
- const browserVersion = h.get(browser,'version','');
- const androidModel = h.get(android,'model','');
- const androidVersion = h.get(android,'androidVersion','');
- const connectivity = options.browsertime.connectivity.alias || options.browsertime.connectivity.profile
p.small Tested #{runTime} using #{h.cap(browserName || options.browsertime.browser)} #{browser.version}
if (androidModel)
|  #{androidModel} (Android version #{androidVersion})
if pageInfo.data.browsertime && pageInfo.data.browsertime.run && pageInfo.data.browsertime.run.android
|  with battery temperature #{pageInfo.data.browsertime.run.android.batteryTemperature.start}℃
| .
if (options.safari && options.safari.deviceType)
| Testing using an #{options.safari.deviceType}.
| #{options.preURL ? ' preURL ' + h.short(options.preURL, 60) + ' ': ''}
| #{h.plural(options.browsertime.iterations, 'run')} with #{profile} profile and connectivity #{connectivity}.#{ options.replay ? ' Using WebPageReplay.' : ''}#{ options.multi ? ' Using multi mode.' : ''}
| #{options.chrome && options.chrome.CPUThrottlingRate ? ' CPU Throttle Rate ' + options.chrome.CPUThrottlingRate + '.':''}
if options.multi && options.html.showScript
| (
a(href= rootPath + 'scripts.html')= 'script'
| ).
else if options.multi
| .
else if pageInfo.data.webpagetest
p.small Tested #{timestamp} using WebPageTest #{options.webpagetest.location} using connectivity #{options.webpagetest.connectivity} for #{h.plural(options.webpagetest.runs, 'run')}.

View File

@ -52,6 +52,8 @@ module.exports = {
}
if (
data.data.median &&
data.data.median.firstView &&
data.data.median.firstView.numSteps &&
data.data.median.firstView.numSteps > 1
) {