-
Notifications
You must be signed in to change notification settings - Fork 334
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
Switch Accessibility tests to @axe-core/puppeteer
#3522
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
df2c476
Split preview layout `full-width` into `full-width-landmarks`
colinrotherham 9e72c9c
Remove Axe tests via Cheerio
colinrotherham ebb9e4e
Add Axe tests via Puppeteer
colinrotherham 4ae44a3
Ignore Axe `color-contrast` checks for ‘inactive’ components
colinrotherham 0abed50
Ignore Axe known issues for components
colinrotherham 02616a1
Fix missing labels in component examples
colinrotherham e877ae3
Fix missing table heading text in component example
colinrotherham a29df2f
Require Puppeteer to download Chromium for ARM where supported
colinrotherham 2b13f01
Require Puppeteer to keep 1x browser window in `{ headless: false }`
colinrotherham 4f0e257
Update test docs for Puppeteer browser inspection
colinrotherham File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{% extends "layout.njk" %} | ||
|
||
{% block main %} | ||
<div class="govuk-width-container"> | ||
{% block beforeContent %}{% endblock %} | ||
</div> | ||
<main class="govuk-main-wrapper {{ mainClasses }}" id="main-content" role="main"> | ||
{% block content %}{% endblock %} | ||
</main> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { axe, goToComponent } from 'govuk-frontend-helpers/puppeteer' | ||
import { getExamples } from 'govuk-frontend-lib/files' | ||
|
||
describe('/components/accordion', () => { | ||
let axeRules | ||
|
||
beforeAll(() => { | ||
axeRules = { | ||
/** | ||
* Ignore 'aria-labelledby attribute cannot be used on a div with | ||
* no valid role attribute' | ||
* | ||
* {@link https://github.com/alphagov/govuk-frontend/issues/2472} | ||
*/ | ||
'aria-allowed-attr': { enabled: false } | ||
} | ||
}) | ||
|
||
describe('component examples', () => { | ||
let exampleNames | ||
|
||
beforeAll(async () => { | ||
exampleNames = Object.keys(await getExamples('accordion')) | ||
}) | ||
|
||
it('passes accessibility tests', async () => { | ||
for (const name of exampleNames) { | ||
const exampleName = name.replace(/ /g, '-') | ||
|
||
// Navigation to example, create report | ||
await goToComponent(page, 'accordion', { exampleName }) | ||
await expect(axe(page, axeRules)).resolves.toHaveNoViolations() | ||
} | ||
}, 60000) | ||
}) | ||
}) |
Oops, something went wrong.
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.
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've created
full-width.njk
(without wrapping landmarks) alongsidefull-width-landmarks.njk
This is so Axe can pass some of the "landmark-in-landmark" violations
You'll see some Percy related diff changes as a result