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

PWA Audits: add placeholders for rest of baseline checks. #2248

Merged
merged 4 commits into from
May 16, 2017
Merged

Conversation

ebidel
Copy link
Contributor

@ebidel ebidel commented May 14, 2017

Fixes #2059

This PR adds the notion of a "manual" audit, an audit which does not require any artifacts but renders in the report like a normal audit. We're using @patrickhulce's awesome report grouping to group the manual audits together (below passing audits).

I chose the grey "-" instead of the blue information "i" because we need some way to distinguish these audits from normal (automated) audits run by LH. But LMK what ya'll think.

screen shot 2017-05-14 at 2 23 58 pm

screen shot 2017-05-14 at 2 24 07 pm

Also modernizes samples_v2.json

category: 'PWA',
name: 'pwa-each-page-has-url',
helpText: 'Ensure individual pages are deep linkable via the URLs and that URLs are ' +
'unique for the purpose of shareability on social media.',
Copy link
Member

Choose a reason for hiding this comment

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

[Learn more](https://developers.google.com/web/progressive-web-apps/checklist#each-page-has-a-url)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

category: 'PWA',
name: 'pwa-page-transitions',
helpText: 'Transitions should feel snappy as you tap around, even on a slow network, a key ' +
'to perceived performance.',
Copy link
Member

Choose a reason for hiding this comment

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

[Learn more](https://developers.google.com/web/progressive-web-apps/checklist#page-transitions-dont-feel-like-they-block-on-the-network)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

return Object.assign({
category: 'PWA',
name: 'pwa-cross-browser',
helpText: 'To reach the most number of users, sites should work across every major browser.',
Copy link
Member

Choose a reason for hiding this comment

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

[Learn more](https://developers.google.com/web/progressive-web-apps/checklist#site-works-cross-browser)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

const passedElem = this._renderPassedAuditsSection(passedElements);
element.appendChild(passedElem);
// Render manual audits after passing.
const auditsGroupedByGroup = /** @type {!Object<string,
Copy link
Member

Choose a reason for hiding this comment

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

cc @patrickhulce on this bit

},
},
"categories": {
"pwa": {
"name": "Progressive Web App",
"weight": 1,
"description": "These audits validate the aspects of a Progressive Web App. They are a subset of the [PWA Checklist](https://developers.google.com/web/progressive-web-apps/checklist).",
"description": "These audits validate the aspects of a Progressive Web App. They are a subset¹ of the baseline [PWA Checklist](https://developers.google.com/web/progressive-web-apps/checklist).",
Copy link
Member

Choose a reason for hiding this comment

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

with the placeholders, we're no longer a subset.

wdyt about

These audits validate the aspects of a Progressive Web App, as specified by the baseline [PWA Checklist].

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call

Copy link
Collaborator

Choose a reason for hiding this comment

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

👍 this also gets rid of the strange looking 1 that doesn't really look like a footnote at the beginning of the group :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

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

looking good, but what do you think about flattening and removing the base class? It doesn't end up reducing much code and makes writing/reading the manual audits more complicated than copying/pasting informative: true, manual: true and rawValue: false would be

@ebidel
Copy link
Contributor Author

ebidel commented May 14, 2017

I'm not opposed to removing it. What I like about it is that we set some default meta flags for extenders (we have a lot now) so they don't have to think about it. It'll also be easier to modify all manual audits in the future. Only 3 now.

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

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

are we ok with manual audits being only supported (for now) in _renderDefaultCategory (not a11y or perf?)? If so, should the changes to _renderDefaultCategory be forked into _renderPwaCategory to make that explicit? Or can we make a method for manual audits analogous to _renderPassedAuditsSection?

@@ -26,6 +26,7 @@
--fail-color: #df332f;
--pass-color: #2b882f;
--informative-color: #0c50c7;
--unknown-color: #757575;
Copy link
Member

Choose a reason for hiding this comment

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

--manual-color?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@brendankenny
Copy link
Member

I'm not opposed to removing it. What I like about it is that we set some default meta flags for extenders (we have a lot now) so they don't have to think about it. It'll also be easier to modify all manual audits in the future

It's only the three meta properties now, so my preference is add the code to deal with that when/if it gets more complex. It also helps that (AFAIK) these are the only planned manual audits...don't want a return of 'Coming Soon' :)

@paulirish
Copy link
Member

Or can we make a method for manual audits analogous to _renderPassedAuditsSection?

👍. at least, this. yeah

},
},
"categories": {
"pwa": {
"name": "Progressive Web App",
"weight": 1,
"description": "These audits validate the aspects of a Progressive Web App. They are a subset of the [PWA Checklist](https://developers.google.com/web/progressive-web-apps/checklist).",
"description": "These audits validate the aspects of a Progressive Web App. They are a subset¹ of the baseline [PWA Checklist](https://developers.google.com/web/progressive-web-apps/checklist).",
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍 this also gets rid of the strange looking 1 that doesn't really look like a footnote at the beginning of the group :)

},
"a11y-aria": {
"title": "ARIA Attributes Follow Best Practices",
"description": "Screen readers and other assitive technologies require annotations to understand otherwise ambiguous content."
"description": "Screen readers and other assistive technologies require annotations to understand otherwise ambiguous content."
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice I was wondering if this was going to sit around until we changed all the group descriptions haha

// Render manual audits after passing.
const auditsGroupedByGroup = /** @type {!Object<string,
!Array<!ReportRenderer.AuditJSON>>} */ ({});
manualAudits.forEach(audit => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this feels a bit like overkill right now, do we think we have any need for manual audits to be broken up in the same category?

@ebidel
Copy link
Contributor Author

ebidel commented May 16, 2017

PTA. Kept the class but added _renderManualAudits.

@brendankenny
Copy link
Member

Do you really feel strongly about the base class? It saves three or four total lines of code, and the Object.assign means it's not really intuitive for writing manual audits (if we ever have more) or reading them (which will happen a whole lot more).

@paulirish
Copy link
Member

paulirish commented May 16, 2017

Do you really feel strongly about the base class? It saves three or four total lines of code, and the Object.assign means it's not really intuitive for writing manual audits (if we ever have more) or reading them (which will happen a whole lot more).

Seemed cool to me. I tried it out:
pwachecklist...nukemanualtestsbaseclass

68 additions and 81 deletions.

eh. not a huge deal to me either way.

@ebidel
Copy link
Contributor Author

ebidel commented May 16, 2017

Explicit code/class hierarchy is not a bad thing, even if it just saves a few lines. We can revisit later.

@ebidel ebidel merged commit df2fae5 into master May 16, 2017
@ebidel ebidel deleted the pwachecklist branch May 16, 2017 07:59
@brendankenny
Copy link
Member

even if it just saves a few lines

I was wrong, it was actually the other way, +13 lines

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.

None yet

4 participants