{"id":25010431,"url":"https://github.com/guisalmeida/a11y-analyzer","last_synced_at":"2025-07-07T12:09:39.445Z","repository":{"id":56796095,"uuid":"523365014","full_name":"guisalmeida/a11y-analyzer","owner":"guisalmeida","description":"A tool to help you make accessibility tests.","archived":false,"fork":false,"pushed_at":"2023-02-18T01:07:58.000Z","size":4491,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-04T20:19:12.333Z","etag":null,"topics":["a11y-testing","axe-core","cypress","cypress-axe","e2e-testing","wcag"],"latest_commit_sha":null,"homepage":"https://a11y-analyzer.netlify.app/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/guisalmeida.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-10T13:57:49.000Z","updated_at":"2024-07-30T18:27:56.000Z","dependencies_parsed_at":"2025-03-30T02:30:57.391Z","dependency_job_id":"f745db0f-c2da-49e5-929c-16c73d34434d","html_url":"https://github.com/guisalmeida/a11y-analyzer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/guisalmeida/a11y-analyzer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guisalmeida%2Fa11y-analyzer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guisalmeida%2Fa11y-analyzer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guisalmeida%2Fa11y-analyzer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guisalmeida%2Fa11y-analyzer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guisalmeida","download_url":"https://codeload.github.com/guisalmeida/a11y-analyzer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guisalmeida%2Fa11y-analyzer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263632057,"owners_count":23491530,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["a11y-testing","axe-core","cypress","cypress-axe","e2e-testing","wcag"],"created_at":"2025-02-05T04:53:28.569Z","updated_at":"2025-07-07T12:09:39.419Z","avatar_url":"https://github.com/guisalmeida.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A11Y Analyzer\n\n[![npm](https://img.shields.io/npm/v/a11y-analyzer.svg)](https://www.npmjs.com/package/a11y-analyzer)\n[![Cypress Tests](https://github.com/guisalmeida/a11y-analyzer/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/guisalmeida/a11y-analyzer/actions/workflows/main.yml)\n\nTest accessibility with in [Cypress](https://cypress.io).\n\n## Installation\n\n1. **Install `a11y-analyzer` from npm:**\n\n```sh\nnpm install --save-dev a11y-analyzer\n```\n\n2. **Install peer dependencies:**\n\n```sh\nnpm install --save-dev axe-core cypress cypress-axe cypress-terminal-report http-server start-server-and-test\n```\n3. **Configure Cypress.**\n\n- Run the command below:\n\n```js\nnpx cypress open\n```\n\nThen cypress will opens a window dialogue like this one:\n![Welcome cypress image](./public/assets/images/cypress-config1.png)  \nSelecting E2E Testing it will create a configuration environment for us.\n![Files for configuration](./public/assets/images/cypress-config2.png)  \nJust hit the continue button and select a browser to start testing.\nAfterwards you can create your first spec with Cypress in this interface or you can create your specs mannualy inside the folder `cypress/e2e`.\n![Create spec](./public/assets/images/cypress-config3.png)  \n![Create spec](./public/assets/images/cypress-config4.png)  \nAfter hit create and run your test inside the interface of tests of the Cypress.\n\n\n4. **Include the commands.**\n\n- Update `cypress/support/e2e.js` file to include the cypress-axe commands by adding:\n\n```js\nimport 'a11y-analyzer'\n```\n\n5. **Include the configuration.**\n\n- Update `cypress.config.js` file to include the a11y-analyzer commands by adding:\n\n```js\nconst { defineConfig } = require(\"cypress\");\n\nmodule.exports = defineConfig({\n  env: {\n    \"hideElements\": true              // To hide elements like XHR requests\n  },\n  e2e: {\n    baseUrl: 'http://localhost:8080', // Choose you localhost\n    screenshotOnRunFailure: false,    // Don't take screenshots\n    video: false,                     // Don't record videos\n    setupNodeEvents(on, config) {\n      require('cypress-terminal-report/src/installLogsPrinter')(on);\n    },\n  },\n});\n```\n\n\u003e NOTE: To use require import, make sure there ins't a `\"type\": \"module\",` inside your `package.json` and if using typescript and es6 imports ensure `esModuleInterop` is enabled.\n\n\n## Commands\n\n### cy.analyseA11y\n\nThis will inject the `axe-core` runtime into the page under test.\n\n\n```js\nit('Test', () =\u003e {\n  cy.analyseA11y('http://localhost:8080')\n})\n```\n\n\n\n### Examples\n\n#### Basic usage\n\n```js\ndescribe('Example tests', () =\u003e {  \n  it('Should log any accessibility failures', () =\u003e {\n    cy.analyseA11y('https://example.cypress.io');\n  })\n\n  it('Should execute ONLY specific elements on the page', () =\u003e {\n    cy.analyseA11y('https://example.cypress.io', '.container', null);\n  })\n  \n  it('Should exclude specific elements on the page', () =\u003e {\n    cy.analyseA11y('https://example.cypress.io', { exclude: ['.banner'] }, null);\n  })\n\n  it('Should ONLY include rules with serious and critical impacts', () =\u003e {\n    cy.analyseA11y('https://example.cypress.io', null, {\n      includedImpacts: ['critical', 'serious']\n    });\n  })\n\n  it('Should exclude specific accessibility rules', () =\u003e {\n    cy.analyseA11y('https://example.cypress.io', null, {\n      rules: {\n        'color-contrast': { enabled: false }\n      }\n    });\n  })\n\n  it('Should ONLY include rules with these levels of conformance', () =\u003e {\n    cy.analyseA11y('https://example.cypress.io', null, {\n      runOnly: {\n          type: 'tag',\n          values: ['wcag2a', 'wcag2aa']\n        }\n      }\n    );\n  })\n})\n```\n\n## Standard Output\n\nWhen accessibility violations are detected, your test will fail and an entry titled \"A11Y ERROR!\" will be added to the command log for each type of violation found (they will be above the failed assertion). Clicking on those will can see where they are on screen and more like impact and a link to a documentation from Axe-core.\n\n![Cypress and DevTools output for passing and failing axe-core audits](./public/assets/images/cypress-config5.png)\n\nA similar output is present on terminal and on CI logs.\n![Terminal](./public/assets/images/terminal.png)\n\n## Authors\n\nThe project was created by [Guilherme Almeida](https://guisalmeida.com/).\n\n## Contributors\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n\n## License\n\nMIT License, see the included [License.md](License.md) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguisalmeida%2Fa11y-analyzer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguisalmeida%2Fa11y-analyzer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguisalmeida%2Fa11y-analyzer/lists"}