Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2 Use the Axe runner instead of the standard runner #5

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ FROM dcycle/browsertesting:3

RUN mkdir -p /app/code

RUN cd /app && npm install pa11y
RUN cd /app && npm install pa11y pa11y-runner-axe

WORKDIR /app

ADD docker-resources/config.json /app/config/config.json

ADD docker-resources/calc-threshold.py /scripts/calc-threshold.py

ENTRYPOINT [ "node_modules/.bin/pa11y", "-c", "/app/config/config.json" ]
ENTRYPOINT [ "node_modules/.bin/pa11y", "--runner", "axe", "-c", "/app/config/config.json" ]
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,39 @@ Find accessibility problems with [Pa11y](https://github.com/pa11y/pa11y)

Get help:

docker run --rm dcycle/pa11y:1
docker run --rm dcycle/pa11y:2

Run pa11y on amazon.com:

docker run --rm dcycle/pa11y:1 https://amazon.com
docker run --rm dcycle/pa11y:2 https://amazon.com

See [this project on the Docker Hub](https://hub.docker.com/r/dcycle/pa11y/).

About the Axe runner
-----

Version 1 of this image (dcycle/pa11y:1) uses the standard pa11y runner. A more standard alternative, the [https://www.deque.com/axe/](Axe runner), can be used as the engine instead. That is what is used on branch 2 (dcycle/pa11y:2).

Thresholds
-----

One technique to avoid being overwhelmed by dozens, or hundreds of accessibility errors on a legacy site is to define thresholds. For example, you might want to accept 100 errors on a site but not more; in which case you can do:

docker run --rm dcycle/pa11y:1 https://example.com -T 100
docker run --rm dcycle/pa11y:2 https://example.com -T 100

Thresholds diminishing with time
-----

This image ships with a utility allowing to define diminishing thresholds. For example if your team decides that you want to go from a threshold of 100 errors on Jan 1st, 2019, to a threshold of 50 errors on Jan 1st, 2020, you can run:

THRESHOLD=$(docker run --rm --entrypoint='/bin/bash' dcycle/pa11y:1 -c \
THRESHOLD=$(docker run --rm --entrypoint='/bin/bash' dcycle/pa11y:2 -c \
'export start_date=2019-01-01; \
export start_threshold=100; \
export end_date=2020-01-01; \
export end_threshold=50; \
export verbose=0; \
python /scripts/calc-threshold.py')
docker run --rm dcycle/pa11y:1 https://example.com -T "$THRESHOLD"
docker run --rm dcycle/pa11y:2 https://example.com -T "$THRESHOLD"

How to run a test on a local website managed through Docker Compose
-----
Expand Down Expand Up @@ -60,7 +65,7 @@ First, find the network name for your project, this is normally something like "

In the above example it's myproject_default. Now to get an accessibility report during local development or continuous integration, run:

docker run --rm --network myproject_default dcycle/pa11y:1 http://web
docker run --rm --network myproject_default dcycle/pa11y:2 http://web

In the above example, the network name is "myproject_default" and the service name is "web" (which corresponds to the name of the service in the docker-compose.yml file).

Expand Down
2 changes: 1 addition & 1 deletion test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ docker pull dcycle/browsertesting:3
docker pull dcycle/pa11y
docker build -t local-dcycle-pa11y-image .

docker run --rm dcycle/pa11y:1
docker run --rm dcycle/pa11y:2
docker run --rm local-dcycle-pa11y-image

docker run --rm --entrypoint='/bin/bash' local-dcycle-pa11y-image -c \
Expand Down