diff --git a/cypress.json b/cypress.json index 7aa62ebd4..953aa5e1f 100644 --- a/cypress.json +++ b/cypress.json @@ -1,4 +1,4 @@ { "baseUrl": "http://localhost:8888", "video": false -} \ No newline at end of file +} diff --git a/cypress/integration/a11y.spec.js b/cypress/integration/a11y.spec.js new file mode 100644 index 000000000..493b82a2b --- /dev/null +++ b/cypress/integration/a11y.spec.js @@ -0,0 +1,88 @@ +const A11Y_OPTS = { + runOnly: { + type: "tag", + values: ["section508", "best-practice", "wcag21aa", "wcag2aa"] + } +}; + +context("Accessibility (a11y)", () => { + context("Logged out", () => { + it.skip("overview", () => { + cy.clearSession(); + cy.visit("/account/login"); + cy.injectAxe(); + cy.wait(500); + cy.checkA11y(A11Y_OPTS); + }); + }); + + context("Logged in", () => { + beforeEach(() => { + cy.clearSession(); + cy.server(); + // overview page + cy.route("GET", "*api/v1/repos*", "fixture:overview_page.json"); + // add repos page + cy.route( + "GET", + "*api/v1/user/source/repos*", + "fixture:add_repositories.json" + ); + // settings page + cy.route("GET", "*api/v1/repos/*/octocat", "fixture:repository.json"); + // repo and build page + cy.stubBuilds(); + cy.stubBuild(); + cy.stubStepsWithLogs(); + // hooks page + cy.route("GET", "*api/v1/hooks/github/octocat*", "fixture:hooks_5.json"); + cy.route( + "GET", + "*api/v1/repos/*/octocat/builds/1*", + "fixture:build_success.json" + ); + cy.route( + "GET", + "*api/v1/repos/*/octocat/builds/2*", + "fixture:build_failure.json" + ); + cy.route( + "GET", + "*api/v1/repos/*/octocat/builds/3*", + "fixture:build_running.json" + ); + }); + + it.skip("overview", () => { + cy.checkA11yForPage("/", A11Y_OPTS); + }); + + it.skip("add repos", () => { + cy.checkA11yForPage("/account/add-repos", A11Y_OPTS); + }); + + it.skip("settings", () => { + cy.checkA11yForPage("/github/octocat/settings", A11Y_OPTS); + }); + + it.skip("repo page", () => { + cy.checkA11yForPage("/someorg/somerepo", A11Y_OPTS); + }); + + it.skip("hooks page", () => { + cy.login("/github/octocat/hooks"); + cy.injectAxe(); + cy.wait(500); + cy.get("[data-test=hook]").click({ multiple: true }); + cy.checkA11y(A11Y_OPTS); + }); + + it.skip("build page", () => { + cy.login("/someorg/somerepo/1"); + cy.injectAxe(); + cy.wait(500); + cy.get("[data-test=step-header]").click({ multiple: true }); + cy.checkA11y(A11Y_OPTS); + }); + }); +}); diff --git a/cypress/support/commands.js b/cypress/support/commands.js index ebce1f8a7..ee7e2b49a 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -140,7 +140,6 @@ Cypress.Commands.add("stubBuildsErrors", () => { }); }); - Cypress.Commands.add("stubBuildErrors", () => { cy.route({ method: "GET", @@ -158,3 +157,10 @@ Cypress.Commands.add("stubStepsErrors", () => { response: "server error" }); }); + +Cypress.Commands.add("checkA11yForPage", (path = "/", opts = {}) => { + cy.login(path); + cy.injectAxe(); + cy.wait(500); + cy.checkA11y(opts); +}); diff --git a/cypress/support/index.js b/cypress/support/index.js index d68db96df..fa346c15a 100644 --- a/cypress/support/index.js +++ b/cypress/support/index.js @@ -13,8 +13,11 @@ // https://on.cypress.io/configuration // *********************************************************** +// Import cypress-axe for accessibility tests +import "cypress-axe"; + // Import commands.js using ES2015 syntax: -import './commands' +import "./commands"; // Alternatively you can use CommonJS syntax: // require('./commands') diff --git a/package-lock.json b/package-lock.json index 9d9a3eb0f..04a6454e9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1276,17 +1276,57 @@ "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==" }, "autoprefixer": { - "version": "9.7.1", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.7.1.tgz", - "integrity": "sha512-w3b5y1PXWlhYulevrTJ0lizkQ5CyqfeU6BIRDbuhsMupstHQOeb1Ur80tcB1zxSu7AwyY/qCQ7Vvqklh31ZBFw==", + "version": "9.7.3", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.7.3.tgz", + "integrity": "sha512-8T5Y1C5Iyj6PgkPSFd0ODvK9DIleuPKUPYniNxybS47g2k2wFgLZ46lGQHlBuGKIAEV8fbCDfKCCRS1tvOgc3Q==", "requires": { - "browserslist": "^4.7.2", - "caniuse-lite": "^1.0.30001006", + "browserslist": "^4.8.0", + "caniuse-lite": "^1.0.30001012", "chalk": "^2.4.2", "normalize-range": "^0.1.2", "num2fraction": "^1.2.2", - "postcss": "^7.0.21", + "postcss": "^7.0.23", "postcss-value-parser": "^4.0.2" + }, + "dependencies": { + "browserslist": { + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.8.0.tgz", + "integrity": "sha512-HYnxc/oLRWvJ3TsGegR0SRL/UDnknGq2s/a8dYYEO+kOQ9m9apKoS5oiathLKZdh/e9uE+/J3j92qPlGD/vTqA==", + "requires": { + "caniuse-lite": "^1.0.30001012", + "electron-to-chromium": "^1.3.317", + "node-releases": "^1.1.41" + } + }, + "caniuse-lite": { + "version": "1.0.30001013", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001013.tgz", + "integrity": "sha512-hOAXaWKuq/UVFgYawxIOdPdyMQdYcwOCDOjnZcKn7wCgFUrhP7smuNZjGLuJlPSgE6aRA4cRJ+bGSrhtEt7ZAg==" + }, + "electron-to-chromium": { + "version": "1.3.322", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.322.tgz", + "integrity": "sha512-Tc8JQEfGQ1MzfSzI/bTlSr7btJv/FFO7Yh6tanqVmIWOuNCu6/D1MilIEgLtmWqIrsv+o4IjpLAhgMBr/ncNAA==" + }, + "node-releases": { + "version": "1.1.42", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.42.tgz", + "integrity": "sha512-OQ/ESmUqGawI2PRX+XIRao44qWYBBfN54ImQYdWVTQqUckuejOg76ysSqDBK8NG3zwySRVnX36JwDQ6x+9GxzA==", + "requires": { + "semver": "^6.3.0" + } + }, + "postcss": { + "version": "7.0.23", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.23.tgz", + "integrity": "sha512-hOlMf3ouRIFXD+j2VJecwssTwbvsPGJVMzupptg+85WA+i7MwyrydmQAgY3R+m0Bc0exunhbJmijy8u8+vufuQ==", + "requires": { + "chalk": "^2.4.2", + "source-map": "^0.6.1", + "supports-color": "^6.1.0" + } + } } }, "aws-sign2": { @@ -1299,6 +1339,12 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" }, + "axe-core": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-3.4.0.tgz", + "integrity": "sha512-5C0OdgxPv/DrQguO6Taj5F1dY5OlkWg4SVmZIVABFYKWlnAc5WTLPzG+xJSgIwf2fmY+NiNGiZXhXx2qT0u/9Q==", + "dev": true + }, "babel-plugin-dynamic-import-node": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.0.tgz", @@ -2357,9 +2403,9 @@ } }, "cypress": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-3.6.0.tgz", - "integrity": "sha512-ODhbOrH1XZx0DUoYmJSvOSbEQjycNOpFYe7jOnHkT1+sdsn2+uqwAjZ1x982q3H4R/5iZjpSd50gd/iw2bofzg==", + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-3.7.0.tgz", + "integrity": "sha512-o+vfRxqAba8TduelzfZQ4WHmj2yNEjaoO2EuZ8dZ9pJpuW+WGtBGheKIp6zkoQsp8ZgFe8OoHh1i2mY8BDnMAw==", "dev": true, "requires": { "@cypress/listr-verbose-renderer": "0.4.1", @@ -2422,6 +2468,12 @@ } } }, + "cypress-axe": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/cypress-axe/-/cypress-axe-0.5.1.tgz", + "integrity": "sha512-oj+diADUnnjmiT7635kQuaDx7MG4nMk64oWCuDEIbWpe7Q3v+FzBE3ou8pg346LagGyqDFv8r7GYt6JWve6+Vg==", + "dev": true + }, "dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", @@ -2708,9 +2760,9 @@ } }, "elm-hot": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/elm-hot/-/elm-hot-1.1.3.tgz", - "integrity": "sha512-d2TvJ/jgtYI4z0PmjDinjojJh+i//yJkCeLbC0Ik1UAKl474RV8vEHHC6Wy0DNrvwOIneikutyuGIppeMxeIWA==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/elm-hot/-/elm-hot-1.1.4.tgz", + "integrity": "sha512-qPDP/o/Fkifriaxaf3E7hHFB5L6Ijihyg8is4A6xna6/h/zebUiNssbQrxywI2oxNUkr6W/leEu/WlIC1tmVnw==", "dev": true }, "emoji-regex": { @@ -6705,9 +6757,9 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "sass": { - "version": "1.23.3", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.23.3.tgz", - "integrity": "sha512-1DKRZxJMOh4Bme16AbWTyYeJAjTlrvw2+fWshHHaepeJfGq2soFZTnt0YhWit+bohtDu4LdyPoEj6VFD4APHog==", + "version": "1.23.7", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.23.7.tgz", + "integrity": "sha512-cYgc0fanwIpi0rXisGxl+/wadVQ/HX3RhpdRcjLdj2o2ye/sxUTpAxIhbmJy3PLQgRFbf6Pn8Jsrta2vdXcoOQ==", "requires": { "chokidar": ">=2.0.0 <4.0.0" } diff --git a/package.json b/package.json index 89e101d9c..34d17764e 100644 --- a/package.json +++ b/package.json @@ -9,17 +9,19 @@ "dependencies": { "@fullhuman/postcss-purgecss": "^1.3.0", "@types/parcel-env": "0.0.0", - "autoprefixer": "^9.7.1", + "autoprefixer": "^9.7.3", "elm": "^0.19.1-3", "node-elm-compiler": "^5.0.4", "parcel-bundler": "^1.12.4", "rimraf": "^3.0.0", - "sass": "^1.23.3", + "sass": "^1.23.7", "typescript": "^3.7.2" }, "devDependencies": { - "cypress": "^3.6.0", - "elm-hot": "^1.1.3", + "axe-core": "^3.4.0", + "cypress": "^3.7.0", + "cypress-axe": "^0.5.1", + "elm-hot": "^1.1.4", "start-server-and-test": "^1.10.6" }, "scripts": {