From e2571682b6643922f51f5e8b9ed8d6c2c25dcc48 Mon Sep 17 00:00:00 2001 From: Benjamin Arias Date: Tue, 15 Nov 2022 17:48:12 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20Ajoute=20impl=C3=A9mentation=20par=20d?= =?UTF-8?q?=C3=A9faut=20axe-puppeteer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- site/a11y/puppeteer/test.cjs | 11 +++ site/package.json | 3 + yarn.lock | 165 +++++++++++++++++++++++++++++------ 3 files changed, 150 insertions(+), 29 deletions(-) create mode 100644 site/a11y/puppeteer/test.cjs diff --git a/site/a11y/puppeteer/test.cjs b/site/a11y/puppeteer/test.cjs new file mode 100644 index 000000000..dbfacc369 --- /dev/null +++ b/site/a11y/puppeteer/test.cjs @@ -0,0 +1,11 @@ +const { loadPage } = require('@axe-core/puppeteer') +const puppeteer = require('puppeteer') + +;(async () => { + const browser = await puppeteer.launch() + const axeBuilder = await loadPage(browser, 'https://mon-entreprise.urssaf.fr') + const results = await axeBuilder.analyze() + console.log(results.violations) + + await browser.close() +})() diff --git a/site/package.json b/site/package.json index afeaf63cf..05c585d7d 100644 --- a/site/package.json +++ b/site/package.json @@ -35,6 +35,7 @@ "test": "vitest", "test:dev-e2e:mon-entreprise": "cypress open --e2e --config \"baseUrl=http://localhost:8888\"", "test:dev-e2e:mycompanyinfrance": "cypress open --e2e --config \"baseUrl=http://localhost:8889,specPattern=cypress/integration/mon-entreprise/english/**/*.{js,jsx,ts,tsx}\" --env language=en", + "test:a11y": "node a11y/puppeteer/test.cjs", "test:record-http-calls:mon-entreprise": "cypress run --env record_http=", "algolia:update": "node --loader ts-node/esm scripts/search/update-data.ts", "algolia:clean": "node scripts/search/clean.js", @@ -101,6 +102,7 @@ "whatwg-fetch": "^3.0.0" }, "devDependencies": { + "@axe-core/puppeteer": "^4.5.1", "@react-types/accordion": "^3.0.0-alpha.4", "@react-types/numberfield": "^3.1.0", "@react-types/searchfield": "^3.1.2", @@ -133,6 +135,7 @@ "i18next-parser": "^6.0.0", "isomorphic-fetch": "^2.2.1", "netlify-cli": "^10.6.3", + "puppeteer": "^19.2.2", "rimraf": "^3.0.2", "rollup-plugin-toml": "^1.0.0", "serve-static": "^1.14.2", diff --git a/yarn.lock b/yarn.lock index 657411a83..702700b5d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -287,6 +287,17 @@ __metadata: languageName: node linkType: hard +"@axe-core/puppeteer@npm:^4.5.1": + version: 4.5.1 + resolution: "@axe-core/puppeteer@npm:4.5.1" + dependencies: + axe-core: ^4.5.1 + peerDependencies: + puppeteer: ">=1.10.0 <= 18" + checksum: 5d618974f642c44c238393164b3cd94b485601723c168d95a8168c28682356dbb3b577077df35ce6c77a02f2ea66522a8a34bf67f7149d1185bc2691f6a0e4f4 + languageName: node + linkType: hard + "@axe-core/react@npm:^4.4.4": version: 4.4.4 resolution: "@axe-core/react@npm:4.4.4" @@ -10858,6 +10869,13 @@ __metadata: languageName: node linkType: hard +"axe-core@npm:^4.5.1": + version: 4.5.2 + resolution: "axe-core@npm:4.5.2" + checksum: 4068f183b2ef1db7e5a75606032c238781abfaa34ab4c23177e17f7dff8cc83f175e887b52689d20d88d2d4f001cbf632bd98925850026fe1d9abc739cabcf16 + languageName: node + linkType: hard + "axios@npm:^0.25.0": version: 0.25.0 resolution: "axios@npm:0.25.0" @@ -13075,6 +13093,19 @@ __metadata: languageName: node linkType: hard +"cosmiconfig@npm:7.0.1, cosmiconfig@npm:^7.0.0": + version: 7.0.1 + resolution: "cosmiconfig@npm:7.0.1" + dependencies: + "@types/parse-json": ^4.0.0 + import-fresh: ^3.2.1 + parse-json: ^5.0.0 + path-type: ^4.0.0 + yaml: ^1.10.0 + checksum: 4be63e7117955fd88333d7460e4c466a90f556df6ef34efd59034d2463484e339666c41f02b523d574a797ec61f4a91918c5b89a316db2ea2f834e0d2d09465b + languageName: node + linkType: hard + "cosmiconfig@npm:^6.0.0": version: 6.0.0 resolution: "cosmiconfig@npm:6.0.0" @@ -13088,19 +13119,6 @@ __metadata: languageName: node linkType: hard -"cosmiconfig@npm:^7.0.0": - version: 7.0.1 - resolution: "cosmiconfig@npm:7.0.1" - dependencies: - "@types/parse-json": ^4.0.0 - import-fresh: ^3.2.1 - parse-json: ^5.0.0 - path-type: ^4.0.0 - yaml: ^1.10.0 - checksum: 4be63e7117955fd88333d7460e4c466a90f556df6ef34efd59034d2463484e339666c41f02b523d574a797ec61f4a91918c5b89a316db2ea2f834e0d2d09465b - languageName: node - linkType: hard - "cp-file@npm:^7.0.0": version: 7.0.0 resolution: "cp-file@npm:7.0.0" @@ -13234,7 +13252,7 @@ __metadata: languageName: node linkType: hard -"cross-fetch@npm:^3.1.5": +"cross-fetch@npm:3.1.5, cross-fetch@npm:^3.1.5": version: 3.1.5 resolution: "cross-fetch@npm:3.1.5" dependencies: @@ -13664,7 +13682,7 @@ __metadata: languageName: node linkType: hard -"debug@npm:4, debug@npm:^4.0.0, debug@npm:^4.0.1, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4, debug@npm:~4.3.1, debug@npm:~4.3.2": +"debug@npm:4, debug@npm:4.3.4, debug@npm:^4.0.0, debug@npm:^4.0.1, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4, debug@npm:~4.3.1, debug@npm:~4.3.2": version: 4.3.4 resolution: "debug@npm:4.3.4" dependencies: @@ -14156,6 +14174,13 @@ __metadata: languageName: node linkType: hard +"devtools-protocol@npm:0.0.1056733": + version: 0.0.1056733 + resolution: "devtools-protocol@npm:0.0.1056733" + checksum: d81b474d656d5cdfa0ec6afb8725e8707ba8b38ad7fc68abe05e5accdef1967a6bc1a1545744c8b69cb22ec5d3b3e5225d4bc0313b6a017c94a32a43f3d2c3d3 + languageName: node + linkType: hard + "dezalgo@npm:1.0.3": version: 1.0.3 resolution: "dezalgo@npm:1.0.3" @@ -18396,7 +18421,7 @@ __metadata: languageName: node linkType: hard -"https-proxy-agent@npm:^5.0.0": +"https-proxy-agent@npm:5.0.1, https-proxy-agent@npm:^5.0.0": version: 5.0.1 resolution: "https-proxy-agent@npm:5.0.1" dependencies: @@ -21890,6 +21915,13 @@ __metadata: languageName: node linkType: hard +"mkdirp-classic@npm:^0.5.2": + version: 0.5.3 + resolution: "mkdirp-classic@npm:0.5.3" + checksum: 3f4e088208270bbcc148d53b73e9a5bd9eef05ad2cbf3b3d0ff8795278d50dd1d11a8ef1875ff5aea3fa888931f95bfcb2ad5b7c1061cfefd6284d199e6776ac + languageName: node + linkType: hard + "mkdirp@npm:^0.5.1, mkdirp@npm:^0.5.3": version: 0.5.6 resolution: "mkdirp@npm:0.5.6" @@ -24267,6 +24299,13 @@ __metadata: languageName: node linkType: hard +"progress@npm:2.0.3": + version: 2.0.3 + resolution: "progress@npm:2.0.3" + checksum: f67403fe7b34912148d9252cb7481266a354bd99ce82c835f79070643bb3c6583d10dbcfda4d41e04bbc1d8437e9af0fb1e1f2135727878f5308682a579429b7 + languageName: node + linkType: hard + "promise-inflight@npm:^1.0.1": version: 1.0.1 resolution: "promise-inflight@npm:1.0.1" @@ -24379,6 +24418,13 @@ __metadata: languageName: node linkType: hard +"proxy-from-env@npm:1.1.0": + version: 1.1.0 + resolution: "proxy-from-env@npm:1.1.0" + checksum: ed7fcc2ba0a33404958e34d95d18638249a68c430e30fcb6c478497d72739ba64ce9810a24f53a7d921d0c065e5b78e3822759800698167256b04659366ca4d4 + languageName: node + linkType: hard + "prr@npm:~1.0.1": version: 1.0.1 resolution: "prr@npm:1.0.1" @@ -24529,6 +24575,38 @@ __metadata: languageName: node linkType: hard +"puppeteer-core@npm:19.2.2": + version: 19.2.2 + resolution: "puppeteer-core@npm:19.2.2" + dependencies: + cross-fetch: 3.1.5 + debug: 4.3.4 + devtools-protocol: 0.0.1056733 + extract-zip: 2.0.1 + https-proxy-agent: 5.0.1 + proxy-from-env: 1.1.0 + rimraf: 3.0.2 + tar-fs: 2.1.1 + unbzip2-stream: 1.4.3 + ws: 8.10.0 + checksum: 5d275456667b57f3fb3caedfa4bc00474bd24f6028e3b1520281404584675dfb5e1b7d2daf6a57f62ca52f71eea899b0cc429aca5b65a9646da8b4588786431c + languageName: node + linkType: hard + +"puppeteer@npm:^19.2.2": + version: 19.2.2 + resolution: "puppeteer@npm:19.2.2" + dependencies: + cosmiconfig: 7.0.1 + devtools-protocol: 0.0.1056733 + https-proxy-agent: 5.0.1 + progress: 2.0.3 + proxy-from-env: 1.1.0 + puppeteer-core: 19.2.2 + checksum: 8b66180ee62e624bd494c5fdcb36e023caca4058a151c30a99e938346c74a33951132c17149b72c90a87cb04ad1a5e220b554d69fd0bcd206345c9983d71edbe + languageName: node + linkType: hard + "qs@npm:6.10.3": version: 6.10.3 resolution: "qs@npm:6.10.3" @@ -25895,6 +25973,17 @@ __metadata: languageName: node linkType: hard +"rimraf@npm:3.0.2, rimraf@npm:^3.0.0, rimraf@npm:^3.0.2": + version: 3.0.2 + resolution: "rimraf@npm:3.0.2" + dependencies: + glob: ^7.1.3 + bin: + rimraf: bin.js + checksum: 87f4164e396f0171b0a3386cc1877a817f572148ee13a7e113b238e48e8a9f2f31d009a92ec38a591ff1567d9662c6b67fd8818a2dbbaed74bc26a87a2a4a9a0 + languageName: node + linkType: hard + "rimraf@npm:^2.5.4, rimraf@npm:^2.6.3": version: 2.7.1 resolution: "rimraf@npm:2.7.1" @@ -25906,17 +25995,6 @@ __metadata: languageName: node linkType: hard -"rimraf@npm:^3.0.0, rimraf@npm:^3.0.2": - version: 3.0.2 - resolution: "rimraf@npm:3.0.2" - dependencies: - glob: ^7.1.3 - bin: - rimraf: bin.js - checksum: 87f4164e396f0171b0a3386cc1877a817f572148ee13a7e113b238e48e8a9f2f31d009a92ec38a591ff1567d9662c6b67fd8818a2dbbaed74bc26a87a2a4a9a0 - languageName: node - linkType: hard - "ripemd160@npm:^2.0.0, ripemd160@npm:^2.0.1": version: 2.0.2 resolution: "ripemd160@npm:2.0.2" @@ -26539,6 +26617,7 @@ __metadata: version: 0.0.0-use.local resolution: "site@workspace:site" dependencies: + "@axe-core/puppeteer": ^4.5.1 "@axe-core/react": ^4.4.4 "@internationalized/number": ^3.0.3 "@react-aria/accordion": ^3.0.0-alpha.5 @@ -26604,6 +26683,7 @@ __metadata: netlify-cli: ^10.6.3 publicodes: ^1.0.0-beta.60 publicodes-react: ^1.0.0-beta.60 + puppeteer: ^19.2.2 react: ^17.0.0 react-colorful: ^5.5.1 react-dom: ^17.0.0 @@ -27763,6 +27843,18 @@ __metadata: languageName: node linkType: hard +"tar-fs@npm:2.1.1": + version: 2.1.1 + resolution: "tar-fs@npm:2.1.1" + dependencies: + chownr: ^1.1.1 + mkdirp-classic: ^0.5.2 + pump: ^3.0.0 + tar-stream: ^2.1.4 + checksum: f5b9a70059f5b2969e65f037b4e4da2daf0fa762d3d232ffd96e819e3f94665dbbbe62f76f084f1acb4dbdcce16c6e4dac08d12ffc6d24b8d76720f4d9cf032d + languageName: node + linkType: hard + "tar-stream@npm:^1.5.2": version: 1.6.2 resolution: "tar-stream@npm:1.6.2" @@ -27778,7 +27870,7 @@ __metadata: languageName: node linkType: hard -"tar-stream@npm:^2.2.0": +"tar-stream@npm:^2.1.4, tar-stream@npm:^2.2.0": version: 2.2.0 resolution: "tar-stream@npm:2.2.0" dependencies: @@ -28764,7 +28856,7 @@ __metadata: languageName: node linkType: hard -"unbzip2-stream@npm:^1.0.9": +"unbzip2-stream@npm:1.4.3, unbzip2-stream@npm:^1.0.9": version: 1.4.3 resolution: "unbzip2-stream@npm:1.4.3" dependencies: @@ -30393,6 +30485,21 @@ __metadata: languageName: node linkType: hard +"ws@npm:8.10.0": + version: 8.10.0 + resolution: "ws@npm:8.10.0" + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ^5.0.2 + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + checksum: 3a32e15dffe633dd5ce99659793dbcf1440ea25d2da1060c88cbd22efdfb7986a6933e68aaa4b098fc3f1f7870cb386afd378a1ceaca4b31748471576d5a8b52 + languageName: node + linkType: hard + "ws@npm:^8.2.3": version: 8.8.0 resolution: "ws@npm:8.8.0"