Skip to content
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(psi): add lab data summary sentence #5961

Merged
merged 2 commits into from
Sep 5, 2018
Merged

report(psi): add lab data summary sentence #5961

merged 2 commits into from
Sep 5, 2018

Conversation

brendankenny
Copy link
Member

fixes #5882

@@ -57,7 +65,8 @@ function prepareLabData(LHResultJsonString, document) {
scoreGaugeWrapperEl.removeAttribute('href');

const finalScreenshotDataUri = _getFinalScreenshot(perfCategory);
return {scoreGaugeEl, perfCategoryEl, finalScreenshotDataUri};
const psiDescription = lhResult.i18n.rendererFormattedStrings.psiDescription;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead, let's just provide this in the right spot so they dont have to.

here, el is the perfCategoryEl:
image

i was writing this but maybe you want to do it differently:

const descriptionText = lhResult.i18n.rendererFormattedStrings.psiDescription;
const descriptionEl = dom.convertMarkdownLinkSnippets(descriptionText);
const catDescriptionEl = dom.find('.lh-category-header__description', perfCategoryEl);
catDescriptionEl.appendChild(descriptionEl);

@@ -481,6 +481,9 @@ Util.UIStrings = {
crcInitialNavigation: 'Initial Navigation',
/** Label of value shown in the summary of critical request chains. Refers to the total amount of time (milliseconds) of the longest critical path chain/sequence of network requests. Example value: 2310 ms */
crcLongestDurationLabel: 'Maximum critical path latency:',

/** Explanation shown to users below performance results to inform them that the test was done with a 3G network connection and to warn them that the numbers they see will likely change slightly the next time they run Lighthouse. 'Lighthouse' becomes link text to additional documentation. */
psiDescription: '[Lighthouse](https://developers.google.com/web/tools/lighthouse/) analysis of the current page on emulated 3G. Values are estimated and may vary.',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

naming tweak: lsPerformanceCategoryDescription .. more inline with the ones we have in default-config.js

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -57,7 +65,8 @@ function prepareLabData(LHResultJsonString, document) {
scoreGaugeWrapperEl.removeAttribute('href');

const finalScreenshotDataUri = _getFinalScreenshot(perfCategory);
return {scoreGaugeEl, perfCategoryEl, finalScreenshotDataUri};
const psiDescription = lhResult.i18n.rendererFormattedStrings.psiDescription;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and we gotta do the markdown conversion :)

@brendankenny
Copy link
Member Author

updated. Now uses the metrics title/description to include these custom strings since that's where we actually want them.


// Description supports markdown links, so take everything after the last link.
const descriptionEnd = /[^)]+$/.exec(Util.UIStrings.lsPerformanceCategoryDescription)[0];
assert.ok(descriptionEnd.length > 6); // If this gets too short, pick a different comparison :)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a little silly, but difficult to test it isn't accidentally using a default description (if we ever add one to metrics) and support i18n otherwise :)

(could just create a local version of dom using jsdom, I suppose)

@paulirish
Copy link
Member

looks ace. 🅰️

@paulirish paulirish merged commit 98b1e61 into master Sep 5, 2018
@paulirish paulirish deleted the psisummary branch September 5, 2018 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Include lab data summary sentence in prepareLabData
2 participants