{"id":20923792,"url":"https://github.com/patternfly/patternfly-a11y","last_synced_at":"2025-05-13T16:30:43.137Z","repository":{"id":36253109,"uuid":"222769540","full_name":"patternfly/patternfly-a11y","owner":"patternfly","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-29T05:28:36.000Z","size":9692,"stargazers_count":10,"open_issues_count":11,"forks_count":13,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-05-02T00:33:33.096Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","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/patternfly.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":"2019-11-19T19:08:22.000Z","updated_at":"2025-02-17T21:39:23.000Z","dependencies_parsed_at":"2024-04-09T22:34:17.084Z","dependency_job_id":"582b382e-5e5e-467b-8c29-31e38f51a44a","html_url":"https://github.com/patternfly/patternfly-a11y","commit_stats":{"total_commits":90,"total_committers":8,"mean_commits":11.25,"dds":0.5666666666666667,"last_synced_commit":"65907bdcf81831488b32e0193b63b114fdd3d8ed"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patternfly%2Fpatternfly-a11y","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patternfly%2Fpatternfly-a11y/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patternfly%2Fpatternfly-a11y/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patternfly%2Fpatternfly-a11y/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patternfly","download_url":"https://codeload.github.com/patternfly/patternfly-a11y/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253981663,"owners_count":21994314,"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":["hacktoberfest"],"created_at":"2024-11-18T20:17:46.231Z","updated_at":"2025-05-13T16:30:42.689Z","avatar_url":"https://github.com/patternfly.png","language":"JavaScript","readme":"# patternfly-a11y\n\nThis is a CLI tool developed for [patternfly-react](https://github.com/patternfly/patternfly-react/), [patternfly-next](https://github.com/patternfly/patternfly-next/), and [patternfly-org](https://github.com/patternfly/patternfly-org/) to run [axe](https://www.deque.com/axe/) in Selenium on a list of urls. It has options suited to our needs but should work as an integration test for any project.\n\nIt outputs a coverage directory with a webpack-built report, as well as:\n  - report.json: full axe output per-url\n  - report.xml: junit coverage grouped into test cases\n  - report.html: more readable html report of report.xml\n\n## Usage\n\n```sh\npatternfly-a11y [command]\n\npatternfly-a11y --help\n\nCommands:\n  patternfly-a11y \u003cfile\u003e  Audit a list of URLs in JSON file\n\nOptions:\n  -V, --version                output the version number\n  -c, --config \u003cfile\u003e          Path to config file\n  -p, --prefix \u003cprefix\u003e        Prefix for listed urls (like https://localhost:9000)\n  -cr, --crawl                 Whether to crawl URLs for more URLs (default: false)\n  --no-code-on-fail            By default, exit code 1 is returned on test failures, and 2 if there are incomplete tests, this disables that\n  -s, --skip \u003cregex\u003e           Regex of pages to skip\n  -a, --aggregate              Whether to aggregate tests by component (by splitting URL) in XML report (default: false)\n  --no-screenshots             Whether to save screenshots of visited pages\n  -ir, --ignore-rules \u003crules\u003e  Axe: Comma-separated list of error ids to ignore (default: \"color-contrast\")\n  -iI, --ignore-incomplete     Axe: Whether to ignore incomplete errors (default: false)\n  -t, --tags \u003ctags\u003e            Axe: Comma-separated list of accessibility (WCAG) tags to run against (default: \"wcag2a,wcag2aa\")\n  -ctx, --context \u003ccontext\u003e    Axe: Context to run in, defaults to document, can be set to a different selector, i.e. document.getElementById(\"content\")\n                               (default: \"document\")\n  -h, --help                   display help for command\n```\n\n## Getting started\n\n`yarn add @patternfly/patternfly-a11y`\n\nthen\n\n`yarn exec patternfly-a11y [json-list-of-urls]`\n\nOR\n\n`yarn exec patternfly-a11y --prefix http://localhost:9000 --crawl /dashboard`\n\nFor more advanced usage, you can create a config file\n\n`yarn exec patternfly-a11y --config a11y-config.js`\n\nSample configuration file (a11y-config.js)\n\n```\n/**\n* page: pupeteer page object, for more information see\n* https://pptr.dev/#?product=Puppeteer\u0026version=v3.3.0\u0026show=api-class-page\n*\n* data: contains the options passed in\n*/\nasync function login({ page, data }) {\n  const user = \"user\";\n  const pass = \"pass\";\n  await page.waitForSelector(\"#inputUsername\");\n  await page.type(\"#inputUsername\", user);\n  await page.type(\"#inputPassword\", pass);\n  await page.click(\"button.pf-c-button\");\n  await page.waitForNavigation();\n  await delay(1000);\n}\n/**\n* page: pupeteer page object, for more information see\n* https://pptr.dev/#?product=Puppeteer\u0026version=v3.3.0\u0026show=api-class-page\n*/\nasync function waitForSpinner(page) {\n  // there should be no loading spinner\n  await page.waitForSelector(\".loading-spinner\", {\n    hidden: true,\n  });\n}\nmodule.exports = {\n  // the root of the URLs to test\n  prefix: \"https://my-website.com\",\n  // If you need to authenticate/login you can specify a function here\n  auth: login,\n  // if there are common elements to wait for on pages to test can specify here\n  waitFor: waitForSpinner,\n  // if you want axe to only test a subset of the document you can specify it here, defaults to the entire document\n  context: 'document.getElementById(\"page\")',\n  // we define our own list of URLs to test\n  crawl: false,\n  // urls can contain strings or objects for more control\n  urls: [\n    \"/dashboards\",\n    {\n      url: \"/projects\",\n      label: \"projects page\",\n      afterNav: async (page) =\u003e {\n        // pupeteer page object, for more information see\n        // https://pptr.dev/#?product=Puppeteer\u0026version=v3.3.0\u0026show=api-class-page\n        await page.waitForSelector(\".some-element-to-wait-for\");\n      },\n    },\n    \"/k8s/cluster/projects/default\",\n    \"/search/ns/default\",\n    \"/api-explorer\"\n  ],\n};\n```\n\n## Production build\nIf updating the source under the report/ directory, create a new webpack build by running `yarn build`, which outputs the site to report/dist.\nWhenever the patternfly-a11y CLI tool is run, it generates a coverage folder at the root, and copies the report/dist files into it, so that the full report can be served up.\n\n### Serve/view production build (example)\nnpx serve coverage\n\n## Development build\nTo work on and update the react report app, first a coverage/ report needs to exist.\n1. Run a `./cli.js` CLI command to create the coverage/ report folder.\n1. Run `yarn dev` to launch the react app, it will copy files from the coverage/ report folder into the report/static folder.\n\nPRs and issues are welcome.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatternfly%2Fpatternfly-a11y","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatternfly%2Fpatternfly-a11y","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatternfly%2Fpatternfly-a11y/lists"}