[go: nahoru, domu]

Skip to content

Commit

Permalink
report: add link to docs on performance scoring (#9355)
Browse files Browse the repository at this point in the history
  • Loading branch information
brendankenny committed Jul 20, 2019
1 parent 7818c8a commit 8eb0cde
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 24 deletions.
8 changes: 4 additions & 4 deletions lighthouse-cli/test/cli/__snapshots__/index-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1079,11 +1079,11 @@ Object {
"title": "Budgets",
},
"diagnostics": Object {
"description": "More information about the performance of your application.",
"description": "More information about the performance of your application. These numbers don't [directly affect](https://github.com/GoogleChrome/lighthouse/blob/d2ec9ffbb21de9ad1a0f86ed24575eda32c796f0/docs/scoring.md#how-are-the-scores-weighted) the Performance score.",
"title": "Diagnostics",
},
"load-opportunities": Object {
"description": "These optimizations can speed up your page load.",
"description": "These suggestions can help your page load faster. They don't [directly affect](https://github.com/GoogleChrome/lighthouse/blob/d2ec9ffbb21de9ad1a0f86ed24575eda32c796f0/docs/scoring.md#how-are-the-scores-weighted) the Performance score.",
"title": "Opportunities",
},
"metrics": Object {
Expand Down Expand Up @@ -1326,11 +1326,11 @@ Object {
"title": "Budgets",
},
"diagnostics": Object {
"description": "More information about the performance of your application.",
"description": "More information about the performance of your application. These numbers don't [directly affect](https://github.com/GoogleChrome/lighthouse/blob/d2ec9ffbb21de9ad1a0f86ed24575eda32c796f0/docs/scoring.md#how-are-the-scores-weighted) the Performance score.",
"title": "Diagnostics",
},
"load-opportunities": Object {
"description": "These optimizations can speed up your page load.",
"description": "These suggestions can help your page load faster. They don't [directly affect](https://github.com/GoogleChrome/lighthouse/blob/d2ec9ffbb21de9ad1a0f86ed24575eda32c796f0/docs/scoring.md#how-are-the-scores-weighted) the Performance score.",
"title": "Opportunities",
},
"metrics": Object {
Expand Down
8 changes: 4 additions & 4 deletions lighthouse-core/config/default-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const UIStrings = {
metricGroupTitle: 'Metrics',
/** Title of the opportunity section of the Performance category. Within this section are audits with imperative titles that suggest actions the user can take to improve the loading performance of their web page. 'Suggestion'/'Optimization'/'Recommendation' are reasonable synonyms for 'opportunity' in this case. */
loadOpportunitiesGroupTitle: 'Opportunities',
/** Description of the opportunity section of the Performance category. 'Optimizations' could also be 'recommendations' or 'suggestions'. Within this section are audits with imperative titles that suggest actions the user can take to improve the loading performance of their web page. */
loadOpportunitiesGroupDescription: 'These optimizations can speed up your page load.',
/** Description of the opportunity section of the Performance category. 'Suggestions' could also be 'recommendations'. Within this section are audits with imperative titles that suggest actions the user can take to improve the loading performance of their web page. */
loadOpportunitiesGroupDescription: 'These suggestions can help your page load faster. They don\'t [directly affect](https://github.com/GoogleChrome/lighthouse/blob/d2ec9ffbb21de9ad1a0f86ed24575eda32c796f0/docs/scoring.md#how-are-the-scores-weighted) the Performance score.',
/** Title of an opportunity sub-section of the Performance category. Within this section are audits with imperative titles that suggest actions the user can take to improve the time of the first initial render of the webpage. */
firstPaintImprovementsGroupTitle: 'First Paint Improvements',
/** Description of an opportunity sub-section of the Performance category. Within this section are audits with imperative titles that suggest actions the user can take to improve the time of the first initial render of the webpage. */
Expand All @@ -33,8 +33,8 @@ const UIStrings = {
overallImprovementsGroupDescription: 'Enhance the overall loading experience, so the page is responsive and ready to use as soon as possible. Key metrics: Time to Interactive, Speed Index',
/** Title of the diagnostics section of the Performance category. Within this section are audits with non-imperative titles that provide more detail on the page's page load performance characteristics. Whereas the 'Opportunities' suggest an action along with expected time savings, diagnostics do not. Within this section, the user may read the details and deduce additional actions they could take. */
diagnosticsGroupTitle: 'Diagnostics',
/** Description of the diagnostics section of the Performance category. Within this section are audits with non-imperative titles that provide more detail on the page's page load performance characteristics. Whereas the 'Opportunities' suggest an action along with expected time savings, diagnostics do not. Within this section, the user may read the details and deduce additional actions they could take. */
diagnosticsGroupDescription: 'More information about the performance of your application.',
/** Description of the diagnostics section of the Performance category. Within this section are audits with non-imperative titles that provide more detail on a web page's load performance characteristics. Within this section, the user may read the details and deduce additional actions they could take to improve performance. */
diagnosticsGroupDescription: 'More information about the performance of your application. These numbers don\'t [directly affect](https://github.com/GoogleChrome/lighthouse/blob/d2ec9ffbb21de9ad1a0f86ed24575eda32c796f0/docs/scoring.md#how-are-the-scores-weighted) the Performance score.',
/** Title of the Accessibility category of audits. This section contains audits focused on making web content accessible to all users. Also used as a label of a score gauge; try to limit to 20 characters. */
a11yCategoryTitle: 'Accessibility',
/** Description of the Accessibility category. This is displayed at the top of a list of audits focused on making web content accessible to all users. No character length limits. 'improve the accessibility of your web app' becomes link text to additional documentation. */
Expand Down
10 changes: 5 additions & 5 deletions lighthouse-core/lib/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -1476,8 +1476,8 @@
"description": "Title of the Budgets section of the Performance Category. 'Budgets' refers to a budget (like a financial budget), but applied to the amount of resources on a page, rather than money."
},
"lighthouse-core/config/default-config.js | diagnosticsGroupDescription": {
"message": "More information about the performance of your application.",
"description": "Description of the diagnostics section of the Performance category. Within this section are audits with non-imperative titles that provide more detail on the page's page load performance characteristics. Whereas the 'Opportunities' suggest an action along with expected time savings, diagnostics do not. Within this section, the user may read the details and deduce additional actions they could take."
"message": "More information about the performance of your application. These numbers don't [directly affect](https://github.com/GoogleChrome/lighthouse/blob/d2ec9ffbb21de9ad1a0f86ed24575eda32c796f0/docs/scoring.md#how-are-the-scores-weighted) the Performance score.",
"description": "Description of the diagnostics section of the Performance category. Within this section are audits with non-imperative titles that provide more detail on a web page's load performance characteristics. Within this section, the user may read the details and deduce additional actions they could take to improve performance."
},
"lighthouse-core/config/default-config.js | diagnosticsGroupTitle": {
"message": "Diagnostics",
Expand All @@ -1492,8 +1492,8 @@
"description": "Title of an opportunity sub-section of the Performance category. Within this section are audits with imperative titles that suggest actions the user can take to improve the time of the first initial render of the webpage."
},
"lighthouse-core/config/default-config.js | loadOpportunitiesGroupDescription": {
"message": "These optimizations can speed up your page load.",
"description": "Description of the opportunity section of the Performance category. 'Optimizations' could also be 'recommendations' or 'suggestions'. Within this section are audits with imperative titles that suggest actions the user can take to improve the loading performance of their web page."
"message": "These suggestions can help your page load faster. They don't [directly affect](https://github.com/GoogleChrome/lighthouse/blob/d2ec9ffbb21de9ad1a0f86ed24575eda32c796f0/docs/scoring.md#how-are-the-scores-weighted) the Performance score.",
"description": "Description of the opportunity section of the Performance category. 'Suggestions' could also be 'recommendations'. Within this section are audits with imperative titles that suggest actions the user can take to improve the loading performance of their web page."
},
"lighthouse-core/config/default-config.js | loadOpportunitiesGroupTitle": {
"message": "Opportunities",
Expand Down Expand Up @@ -1788,7 +1788,7 @@
"description": "Label shown preceding any important warnings that may have invalidated the entire report. For example, if the user has Chrome extensions installed, they may add enough performance overhead that Lighthouse's performance metrics are unreliable. If shown, this will be displayed at the top of the report UI."
},
"lighthouse-core/report/html/renderer/util.js | varianceDisclaimer": {
"message": "Values are estimated and may vary.",
"message": "Values are estimated and may vary. The performance score is [based only on these metrics](https://github.com/GoogleChrome/lighthouse/blob/d2ec9ffbb21de9ad1a0f86ed24575eda32c796f0/docs/scoring.md#how-are-the-scores-weighted).",
"description": "Disclaimer shown to users below the metric values (First Contentful Paint, Time to Interactive, etc) to warn them that the numbers they see will likely change slightly the next time they run Lighthouse."
},
"lighthouse-core/report/html/renderer/util.js | warningAuditsGroupTitle": {
Expand Down
6 changes: 3 additions & 3 deletions lighthouse-core/lib/i18n/locales/en-XL.json
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,7 @@
"message": "B̂úd̂ǵêt́ŝ"
},
"lighthouse-core/config/default-config.js | diagnosticsGroupDescription": {
"message": "M̂ór̂é îńf̂ór̂ḿât́îón̂ áb̂óût́ t̂h́ê ṕêŕf̂ór̂ḿâńĉé ôf́ ŷóûŕ âṕp̂ĺîćât́îón̂."
"message": "M̂ór̂é îńf̂ór̂ḿât́îón̂ áb̂óût́ t̂h́ê ṕêŕf̂ór̂ḿâńĉé ôf́ ŷóûŕ âṕp̂ĺîćât́îón̂. T́ĥéŝé n̂úm̂b́êŕŝ d́ôń't̂ [d́îŕêćt̂ĺŷ áf̂f́êćt̂](h́t̂t́p̂ś://ĝít̂h́ûb́.ĉóm̂/ǴôóĝĺêĆĥŕôḿê/ĺîǵĥt́ĥóûśê/b́l̂ób̂/d́2êć9f̂f́b̂b́21d̂é9âd́1â0f́86êd́24575êd́â32ć796f̂0/d́ôćŝ/śĉór̂ín̂ǵ.m̂d́#ĥóŵ-ár̂é-t̂h́ê-śĉór̂éŝ-ẃêíĝh́t̂éd̂) t́ĥé P̂ér̂f́ôŕm̂án̂ćê śĉór̂é."
},
"lighthouse-core/config/default-config.js | diagnosticsGroupTitle": {
"message": "D̂íâǵn̂óŝt́îćŝ"
Expand All @@ -1119,7 +1119,7 @@
"message": "F̂ír̂śt̂ Ṕâín̂t́ Îḿp̂ŕôv́êḿêńt̂ś"
},
"lighthouse-core/config/default-config.js | loadOpportunitiesGroupDescription": {
"message": "T̂h́êśê óp̂t́îḿîźât́îón̂ś ĉán̂ śp̂éêd́ ûṕ ŷóûŕ p̂áĝé l̂óâd́."
"message": "T̂h́êśê śûǵĝéŝt́îón̂ś ĉán̂ h́êĺp̂ ýôúr̂ ṕâǵê ĺôád̂ f́âśt̂ér̂. T́ĥéŷ d́ôń't̂ [d́îŕêćt̂ĺŷ áf̂f́êćt̂](h́t̂t́p̂ś://ĝít̂h́ûb́.ĉóm̂/ǴôóĝĺêĆĥŕôḿê/ĺîǵĥt́ĥóûśê/b́l̂ób̂/d́2êć9f̂f́b̂b́21d̂é9âd́1â0f́86êd́24575êd́â32ć796f̂0/d́ôćŝ/śĉór̂ín̂ǵ.m̂d́#ĥóŵ-ár̂é-t̂h́ê-śĉór̂éŝ-ẃêíĝh́t̂éd̂) t́ĥé P̂ér̂f́ôŕm̂án̂ćê śĉór̂é."
},
"lighthouse-core/config/default-config.js | loadOpportunitiesGroupTitle": {
"message": "Ôṕp̂ór̂t́ûńît́îéŝ"
Expand Down Expand Up @@ -1341,7 +1341,7 @@
"message": "T̂h́êŕê ẃêŕê íŝśûéŝ áf̂f́êćt̂ín̂ǵ t̂h́îś r̂ún̂ óf̂ Ĺîǵĥt́ĥóûśê:"
},
"lighthouse-core/report/html/renderer/util.js | varianceDisclaimer": {
"message": "V̂ál̂úêś âŕê éŝt́îḿât́êd́ âńd̂ ḿâý v̂ár̂ý."
"message": "V̂ál̂úêś âŕê éŝt́îḿât́êd́ âńd̂ ḿâý v̂ár̂ý. T̂h́ê ṕêŕf̂ór̂ḿâńĉé ŝćôŕê íŝ [b́âśêd́ ôńl̂ý ôń t̂h́êśê ḿêt́r̂íĉś](ĥt́t̂ṕŝ://ǵît́ĥúb̂.ćôḿ/Ĝóôǵl̂éĈh́r̂óm̂é/l̂íĝh́t̂h́ôúŝé/b̂ĺôb́/d̂2éĉ9f́f̂b́b̂21d́ê9ád̂1á0f̂86éd̂24575éd̂á32ĉ796f́0/d̂óĉś/ŝćôŕîńĝ.ḿd̂#h́ôẃ-âŕê-t́ĥé-ŝćôŕêś-ŵéîǵĥt́êd́)."
},
"lighthouse-core/report/html/renderer/util.js | warningAuditsGroupTitle": {
"message": "P̂áŝśêd́ âúd̂ít̂ś b̂út̂ ẃît́ĥ ẃâŕn̂ín̂ǵŝ"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ class PerformanceCategoryRenderer extends CategoryRenderer {
// 'Values are estimated and may vary' is used as the category description for PSI
if (environment !== 'PSI') {
const estValuesEl = this.dom.createChildOf(metricAuditsEl, 'div', 'lh-metrics__disclaimer');
estValuesEl.textContent = Util.UIStrings.varianceDisclaimer;
const disclaimerEl = this.dom.convertMarkdownLinkSnippets(Util.UIStrings.varianceDisclaimer);
estValuesEl.appendChild(disclaimerEl);
}

metricAuditsEl.classList.add('lh-audit-group--metrics');
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/report/html/renderer/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ Util.numberDateLocale = 'en';
*/
Util.UIStrings = {
/** Disclaimer shown to users below the metric values (First Contentful Paint, Time to Interactive, etc) to warn them that the numbers they see will likely change slightly the next time they run Lighthouse. */
varianceDisclaimer: 'Values are estimated and may vary.',
varianceDisclaimer: 'Values are estimated and may vary. The performance score is [based only on these metrics](https://github.com/GoogleChrome/lighthouse/blob/d2ec9ffbb21de9ad1a0f86ed24575eda32c796f0/docs/scoring.md#how-are-the-scores-weighted).',
/** Column heading label for the listing of opportunity audits. Each audit title represents an opportunity. There are only 2 columns, so no strict character limit. */
opportunityResourceColumnLabel: 'Opportunity',
/** Column heading label for the estimated page load savings of opportunity audits. Estimated Savings is the total amount of time (in seconds) that Lighthouse computed could be reduced from the total page load time, if the suggested action is taken. There are only 2 columns, so no strict character limit. */
Expand Down
4 changes: 4 additions & 0 deletions lighthouse-core/report/html/report-styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
--color-gray-50: #FAFAFA;
--color-gray-500: #9E9E9E;
--color-gray-600: #757575;
--color-gray-700: #616161;
--color-gray-800: #424242;
--color-gray-900: #212121;
--color-gray: #000000;
Expand Down Expand Up @@ -593,6 +594,9 @@
color: var(--color-gray-600);
margin: var(--section-padding-vertical) 0;
}
.lh-metrics__disclaimer a {
color: var(--color-gray-700);
}

.lh-metric__description {
display: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,18 @@ describe('PerfCategoryRenderer', () => {
assert.equal(timelineElements.length + nontimelineElements.length, metricAudits.length);
});

it('renders the metrics variance disclaimer as markdown', () => {
const categoryDOM = renderer.render(category, sampleResults.categoryGroups);
const disclaimerEl =
categoryDOM.querySelector('.lh-audit-group--metrics > .lh-metrics__disclaimer');

assert.ok(disclaimerEl.textContent.includes('Values are estimated'));
const disclamerLink = disclaimerEl.querySelector('a');
assert.ok(disclamerLink, 'disclaimer contains coverted markdown link');
const disclamerUrl = new URL(disclamerLink.href);
assert.strictEqual(disclamerUrl.hostname, 'github.com');
});

it('renders the failing performance opportunities', () => {
const categoryDOM = renderer.render(category, sampleResults.categoryGroups);

Expand Down
6 changes: 3 additions & 3 deletions lighthouse-core/test/results/sample_v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -4047,15 +4047,15 @@
},
"load-opportunities": {
"title": "Opportunities",
"description": "These optimizations can speed up your page load."
"description": "These suggestions can help your page load faster. They don't [directly affect](https://github.com/GoogleChrome/lighthouse/blob/d2ec9ffbb21de9ad1a0f86ed24575eda32c796f0/docs/scoring.md#how-are-the-scores-weighted) the Performance score."
},
"budgets": {
"title": "Budgets",
"description": "Performance budgets set standards for the performance of your site."
},
"diagnostics": {
"title": "Diagnostics",
"description": "More information about the performance of your application."
"description": "More information about the performance of your application. These numbers don't [directly affect](https://github.com/GoogleChrome/lighthouse/blob/d2ec9ffbb21de9ad1a0f86ed24575eda32c796f0/docs/scoring.md#how-are-the-scores-weighted) the Performance score."
},
"pwa-fast-reliable": {
"title": "Fast and reliable"
Expand Down Expand Up @@ -5112,7 +5112,7 @@
"snippetExpandButtonLabel": "Expand snippet",
"thirdPartyResourcesLabel": "Show 3rd-party resources",
"toplevelWarningsMessage": "There were issues affecting this run of Lighthouse:",
"varianceDisclaimer": "Values are estimated and may vary.",
"varianceDisclaimer": "Values are estimated and may vary. The performance score is [based only on these metrics](https://github.com/GoogleChrome/lighthouse/blob/d2ec9ffbb21de9ad1a0f86ed24575eda32c796f0/docs/scoring.md#how-are-the-scores-weighted).",
"warningAuditsGroupTitle": "Passed audits but with warnings",
"warningHeader": "Warnings: "
},
Expand Down
6 changes: 3 additions & 3 deletions proto/sample_v2_round_trip.json
Original file line number Diff line number Diff line change
Expand Up @@ -3914,11 +3914,11 @@
"title": "Budgets"
},
"diagnostics": {
"description": "More information about the performance of your application.",
"description": "More information about the performance of your application. These numbers don't [directly affect](https://github.com/GoogleChrome/lighthouse/blob/d2ec9ffbb21de9ad1a0f86ed24575eda32c796f0/docs/scoring.md#how-are-the-scores-weighted) the Performance score.",
"title": "Diagnostics"
},
"load-opportunities": {
"description": "These optimizations can speed up your page load.",
"description": "These suggestions can help your page load faster. They don't [directly affect](https://github.com/GoogleChrome/lighthouse/blob/d2ec9ffbb21de9ad1a0f86ed24575eda32c796f0/docs/scoring.md#how-are-the-scores-weighted) the Performance score.",
"title": "Opportunities"
},
"metrics": {
Expand Down Expand Up @@ -3976,7 +3976,7 @@
"snippetExpandButtonLabel": "Expand snippet",
"thirdPartyResourcesLabel": "Show 3rd-party resources",
"toplevelWarningsMessage": "There were issues affecting this run of Lighthouse:",
"varianceDisclaimer": "Values are estimated and may vary.",
"varianceDisclaimer": "Values are estimated and may vary. The performance score is [based only on these metrics](https://github.com/GoogleChrome/lighthouse/blob/d2ec9ffbb21de9ad1a0f86ed24575eda32c796f0/docs/scoring.md#how-are-the-scores-weighted).",
"warningAuditsGroupTitle": "Passed audits but with warnings",
"warningHeader": "Warnings: "
}
Expand Down

0 comments on commit 8eb0cde

Please sign in to comment.