Fix excludes for accessibility audit tests #1803
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes the accessibility audit tests so we can exclude multiple different selectors from tests. Previously the selector
.app-phase-banner__wrapper
was in the list of things to exclude, but was not being excluded (see comment from @hannalaakso in PR #784).This change is needed to be able to bump
axe-core
or@axe-core/puppeteer
.Details
It isn't clear from the
axe-puppeteer
documentation, butAxePuppeteer.exclude
accepts only one argument, which is either a string or a list of strings. If a list of strings is provided, this is used to select an element within an iframe [2]. So to exclude several different elements, we need to call.exclude
multiple times.The easiest way to call
.exclude
multiple times for each test is to create a function (replacing thethingsToExclude
object), which this commit does.This is required to upgrade
axe-core
to version 3.5.0 or greater. The tests we passing before this commit because the rule 'all page content must be contained by landmarks' was not working fully: it treated regions as being part of thehtml
element (and thus not covered by.include('body')
) [4].