debian-mirror-gitlab/doc/user/project/merge_requests/accessibility_testing.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

77 lines
3.3 KiB
Markdown
Raw Normal View History

2020-04-08 14:13:33 +05:30
---
2020-07-28 23:09:34 +05:30
stage: Verify
2022-04-04 11:22:00 +05:30
group: Pipeline Insights
2021-02-22 17:27:13 +05:30
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
2020-04-08 14:13:33 +05:30
---
2021-09-04 01:27:46 +05:30
# Accessibility testing **(FREE)**
2020-04-08 14:13:33 +05:30
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/25144) in GitLab 12.8.
2022-03-02 08:16:31 +05:30
If your application offers a web interface, you can use
[GitLab CI/CD](../../../ci/index.md) to determine the accessibility
2020-04-08 14:13:33 +05:30
impact of pending code changes.
2022-03-02 08:16:31 +05:30
[Pa11y](https://pa11y.org/) is a free and open source tool for
measuring the accessibility of web sites. GitLab integrates Pa11y into a
2021-09-04 01:27:46 +05:30
[CI job template](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Verify/Accessibility.gitlab-ci.yml).
2022-03-02 08:16:31 +05:30
The `a11y` job analyzes a defined set of web pages and reports
accessibility violations, warnings, and notices in a file named
`accessibility`.
2020-04-08 14:13:33 +05:30
2022-03-02 08:16:31 +05:30
As of [GitLab 14.5](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/73309), Pa11y uses
[WCAG 2.1 rules](https://www.w3.org/TR/WCAG21/#new-features-in-wcag-2-1).
2021-12-11 22:18:48 +05:30
2021-09-04 01:27:46 +05:30
## Accessibility merge request widget
2020-05-24 23:13:21 +05:30
2020-07-28 23:09:34 +05:30
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/39425) in GitLab 13.0 behind the disabled [feature flag](../../../administration/feature_flags.md) `:accessibility_report_view`.
> - [Feature Flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/217372) in GitLab 13.1.
2022-03-02 08:16:31 +05:30
GitLab displays an **Accessibility Report** in the merge request widget area:
2020-05-24 23:13:21 +05:30
2021-09-04 01:27:46 +05:30
![Accessibility merge request widget](img/accessibility_mr_widget_v13_0.png)
2020-05-24 23:13:21 +05:30
2022-03-02 08:16:31 +05:30
## Configure accessibility testing
2020-04-08 14:13:33 +05:30
2022-03-02 08:16:31 +05:30
You can run Pa11y with GitLab CI/CD using the
[GitLab Accessibility Docker image](https://gitlab.com/gitlab-org/ci-cd/accessibility).
2020-04-08 14:13:33 +05:30
2022-03-02 08:16:31 +05:30
To define the `a11y` job for GitLab 12.9 and later:
2020-04-08 14:13:33 +05:30
2022-03-02 08:16:31 +05:30
1. [Include](../../../ci/yaml/index.md#includetemplate) the
[`Accessibility.gitlab-ci.yml` template](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Verify/Accessibility.gitlab-ci.yml)
from your GitLab installation.
1. Add the following configuration to your `.gitlab-ci.yml` file.
2020-04-22 19:07:51 +05:30
2022-03-02 08:16:31 +05:30
```yaml
stages:
- accessibility
variables:
a11y_urls: "https://about.gitlab.com https://gitlab.com/users/sign_in"
include:
- template: "Verify/Accessibility.gitlab-ci.yml"
```
2020-04-08 14:13:33 +05:30
2022-03-02 08:16:31 +05:30
1. Customize the `a11y_urls` variable to list the URLs of the web pages to test with Pa11y.
2020-04-08 14:13:33 +05:30
2022-03-02 08:16:31 +05:30
The `a11y` job in your CI/CD pipeline generates these files:
2020-04-08 14:13:33 +05:30
2022-03-02 08:16:31 +05:30
- One HTML report per URL listed in the `a11y_urls` variable.
- One file containing the collected report data. In GitLab versions 12.11 and later, this
file is named `gl-accessibility.json`. In GitLab versions 12.10 and earlier, this file
is named [`accessibility.json`](https://gitlab.com/gitlab-org/ci-cd/accessibility/-/merge_requests/9).
2020-04-08 14:13:33 +05:30
2022-03-02 08:16:31 +05:30
You can [view job artifacts in your browser](../../../ci/pipelines/job_artifacts.md#download-job-artifacts).
2020-05-24 23:13:21 +05:30
2021-02-22 17:27:13 +05:30
NOTE:
2022-03-02 08:16:31 +05:30
For GitLab versions earlier than 12.9, use `include:remote` and
2021-09-04 01:27:46 +05:30
link to the [current template in the default branch](https://gitlab.com/gitlab-org/gitlab/-/raw/master/lib/gitlab/ci/templates/Verify/Accessibility.gitlab-ci.yml)
2020-04-08 14:13:33 +05:30
2021-02-22 17:27:13 +05:30
NOTE:
2022-03-02 08:16:31 +05:30
The job definition provided by the template does not support Kubernetes.
2020-04-08 14:13:33 +05:30
2022-03-02 08:16:31 +05:30
You cannot pass configurations into Pa11y via CI configuration.
To change the configuration, edit a copy of the template in your CI file.