-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
report: screen emulation and dpr in meta tooltip #14515
Changes from all commits
8cf2588
266e06b
a7cf2d4
47c1fb0
4cd1db2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,8 +119,6 @@ export class ReportRenderer { | |
*/ | ||
_renderMetaBlock(report, footer) { | ||
const envValues = Util.getEmulationDescriptions(report.configSettings || {}); | ||
|
||
|
||
const match = report.userAgent.match(/(\w*Chrome\/[\d.]+)/); // \w* to include 'HeadlessChrome' | ||
const chromeVer = Array.isArray(match) | ||
? match[1].replace('/', ' ').replace('Chrome', 'Chromium') | ||
|
@@ -129,15 +127,25 @@ export class ReportRenderer { | |
const benchmarkIndex = report.environment.benchmarkIndex.toFixed(0); | ||
const axeVersion = report.environment.credits?.['axe-core']; | ||
|
||
const devicesTooltipTextLines = [ | ||
`${Util.i18n.strings.runtimeSettingsBenchmark}: ${benchmarkIndex}`, | ||
`${Util.i18n.strings.runtimeSettingsCPUThrottling}: ${envValues.cpuThrottling}`, | ||
]; | ||
if (envValues.screenEmulation) { | ||
devicesTooltipTextLines.push( | ||
`${Util.i18n.strings.runtimeSettingsScreenEmulation}: ${envValues.screenEmulation}`); | ||
} | ||
if (axeVersion) { | ||
devicesTooltipTextLines.push(`${Util.i18n.strings.runtimeSettingsAxeVersion}: ${axeVersion}`); | ||
} | ||
|
||
// [CSS icon class, textContent, tooltipText] | ||
const metaItems = [ | ||
['date', | ||
`Captured at ${Util.i18n.formatDateTime(report.fetchTime)}`], | ||
['devices', | ||
`${envValues.deviceEmulation} with Lighthouse ${report.lighthouseVersion}`, | ||
`${Util.i18n.strings.runtimeSettingsBenchmark}: ${benchmarkIndex}` + | ||
`\n${Util.i18n.strings.runtimeSettingsCPUThrottling}: ${envValues.cpuThrottling}` + | ||
(axeVersion ? `\n${Util.i18n.strings.runtimeSettingsAxeVersion}: ${axeVersion}` : '')], | ||
devicesTooltipTextLines.join('\n')], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. minor refactor for readability. |
||
['samples-one', | ||
Util.i18n.strings.runtimeSingleLoad, | ||
Util.i18n.strings.runtimeSingleLoadTooltip], | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -466,7 +466,7 @@ class Util { | |
|
||
/** | ||
* @param {LH.Result['configSettings']} settings | ||
* @return {!{deviceEmulation: string, networkThrottling: string, cpuThrottling: string, summary: string}} | ||
* @return {!{deviceEmulation: string, screenEmulation?: string, networkThrottling: string, cpuThrottling: string, summary: string}} | ||
*/ | ||
static getEmulationDescriptions(settings) { | ||
let cpuThrottling; | ||
|
@@ -512,14 +512,19 @@ class Util { | |
summary = cpuThrottling = networkThrottling = Util.i18n.strings.runtimeUnknown; | ||
} | ||
|
||
// TODO(paulirish): revise Runtime Settings strings: https://github.com/GoogleChrome/lighthouse/pull/11796 | ||
const deviceEmulation = { | ||
mobile: Util.i18n.strings.runtimeMobileEmulation, | ||
desktop: Util.i18n.strings.runtimeDesktopEmulation, | ||
}[settings.formFactor] || Util.i18n.strings.runtimeNoEmulation; | ||
|
||
const screenEmulation = settings.screenEmulation.disabled ? | ||
undefined : | ||
// eslint-disable-next-line max-len | ||
`${settings.screenEmulation.width}x${settings.screenEmulation.height}, DPR ${settings.screenEmulation.deviceScaleFactor}`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Continuing our tradition of not properly localizing these strings. |
||
|
||
return { | ||
deviceEmulation, | ||
screenEmulation, | ||
cpuThrottling, | ||
networkThrottling, | ||
summary, | ||
|
@@ -717,6 +722,8 @@ const UIStrings = { | |
runtimeSettingsBenchmark: 'CPU/Memory Power', | ||
/** Label for a row in a table that shows the version of the Axe library used. Example row values: 2.1.0, 3.2.3 */ | ||
runtimeSettingsAxeVersion: 'Axe version', | ||
/** Label for a row in a table that shows the screen resolution and DPR that was emulated for the Lighthouse run. Example values: '800x600, DPR: 3' */ | ||
runtimeSettingsScreenEmulation: 'Screen emulation', | ||
|
||
/** Label for button to create an issue against the Lighthouse GitHub project. */ | ||
footerIssue: 'File an issue', | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dead task