mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-02-25 02:54:19 -08:00
* Add public engagement page - modifies sitemap config - creates PublicEvent component - adds SVGs for dates - all copy is in intl * Add Public Engagement button to each page - create new PublicEng component - add to each page - update snapshots - modify CEJST and Meth page to give button more space * Make mobile compliant and fix DOM validation error - transform each <p>'s descendent into a <CollectionDescription> - fix a mobile rendering issue with <Collection> library - format registration links so they render on mobile - update snapshots * Add spacing to descriptions and fix links * Add Gherkin tests for testing links - all zoom links should be functional - ensure all legacy tests, test the new page - add data-cy tag for cypress - update snapshots * Refactor to pass accessibility on all pages - update snapshots * Correct registration links * Make registration links into buttons * Make new tag bold * Update copy based on feedback from Corey
60 lines
1.7 KiB
JavaScript
60 lines
1.7 KiB
JavaScript
// / <reference types="Cypress" />
|
|
|
|
/**
|
|
* The a11y check will use a cypress-axe library:
|
|
* - https://www.npmjs.com/package/cypress-axe
|
|
*
|
|
* This implements Deque's axe.run:
|
|
* - https://www.deque.com/axe/core-documentation/api-documentation/#api-name-axerun
|
|
*
|
|
* The table of rule descriptions that are seen in the terminal can be seen in totality here:
|
|
* - https://github.com/dequelabs/axe-core/blob/master/doc/rule-descriptions.md
|
|
*
|
|
*/
|
|
|
|
const endpoints = [
|
|
'en/',
|
|
'en/cejst',
|
|
'en/methodology',
|
|
'en/contact',
|
|
'en/404',
|
|
'en/public-engagement',
|
|
];
|
|
|
|
// The violation callback will post the violations into the terminal
|
|
// 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(
|
|
// The results array is described here:
|
|
// - https://www.deque.com/axe/core-documentation/api-documentation/#result-arrays
|
|
// Unable to figure out how add the HTML element that the violation is occuring on. Using
|
|
// Axe chrome plugin instead.
|
|
({id, impact, description}) => ({
|
|
id,
|
|
impact,
|
|
description,
|
|
}),
|
|
);
|
|
|
|
cy.task('table', violationData);
|
|
}
|
|
|
|
|
|
describe('Do the accessibility checks pass on each page?', () => {
|
|
endpoints.forEach((endpoint) => {
|
|
it(`Check accessibility on ${endpoint} page`, () => {
|
|
cy.visit(endpoint).get('main').then(() => {
|
|
cy.injectAxe();
|
|
cy.checkA11y(null, null, terminalLog);
|
|
});
|
|
});
|
|
});
|
|
});
|