Skip to content

Implement automated accessibility testing using Axe#3294

Merged
swissspidy merged 17 commits intodevelopfrom
feature/accessibility-axe
Sep 24, 2019
Merged

Implement automated accessibility testing using Axe#3294
swissspidy merged 17 commits intodevelopfrom
feature/accessibility-axe

Conversation

@spacedmonkey
Copy link
Copy Markdown
Contributor

@spacedmonkey spacedmonkey commented Sep 18, 2019

First pass at adding AXE into e2e testing.

Related: #3249
Fixes #3301

@googlebot googlebot added the cla: yes Signed the Google CLA label Sep 18, 2019
@spacedmonkey
Copy link
Copy Markdown
Contributor Author

Even having these tests in has already highlight some issues we have. It will also help with future work.

I would recommend fixing the issues that are found in the PR in another PR. Once that is complete, merge this as is and we can tweak it later.

@swissspidy
Copy link
Copy Markdown
Collaborator

@spacedmonkey Can you create individual issues for all the things flagged here so we can better track them?

@spacedmonkey spacedmonkey force-pushed the feature/accessibility-axe branch from 44fafd5 to 052ca8a Compare September 23, 2019 20:12
@spacedmonkey spacedmonkey marked this pull request as ready for review September 23, 2019 20:13
tStatusQueryTooShort,
tStatusSelectedOption,
tStatusResults,
ariaLabel,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sneaked in some very small accessibility fixes here to make the tests pass.

// Temporary disabled rules to enable initial integration.
// See: https://github.com/WordPress/gutenberg/pull/15018.
disabledRules: [
'aria-allowed-role',
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

These rules are disabled because of the errors in gutenberg. I would love for this ignored rules to be removed.

// Since the selected block is already at the back, the 'Back' and 'Backward' buttons should be disabled.
expect( page ).toMatchElement( '.amp-story-controls-send-back[aria-disabled="true"]' );
expect( page ).toMatchElement( '.amp-story-controls-send-backward[aria-disabled="true"]' );
expect( page ).toMatchElement( '.amp-story-controls-send-backwards[aria-disabled="true"]' );
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is a fix for e2e to pass. Not sure how this was passing before.

Copy link
Copy Markdown
Contributor

@barklund barklund left a comment

Choose a reason for hiding this comment

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

I'd like to see a reference to which exact rule(s), file and line, that should be enabled for each of the "child" issues from this one (#3301, #3305, #3307).

And just to confirm, if those three tickets are solved (and the corresponding rules enabled), AMP Story Editor is as ARIA-compliant (based on automated testing alone) as Gutenberg itself, right?

Otherwise this looks good to me!

*
* @return {?Promise} Promise resolving once Axe texts are finished.
*/
async function runAxeTestsForBlockEditor() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we rename this to runAxeTestsForStoriesEditor and use a different selector to detect it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@swissspidy Why? The tests are passing for both. Any new e2e added for plugin should also run these axe tests.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The block editor and stories editor will have different configurations though. The exclude config already has a stories-specific config in it as well.

Also, eventually we should eventually add these tests for the plugin settings screen as well, where we're going to have yet another set of configuration options.

Having three separate sets would make maintenance easier.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 78161f9

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The selector in runAxeTestsForStoriesEditor is still the same though.

What I meant was having separate functions with separate configurations:

  • runAxeTestsForBlockEditor with the current .block-editor selector
  • runAxeTestsForStoriesEditor with a #amp-story-editor selector
  • Eventually: runAxeTestsForSettingsScreen with a #amp-settings selector
  • Eventually: runAxeTestsForValidationScreen with a .post-type-amp_validated_url selector

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The selector in runAxeTestsForStoriesEditor is still the same though.

What I meant was having separate functions with separate configurations:

  • runAxeTestsForBlockEditor with the current .block-editor selector
  • runAxeTestsForStoriesEditor with a #amp-story-editor selector
  • Eventually: runAxeTestsForSettingsScreen with a #amp-settings selector
  • Eventually: runAxeTestsForValidationScreen with a .post-type-amp_validated_url selector

What are you asking to change here? Just change the selector, like this runAxeTestsForStoriesEditor with a #amp-story-editor selector

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yes. And have a second function, runAxeTestsForBlockEditor, with a different selector that only targets the block editor but not the stories editor. That function would then not exclude '.amp-story-page-attachment-close-button' as it's irrelevant in the standalone block editor.

If it's unclear I can also change this myself.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

And of course, let me know if you think it doesn't make sense. Then we can just do the #amp-story-editor selector change for now.

Co-Authored-By: Pascal Birchler <pascalb@google.com>
@spacedmonkey
Copy link
Copy Markdown
Contributor Author

I'd like to see a reference to which exact rule(s), file and line, that should be enabled for each of the "child" issues from this one (#3301, #3305, #3307).

Good point @barklund .

Regarding these other issues.

As suggested by @westonruter , existing fails were ignored where possible and other that couldn't be ignored were fixed. Those two issues will go into the backlog and will like not be looked at until after 2.0 release.

@swissspidy swissspidy added this to the v1.3 milestone Sep 24, 2019
@swissspidy swissspidy changed the title Add AXE into e2e testing Implement automated accessibility testing using Axe Sep 24, 2019
@swissspidy swissspidy merged commit e526d3f into develop Sep 24, 2019
@swissspidy swissspidy deleted the feature/accessibility-axe branch September 24, 2019 12:38
@swissspidy swissspidy mentioned this pull request Sep 24, 2019
7 tasks
westonruter pushed a commit that referenced this pull request Sep 24, 2019
Also fixes some tests and an a11y issue in the `Autocomplete` component.
westonruter added a commit that referenced this pull request Oct 1, 2019
* tag '1.3.0': (318 commits)
  Bump 1.3.0
  Add inline styles for custom fonts (#3345)
  Limit deeply-nesting test to 200 to fix Xdebug error (#3341)
  Bump 1.3-RC2 (#3335)
  Sanitize invalid children of amp-story and amp-story-page elements to prevent white story of death (#3336)
  Remove unused Travis deploy stage (#3340)
  Implement automated accessibility testing using Axe (#3294)
  Only add all Google Font style rules in editor context
  Prevent adding AMP query var to Story URLs in Compatibility Tool
  Prevent attempting to redirect Stories with rejected validation errors
  Ensure all AMP scripts (including v0.js) get moved to the head
  Make sure that media picker is background types are filter correctly.
  Normalize style[type] attribute quote style after r46164 in WP core
  Fix phpunit covers tags
  Bump version to 1.3-RC1
  Strip 100% width/height from layout=fill elements
  Fix issue with cut (#3246)
  Remove unused Google Fonts SVGs (#3289)
  Fix resize for non-fit text box (#3259)
  Use template_dir consistently as signal for transitional mode
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Signed the Google CLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Autocomplete accessibility issues

4 participants