Skip to content

Improve url display in summary by filtering specific query parameters

What problem do you want to solve?

Dynamic URLs from APIs or after logins might contain certain query parameters that are uneccesary or sensitive. It would be nice if the shortening of URLs for the display in CLI output removes those query parameters prior to displaying them. A similar issue was openend for the filenames of HTML reports

What is the proposed solution?

Similar to issue 130 remove specified query parameters from the urls before outputting them on cli. It would be nice if the same environment variable (or config setting) could be used for the configuration of which params to skip in output.

Application version

Latest puppeteer with latest versions of @aarongoldenthal/pa11y and @aarongoldenthal/pa11y-ci

Thanks for updating the dependencies in the forks!

Additional details

Configuration of such settings via environment variables allows overriding the defaults without own copies of the configuration (think: gitlab accessibility template). I introduced several settings via environment variabes in my configuration (as the gitlab template couldn't be used due to specific config needs).

Example:

  • PA11Y_URLS: space separated list of urls to test with pa11y-ci (default: empty)
  • PA11Y_REPORTS_FOLDER: path to store testing artifacts like html reports and screenshots into (defaults to $CI_PROJECT_DIR/reports)
  • PA11Y_SCREENSHOTS: set to on/always to take screenshots of the tested urls (defaults to no)
  • PA11Y_SCREENSHOTS_WAIT: time in milliseconds to wait before taking a screenshot (defaults to 300)
  • PA11Y_URL_PARAMS_FILENAME_FILTER: comma separated list of url query parameters to ignore when created filename for screenshots (defaults to hash,secret,ck,session,sid,sessionid…)
  • PA11Y_TIMEOUT: page timeout in milliseconds for pa11y (defaults to 5000)
  • PA11Y_EXCLUDE_NOTICES: use "yes" to exclude notices from pa11y reports (default no)
  • PA11Y_EXCLUDE_WARNINGS: use "yes" to exclude warnings from pa11y reports (default no)
  • PA11Y_STANDARD: to configure the standard to use in pa11y (defaults to WCAG2AAA)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information