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
Support aXe test runner #408
Conversation
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 a few minor things I've caught reading through this;
README.md
Outdated
Runners | ||
------- | ||
|
||
Pa11y supports multiple test runners. which return different results. The built-in test runners are: |
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.
Accidental .
after runners
@@ -226,29 +108,138 @@ | |||
} | |||
|
|||
/** | |||
* Check whether an issue is in the test area specified by rootElement. | |||
* Check whether an element is in the test area specified by rootElement. |
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 like this change; using element rather than issue. Makes more sense to me!
test/unit/lib/runner.test.js
Outdated
|
||
rootElement.contains.withArgs(insideElement).returns(true); | ||
rootElement.contains.withArgs(outsideElement).returns(false); | ||
describe('when the element HTML is short enough to not need truncating', () => { |
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.
Duplicate test
}); | ||
|
||
it('returns the element HTML unmodified', () => { | ||
assert.isNull(returnValue); |
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.
The test case description doesn't match the result; "returns null"
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 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 think this looks great. Found it very easy to read, lots of debugging messages, good docu 👍
(haven't tried actually running it yet 😳- may have more comments once I do!)
function loadRunnerFile(runner) { | ||
try { | ||
return require(`pa11y-runner-${runner}`); | ||
} catch (error) {} |
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.
genuine question, not a review comment per se: why doesn't this catch block do anything?
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.
Oh because if requiring pa11y-runner-XXX
fails, then we want to try requiring XXX
immediately afterwards. So we ignore this error :)
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.
Hello! This is what I did:
After this I tested three other sites but they produced a consistent number of errors. So maybe it was just a glitch? Also running Last feedback. Would be cool if/when running All in all good job! 👍 |
I've given it a run through to try to replicate the problems described by @Kolombiken above. I do see inconsistencies, but they're well within normal variance caused by third-party changes or things failing to load. Do you have ads running on any of your test pages, Kolombiken? That's usually my first suspect 😉 Here are my test results:
I also tried The Verge because they have a ton of ads and I was expecting some very irregular results! But it doesn't run Axe - I get the following error:
Are we able to catch that, or is it something we should bump upstream? HTML_CS runs fine. |
Hmm, the aXe Chrome extension works fine on The Verge, I'll investigate |
ac52263
to
00174f1
Compare
114cd28
to
82e957b
Compare
Is there any way to help getting this PR merged? I've been looking into pa11y for my automated accessibility testing needs, and axe support is the only thing that I find lacking – looking at this PR, it feels really close! I have tried this WIP briefly and everything seems to be working fine. Can do more testing if it helps! |
5d35cba
to
fa939bf
Compare
This looks great! I just have a few comments concerning the ability to run two different runners at the same time, regarding mainly the consistency between CLI/webservice/dashboard and the ease of maintenance. In my opinion, being able to run two runners at the same time in the same pa11y run introduces some complexity that may not be desirable:
I would say that allowing to use one runner, or the other, but not both in the same run, may probably make our life easier now and in the future. Other than that, top job 💯! |
fa939bf
to
a797862
Compare
Update from #408 (comment) – I’ve been using this branch for my accessibility tests over the last 3 months, and it’s been working really well as far as I can tell. I was mostly interested in using Axe instead of HTML_CS, but I ended up using the two on the assumption that this would potentially surface more errors, which I think has proven true – but not necessarily by that much. Personally I didn’t find it particularly confusing that it would be returning two sets of results, with different error codes and a lot of duplicates – that’s what you get for running two tools at once 😄Having said that I’d agree that this is a potential source of confusion, especially if surfaced in a web interface (CLI users would presumably have a much greater awareness of how exactly Pa11y has been configured). I looked into de-duplicating Axe and HTML_CS errors (or at least standardising error format as @josebolos suggests), and tried a few options – what I settled on was to map both types of results to the corresponding WCAG success criteria, as a common reference. This wouldn’t de-duplicate the errors, but at least group them so duplicate errors are likely to be displayed side by side in my reports (thus easy to de-dupe by hand if desirable). The corresponding mapping is available here if it helps anyone, along with a lot more code that generates my reports: https://github.com/thibaudcolas/wagtail-tooling/blob/master/accessibility/docs/success-criteria-mapping.json. This is still very WIP, but felt like it would be worth sharing nonetheless. For the purpose of this PR – If the API changes to only support a single runner, then I think people who want both Axe and HTML_CS will still be able to create their own custom Again, I’m really interested in helping getting Axe support merged and released, so do let me know if there is anything I can help with beyond testing. |
I've been testing out this branch and it seems great. Initially I was shared your view @josebolos; that two runners complicates things. But the more i've mulled it over, the more I beleive it's the correct approach. |
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 looks great to me! Thanks for getting everything fixed up :)
This will need to be done before we can ship though, otherwise we regress from HTMLCS 2.4 to 2.2 pa11y/pa11y-runner-htmlcs#2
@rowanmanning Good catch! |
We now support both the aXe and HTML CodeSniffer test runners - You can run Pa11y using one or both of these. I've done this by untangling HTML CodeSniffer from the core code and writing two new modules: - https://github.com/pa11y/pa11y-runner-axe - https://github.com/pa11y/pa11y-runner-htmlcs These come bundled with Pa11y so there's no need to install separately for now. They'll be considered stable when we're ready to release the code on this branch.
This fixes the issue with The Verge
a797862
to
eb704f3
Compare
We now support both the aXe and HTML CodeSniffer test runners - You can
run Pa11y using one or both of these. I've done this by untangling HTML
CodeSniffer from the core code and writing two new modules:
These come bundled with Pa11y so there's no need to install separately
for now. They'll be considered stable when we're ready to release the
code on this branch.
Looking for code review but also for people to test this work out.
How to try this out before we merge/release
Install the in-progress version with:
Test with HTML CodeSniffer (same as now):
Test with aXe:
Test with aXe and HTML CodeSniffer (there will be some duplicates):
This PR resolves #399.