Skip to content

Metadrop/ddev-pa11y

Repository files navigation

tests project is maintained GitHub Release

DDEV Pa11y Add-on

What is DDEV Pa11y Add-on?

This repository provides a DDEV add-on for the Pa11y service. Pa11y is an automated accessibility testing tool that helps developers make their web applications more accessible.

This is optimized for Aljibe projects, but can be used in any DDEV project.

In DDEV, addons can be installed from the command line using the ddev add-on get command, for example, ddev add-on get Metadrop/ddev-pa11y.

Components of the repository

  • The fundamental contents of the Pa11y addon. For example, in this template there is a docker-compose.pa11y.yaml file.
  • An install.yaml file that describes how to install the Pa11y service.
  • A test suite in test.bats that makes sure the Pa11y service continues to work as expected.
  • Github actions setup so that the tests run automatically when you push to the repository.

Getting started

  1. Install the Pa11y service in your DDEV project.

    For DDEV v1.23.5 or above run

    ddev add-on get Metadrop/ddev-pa11y

    For earlier versions of DDEV run

    ddev get Metadrop/ddev-pa11y
  2. Start the DDEV project with ddev start or ddev restartif already started.

  3. Run the Pa11y service with ddev pa11y http://metadrop.net --reporter=junit --standard WCAG2A.

Customizing the Pa11y configuration

The Pa11y configuration can be customized by update the custom .json file inside tests/pa11y folder. For example, you can create a file called tests/pa11y/config.json with the following content:

{
   "chromeLaunchConfig": {
      "args": ["--no-sandbox"],
      "ignoreHTTPSErrors": true
   }, 
  "hideElements": ".skip-a11y",
  "ignore": [
    "WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail"
  ]
}

To use this config file, you can run the Pa11y service with the following command: ddev pa11y http://example.com --config=/tests/pa11y/config.json --reporter=junit.

Contributed and maintained by @Metadrop