mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-02-23 01:54:18 -08:00
* adding readme with debug instructions * updating translation tests to pass * fixes failing latlng url test * localizing focus buttons * updating map tests to pass * temporarily setting to only flag critical+ accessibility errors. To be addressed with full accessibility audit later
34 lines
888 B
JavaScript
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);
|
|
});
|
|
});
|