Skip to content

Set up cypress real events for automated accessibility tests

Enrique Alcántara requested to merge ealcantara-cypress-a11y-tests into main

What does this MR do?

This Merge Request sets up the cypress-real-events library to trigger native hover events in Cypress tests. This change aims to enable automated accessibility tests to run axe checks in a component's hover state. By default, Cypress simulated events can't trigger a hover state that displays a component's CSS changes.

A disadvantage of the cypress-real-events library is that it only works on the Chrome web browser. To circumvent this limitation, this merge request also runs the accessibility tests in a separate job that targets this web browser. It uses the @cypress/grep package to target accessibility tests from the command line.

These changes are organized four commits:

  1. !3796 (71fb8158) adds the @cypress/grep dependency and create a command to run the a11y tests in isolation.
  2. !3796 (fe4cfa54) tags existing a11y tests.
  3. !3796 (48499fac) adds a a11y test for GlLabel's hover state.
  4. !3796 (8fd12e77) documents the workflow changes.

Screenshots or screen recordings

This Merge Request does not introduce user-facing changes.

Integration merge requests

Does this MR meet the acceptance criteria?

This checklist encourages the authors, reviewers, and maintainers of merge requests (MRs) to confirm changes were analyzed for conformity with the project's guidelines, security and accessibility.

Toggle the acceptance checklist

Conformity

  • Code review guidelines.
  • GitLab UI's contributing guidelines.
  • If it changes a Pajamas-compliant component's look & feel, the MR has been reviewed by a UX designer.
  • If it changes GitLab UI's documentation guidelines, the MR has been reviewed by a Technical Writer.
  • If the MR changes a component's API, integration MR(s) have been opened (see integration merge requests above).
  • Added the ~"component:*" label(s) if applicable.

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • Security reports checked/validated by a reviewer from the AppSec team

Accessibility

If this MR adds or modifies a component, take a few moments to review the following:

  • All actions and functionality can be done with a keyboard.
  • Links, buttons, and controls have a visible focus state.
  • All content is presented in text or with a text equivalent. For example, alt text for SVG, or aria-label for icons that have meaning or perform actions.
  • Changes in a component’s state are announced by a screen reader. For example, changing aria-expanded="false" to aria-expanded="true" when an accordion is expanded.
  • Color combinations have sufficient contrast.
Edited by Enrique Alcántara

Merge request reports