-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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: New audit clump for audits with warnings (#5327) #6989
report: New audit clump for audits with warnings (#5327) #6989
Conversation
We'll need a new icon. Ideas? |
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.
My comments below were based on my assumption going in that this was going to be a new clump for any passed audits that have a warning, but after going through the whole thing I realized you were (maybe?) intending to put any audit with a warning in the new clump. We should figure out which one we want to do before proceeding :)
@@ -264,6 +265,10 @@ class CategoryRenderer { | |||
const clumpTmpl = this.dom.cloneTemplate('#tmpl-lh-clump', this.templateContext); | |||
const clumpElement = this.dom.find('.lh-clump', clumpTmpl); | |||
|
|||
if (clumpId === 'warning') { |
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.
do we want it to be an open <details>
or do we want it to be like failed audits and use renderUnexpandableClump
? It seems like it should maybe operate like failed
, but I'm not sure how others feel on this point.
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.
renderUnexpandableClump's don't have titles/descriptions so .... let's stick with this approach.
(If it supported titles, I would have said we do that.)
@@ -477,6 +477,8 @@ Util.UIStrings = { | |||
warningHeader: 'Warnings: ', | |||
/** The tooltip text on an expandable chevron icon. Clicking the icon expands a section to reveal a list of audit results that was hidden by default. */ | |||
auditGroupExpandTooltip: 'Show audits', | |||
/** Section heading shown above a list of audits that contain warnings. */ | |||
warningAuditsGroupTitle: 'Audits with warnings', |
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.
I feel like we should be more specific with something like Passed audits with warnings
. And is "with warnings" how we want to phrase it?
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.
wb Passed but contains (or with) warnings
? the manual and the n/a titles don't explicitly say "audit".
@@ -477,6 +477,8 @@ Util.UIStrings = { | |||
warningHeader: 'Warnings: ', | |||
/** The tooltip text on an expandable chevron icon. Clicking the icon expands a section to reveal a list of audit results that was hidden by default. */ | |||
auditGroupExpandTooltip: 'Show audits', | |||
/** Section heading shown above a list of audits that contain warnings. */ |
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.
Need some context for "warnings" for the translators ("contain warnings" is pretty ambiguous in isolation)...what they are, how they're used sort of thing. See below for examples.
if (Util.showAsPassed(auditRef.result)) { | ||
if (this._auditHasWarning(auditRef)) { | ||
return 'warning'; | ||
} else if (Util.showAsPassed(auditRef.result)) { |
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.
hmm, we should figure out what we want the priority order to be here. Does warning
win over failed
?
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.
changed to require a passing state for all warnings.
const manualAudits = elem.querySelectorAll('.lh-clump--manual .lh-audit'); | ||
|
||
assert.equal(passedAudits.length, 4); | ||
assert.equal(failedAudits.length, 8); | ||
assert.equal(warningAudits.length, 0); |
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.
this test doesn't end up testing much :) WDYT about adding a warning to one of the passed audits?
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.
There are no passing audits with warnings in the sample json, and I'm not sure how to update the source appropriately. fine to just manually set some warnings in the test case?
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.
fine to just manually set some warnings in the test case
perfect
I think based on reading #5327 the intention was only to make sure passed audits with warnings stay visible instead of being hidden away. Since failed audits are already visible, they aren't an issue. Also if the audit failed for the page it makes sense (to me) that that should take precedence for where it should be located in the report. @paulirish for what he intended (and maybe to weigh in on the clump or unexpandableClump question) |
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.
think based on reading #5327 the intention was only to make sure passed audits with warnings stay visible instead of being hidden away. Since failed audits are already visible, they aren't an issue. Also if the audit failed for the page it makes sense (to me) that that should take precedence for where it should be located in the report.
yah any failing audits with warnings are already visible and viewed. We should only put non-failed warning audits in this clump.
@@ -264,6 +265,10 @@ class CategoryRenderer { | |||
const clumpTmpl = this.dom.cloneTemplate('#tmpl-lh-clump', this.templateContext); | |||
const clumpElement = this.dom.find('.lh-clump', clumpTmpl); | |||
|
|||
if (clumpId === 'warning') { |
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.
renderUnexpandableClump's don't have titles/descriptions so .... let's stick with this approach.
(If it supported titles, I would have said we do that.)
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.
wb
Passed but contains (or with) warnings
? the manual and the n/a titles don't explicitly say "audit".
I'm liking "Passed but contain/with warnings". My only hesitation is that this comes before "Passed audits", which might make that weird.
@@ -382,6 +399,7 @@ class CategoryRenderer { | |||
/** @type {Map<TopLevelClumpId, Array<LH.ReportResult.AuditRef>>} */ | |||
const clumps = new Map(); | |||
clumps.set('failed', []); | |||
clumps.set('warning', []); |
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.
should add 'warning' to the list of statuses in the method jsdoc for render()
above
@@ -129,6 +129,17 @@ describe('CategoryRenderer', () => { | |||
assert.ok(warningEl.textContent.includes(auditResult.warnings[1]), '2nd warning provided'); | |||
}); | |||
|
|||
it('expands warning audit group', () => { |
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.
nit: move this under the clumping
describe()
since it's really about the clump correctly working
audit.result.warnings = ['Some warning']; | ||
if (++forcedWarningsCounter === 2) break; | ||
} | ||
} |
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.
nit: what about
const categoryClone = JSON.parse(JSON.stringify(category));
// Give the first two passing grades warnings.
const passingRefs = categoryClone.auditRefs.filter(ref => ref.result.score === 1);
passingRefs[0].result.warnings = ['Some warning'];
passingRefs[1].result.warnings = ['Some warning'];
@@ -477,6 +477,8 @@ Util.UIStrings = { | |||
warningHeader: 'Warnings: ', | |||
/** The tooltip text on an expandable chevron icon. Clicking the icon expands a section to reveal a list of audit results that was hidden by default. */ | |||
auditGroupExpandTooltip: 'Show audits', | |||
/** Section heading shown above a list of passed audits that contain warnings. Audits under this section do no negatively impact the score, but Lighthouse has generated some potentially actionable suggestions that should be reviewed. This section is expanded by default and displays after the failing audits. */ |
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.
do not negatively
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.
Design feedback: I really think the 1px border on lh-warnings sticks out from the rest of the style. I'd like to hear @hwikyounglee's thoughts on this, but I think using the Lighthouse light orange color (#fff1e5) to fill in the warnings looks much nicer. Thoughts?
I think I'm a little confused on the final state of this? Are we doing a |
let's move that into a separate issue. This is the styling of warnings today; this PR is only making any warnings that would have been hidden in
yes, modulo the clump name.
yes |
@exterkamp Will you make an issue or a PR for that? @brendankenny I went with I made a warning sign for this clump: |
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.
need yarn diff:sample-json
:groundhog_day:
@@ -45,6 +45,7 @@ class CategoryRenderer { | |||
*/ | |||
get _clumpTitles() { | |||
return { | |||
warning: Util.UIStrings.warningAuditsGroupTitle, |
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.
it's unfortunate we used "group" for these :/
} else { | ||
return 'failed'; | ||
} | ||
} | ||
|
||
/** | ||
* Renders a set of top level sections (clumps), under a status of failed, manual, | ||
* passed, or notApplicable. The result ends up something like: | ||
* Renders a set of top level sections (clumps), under a status of failed, warnning, |
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.
warning
}); | ||
|
||
it('only passing audits with warnings show in warnings section', () => { | ||
const shouldBeFailed = renderer._getClumpIdForAuditRef({ |
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.
we should avoid touching the internal implementation if we can. We could do something simple like
it('only passing audits with warnings show in warnings section', () => {
const failingWarning = 'Failed and warned';
const passingWarning = 'A passing warning';
const category = {
id: 'test',
title: 'Test',
score: 0,
auditRefs: [{
id: 'failing',
result: {
id: 'failing',
title: 'Failing with warning',
description: '',
scoreDisplayMode: 'numeric',
score: 0,
warnings: [failingWarning],
},
}, {
id: 'passing',
result: {
id: 'passing',
title: 'Passing with warning',
description: '',
scoreDisplayMode: 'numeric',
score: 1,
warnings: [passingWarning],
},
}],
};
const categoryDOM = renderer.render(category);
const shouldBeFailed = categoryDOM.querySelectorAll('.lh-clump--failed .lh-audit');
assert.strictEqual(shouldBeFailed.length, 1);
assert.strictEqual(shouldBeFailed[0].id, 'failing');
assert.ok(shouldBeFailed[0].textContent.includes(failingWarning));
const shouldBeWarning = categoryDOM.querySelectorAll('.lh-clump--warning .lh-audit');
assert.strictEqual(shouldBeWarning.length, 1);
assert.strictEqual(shouldBeWarning[0].id, 'passing');
assert.ok(shouldBeWarning[0].textContent.includes(passingWarning));
});
(or we could do like the other ones do and just modify an existing category)
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.
just those last little things but otherwise LGTM!
🎉 🎉 |
fixes #5327