j40-cejst-2/client/cypress/integration/LegacyTests/accessibility.test.js
Vim 47df35b77e
Gherkin cypress spike (#673)
* integrate gherkin/cucumber w/ cypress

- change cypress.json config from e2e back to standard integration
- add cypress-cucumber-preprocessor
- add integration test of about page

* add a title to each page

* add intl to the 404 page

* Refactor explore tool page

- add intl to static strings
- replace component css with <Grid> layout

* Add title to contact page

* add intl to title of page

* Add gherkin tests for nav to about page

- navigate from any page to the about page
- ensure each link has the title correct on that page
2021-09-15 12:06:13 -07:00

34 lines
888 B
JavaScript

// / <reference types="Cypress" />
// Define at the top of the spec file or just import it
// eslint-disable-next-line require-jsdoc
function terminalLog(violations) {
cy.task(
'log',
`${violations.length} accessibility violation${
violations.length === 1 ? '' : 's'
} ${violations.length === 1 ? 'was' : 'were'} detected`,
);
// pluck specific keys to keep the table readable
const violationData = violations.map(
({id, impact, description, nodes}) => ({
id,
impact,
description,
nodes: nodes.length,
}),
);
cy.task('table', violationData);
}
describe('Accessibility tests', () => {
beforeEach(() => {
cy.visit('/').get('main').injectAxe();
});
it('Has no detectable accessibility violations on load', () => {
cy.checkA11y(null, {includedImpacts: ['critical']}, terminalLog);
});
});