From 3555b18d5342163b84cb1bcce9d79ecc90e2e1f3 Mon Sep 17 00:00:00 2001 From: Nat Hillard Date: Thu, 22 Jul 2021 09:20:40 -0400 Subject: [PATCH] properly scanning all pages now --- client/cypress/e2e/accessibility.test.js | 15 +++-- client/cypress/plugins/index.js | 4 ++ client/package-lock.json | 86 ++++++++++++++++++++++-- client/package.json | 3 +- 4 files changed, 93 insertions(+), 15 deletions(-) diff --git a/client/cypress/e2e/accessibility.test.js b/client/cypress/e2e/accessibility.test.js index ea5044ac..f8f3ca97 100644 --- a/client/cypress/e2e/accessibility.test.js +++ b/client/cypress/e2e/accessibility.test.js @@ -23,12 +23,13 @@ function terminalLog(violations) { 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); +describe('Accessibility checks', () => { + Cypress.env('endpoints').forEach((endpoint) => { + it(`${endpoint} has no accessibility violoations on load`, () => { + cy.visit(endpoint).then(() => { + cy.injectAxe(); + cy.checkA11y(null, null, terminalLog); + }); + }); }); }); diff --git a/client/cypress/plugins/index.js b/client/cypress/plugins/index.js index 4827da25..334d24ee 100644 --- a/client/cypress/plugins/index.js +++ b/client/cypress/plugins/index.js @@ -12,6 +12,8 @@ // This function is called when a project is opened or re-opened (e.g. due to // the project's config changing) +const {generateEndpoints} = require('gatsby-cypress-endpoints'); + /** * @type {Cypress.PluginConfig} */ @@ -31,4 +33,6 @@ module.exports = (on, config) => { return null; }, }); + generateEndpoints(on, config); + return config; }; diff --git a/client/package-lock.json b/client/package-lock.json index ff23387f..6f513050 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -42,14 +42,16 @@ "axe-core": "^4.2.1", "babel-jest": "^27.0.1", "babel-preset-gatsby": "^1.6.0", - "cypress": "^7.4.0", + "cypress": "^8.0.0", "cypress-axe": "^0.12.2", "eslint": "^7.27.0", "eslint-config-google": "^0.14.0", "eslint-plugin-cypress": "^2.11.3", + "eslint-plugin-formatjs": "^2.17.1", "eslint-plugin-react": "^7.23.2", "gatsby": "^3.4.1", "gatsby-cli": "^3.5.0", + "gatsby-cypress-endpoints": "^0.0.6", "gatsby-plugin-intl": "^0.3.3", "gatsby-plugin-prettier-eslint": "^1.0.6", "gatsby-plugin-react-helmet": "^4.6.0", @@ -3685,6 +3687,12 @@ "integrity": "sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ==", "dev": true }, + "node_modules/@types/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@types/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-iacbaYN9IWWrGWTwlYLVOeUtN/e4cjN9Uh6v7Yo1Qa/vJzeSQeh10L/erBBSl53BTmbnQ07vsWp8mmNHGI4WbQ==", + "dev": true + }, "node_modules/@types/eslint": { "version": "7.2.13", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.2.13.tgz", @@ -7516,9 +7524,9 @@ } }, "node_modules/cypress": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-7.6.0.tgz", - "integrity": "sha512-tTwQExY28CKt6cY85/2V1uLExcMfpBEBWXt/EcE2ht/Onl9k4lxUS7ul1UnUO5MrYwMIHMdGVh13DxdzXj4Z5w==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-8.0.0.tgz", + "integrity": "sha512-Hhbc7FtbeCSg5Ui2zxXQLynk7IYGIygG8NqTauS4EtCWyp2k6s4g8P4KUZXwRbhuryN/+/dCd1kPtFbhBx8MuQ==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -9144,6 +9152,50 @@ "eslint": "^7.1.0" } }, + "node_modules/eslint-plugin-formatjs": { + "version": "2.17.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-formatjs/-/eslint-plugin-formatjs-2.17.1.tgz", + "integrity": "sha512-L/rYhVdz5niANbZciqFYdp+/y5A0xB+ySzfV8dJaAB0dJyOGK1m2MZYEHsqAusaOTR96QzoQxVQLiGo5JoJi2g==", + "dev": true, + "dependencies": { + "@formatjs/icu-messageformat-parser": "2.0.7", + "@formatjs/ts-transformer": "3.4.5", + "@types/emoji-regex": "^8.0.0", + "@types/eslint": "^7.2.0", + "@typescript-eslint/typescript-estree": "^4.11.0", + "emoji-regex": "^9.0.0", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "eslint": "^7.0.0" + } + }, + "node_modules/eslint-plugin-formatjs/node_modules/@formatjs/ts-transformer": { + "version": "3.4.5", + "resolved": "https://registry.npmjs.org/@formatjs/ts-transformer/-/ts-transformer-3.4.5.tgz", + "integrity": "sha512-VzjT9jbpizZhwvtX/jaoTOeHQ/nvEx9ttzDrRXcFIGXyxupBZKTxr/+v6j3NjUmeiuN3JfaXhZUYmG+zsS0kxw==", + "dev": true, + "dependencies": { + "@formatjs/icu-messageformat-parser": "2.0.7", + "chalk": "^4.1.1", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "ts-jest": "27", + "typescript": "4" + }, + "peerDependenciesMeta": { + "ts-jest": { + "optional": true + } + } + }, + "node_modules/eslint-plugin-formatjs/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, "node_modules/eslint-plugin-graphql": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/eslint-plugin-graphql/-/eslint-plugin-graphql-4.0.0.tgz", @@ -11584,6 +11636,19 @@ "node": ">= 4.0.0" } }, + "node_modules/gatsby-cypress-endpoints": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/gatsby-cypress-endpoints/-/gatsby-cypress-endpoints-0.0.6.tgz", + "integrity": "sha512-3x19MFlgTuk7ej2D/Pk1a1ySf9uLM6OTcBztRoALCWxacYovF8B9Qb/7/k2mi0NldU9HFOUwxG9ZiXWNH5tX6g==", + "dev": true, + "engines": { + "node": ">=8" + }, + "peerDependencies": { + "cypress": "^4.0.0", + "gatsby": "^2.0.0" + } + }, "node_modules/gatsby-graphiql-explorer": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/gatsby-graphiql-explorer/-/gatsby-graphiql-explorer-1.8.0.tgz", @@ -32841,9 +32906,9 @@ } }, "cypress": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-7.6.0.tgz", - "integrity": "sha512-tTwQExY28CKt6cY85/2V1uLExcMfpBEBWXt/EcE2ht/Onl9k4lxUS7ul1UnUO5MrYwMIHMdGVh13DxdzXj4Z5w==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-8.0.0.tgz", + "integrity": "sha512-Hhbc7FtbeCSg5Ui2zxXQLynk7IYGIygG8NqTauS4EtCWyp2k6s4g8P4KUZXwRbhuryN/+/dCd1kPtFbhBx8MuQ==", "dev": true, "requires": { "@cypress/request": "^2.88.5", @@ -36286,6 +36351,13 @@ } } }, + "gatsby-cypress-endpoints": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/gatsby-cypress-endpoints/-/gatsby-cypress-endpoints-0.0.6.tgz", + "integrity": "sha512-3x19MFlgTuk7ej2D/Pk1a1ySf9uLM6OTcBztRoALCWxacYovF8B9Qb/7/k2mi0NldU9HFOUwxG9ZiXWNH5tX6g==", + "dev": true, + "requires": {} + }, "gatsby-graphiql-explorer": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/gatsby-graphiql-explorer/-/gatsby-graphiql-explorer-1.8.0.tgz", diff --git a/client/package.json b/client/package.json index abbe92ac..1550d79a 100644 --- a/client/package.json +++ b/client/package.json @@ -46,7 +46,7 @@ "axe-core": "^4.2.1", "babel-jest": "^27.0.1", "babel-preset-gatsby": "^1.6.0", - "cypress": "^7.4.0", + "cypress": "^8.0.0", "cypress-axe": "^0.12.2", "eslint": "^7.27.0", "eslint-config-google": "^0.14.0", @@ -55,6 +55,7 @@ "eslint-plugin-react": "^7.23.2", "gatsby": "^3.4.1", "gatsby-cli": "^3.5.0", + "gatsby-cypress-endpoints": "^0.0.6", "gatsby-plugin-intl": "^0.3.3", "gatsby-plugin-prettier-eslint": "^1.0.6", "gatsby-plugin-react-helmet": "^4.6.0",