mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-07-30 05:11:18 -07:00
Attempt to merge Lighthouse Fix branch from Nat (#758)
* Add a11y tests in cypress for methodology page - update cypress to version 8.5 - add HTML lang the <head> element - change process list headings to h4 - add alt tag to download image icon - move <GovBanner> into <Header> - add documentation around a11y testing * Add cypress a11y tests for cejst page - add alt icon for mapIntro page - change legend to be a normal div - add a class that mimics the h4 styles - remove superfluous styles * Add cypress a11y tests for contact and 404 page * Update snapshots * Move static text in footer to copy folder * Add cypress a11y test to About page - add required h1 tag - updates snapshot * Add site_url.xml and modify robots.txt file - adds plugins for robots.txt and sitemap - remove env.local and will add env.production - modifiy all yml files (docker and GHA) to specify new env variables - refactor env variables to either DATA_SOURCE, SITE_URL or PATH_PREFIX - set defaults for env variables in gatsby-config - remove timeline component - will add blank index page - update README on info on env variables * Add plugin to allow custom env vars - allows system env vars, ie, DATA_SOURCE on client-side application * Update displayed URLs in GHA to new CDN (d29) - also updates the blank index.html * Correct spacing * Set SITE_URL to new CDN for robots.txt * Remove SITE_URL as this is set by GHA * Update README around docker and env vars
This commit is contained in:
parent
52aa0e3123
commit
72d80a5803
32 changed files with 999 additions and 748 deletions
|
@ -1,7 +1,26 @@
|
|||
// / <reference types="Cypress" />
|
||||
|
||||
// Define at the top of the spec file or just import it
|
||||
/**
|
||||
* 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',
|
||||
];
|
||||
|
||||
// The violation callback will post the violations into the terminal
|
||||
// eslint-disable-next-line require-jsdoc
|
||||
function terminalLog(violations) {
|
||||
cy.task(
|
||||
|
@ -10,13 +29,17 @@ function terminalLog(violations) {
|
|||
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}) => ({
|
||||
// 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,
|
||||
nodes: nodes.length,
|
||||
}),
|
||||
);
|
||||
|
||||
|
@ -24,11 +47,13 @@ function terminalLog(violations) {
|
|||
}
|
||||
|
||||
|
||||
describe('Accessibility tests', () => {
|
||||
beforeEach(() => {
|
||||
cy.visit('/').get('main').injectAxe();
|
||||
});
|
||||
it('Has no detectable accessibility violations on load', () => {
|
||||
cy.checkA11y(null, {includedImpacts: ['critical']}, terminalLog);
|
||||
describe('Accessibility checks', () => {
|
||||
endpoints.forEach((endpoint) => {
|
||||
it(`Check Accessibility on ${endpoint} page`, () => {
|
||||
cy.visit(endpoint).get('main').then(() => {
|
||||
cy.injectAxe();
|
||||
cy.checkA11y(null, null, terminalLog);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue