How to Improve Your Apps with Cypress Accessibility Testing

Sauce AI for Test Authoring: Move from intent to execution in minutes.|xBack to ResourcesBlogPosted

January 21, 2026 · 13 min read · Accessibility

Sauce AI for Test Authoring: Move from intent to execution in minutes.

|

x

Back to Resources

Blog

Posted January 23, 2025

How to Improve Your Apps with Cypress Accessibility Testing

Ensure your apps are accessible for your exploiter and to follow compliance.Cypress has emerged as a powerful tool to make sure web applications meet tight quality standards, learn more in this article.

quote

Over 1.3 billion citizenry worldwide live with disabilities. Ensuring your web covering are accessible isn & # x27; t precisely about compliance;. Web accessibility isn & # x27; t just a nice-to-have feature anymore—it & # x27; s a fundamental requirement.

Known for its real-time examination capacity and developer-friendly interface, Cypress has emerge as a potent tool for ensuring web covering meet rigorous character measure. When combined with accessibility testing tools, Cypress provides a foundation for edifice and maintaining accessible web applications that comply with standards like the European Accessibility Act (EAA) and Web Content Accessibility Guidelines (WCAG).

By integrating Cypress accessibility testing into your development workflow, you can automate the detection of handiness issues early in the development cycle, saving time and resources while check your applications remain accessible to all exploiter.


What Is Accessibility Testing?

is a specialized form of usability testing contrive to ensure that web applications and websites are usable by people with disabilities, include optic, auditive, physical, speech, cognitive, and neurologic disabilities. This type of examine verifies that your digital products comply with accessibility standards and guidelines while providing an equitable experience for all users.

Companies implementing accessibility testing strategy often profit from:

  • Increased user date and satisfaction

  • Better market reach and customer base

  • Reduced effectual risks

Types of Accessibility Testing

1. Automated Testing

can quickly skim your coating for common availability violations, making it an efficient first line of defense. These tools can place number such as:

  • Missing alt text for images

  • Insufficient color contrast

  • Improper header hierarchy

  • Keyboard navigation number

However, automated testing has restriction. While it can catch up to 40 % of accessibility issues, it can & # x27; t fully evaluate user experience or context-dependent accessibility essential.

2. Manual Testing

Manual accessibility try involves human examiner consistently critique your application using the following:

  • Screen reader

  • Keyboard-only navigation

  • Various assistive engineering

  • Different devices and browsers

[How are manual and automated testing better together? to happen out].

This approach is essential for identify nuanced accessibility subject that automated puppet might miss, such as:

  • Meaningful alt textbook quality

  • Logical indication order

  • Appropriate ARIA label usage

  • Context-dependent interaction

3. Hybrid Testing

The well-nigh effective approaching combines both automated and manual testing method. This hybrid scheme:

  • Uses automated tools for rapid, consistent testing of canonic availability requirements

  • Employs manual testing for in-depth valuation of user experience

  • Leverages human expertise for context-specific accessibility decisions

  • Provides comprehensive reporting of both technical and experiential accessibility panorama

Using Cypress For Accessibility Testing

Cypress has issue as a leading framework for approachability testing, offering various unique advantages that get it particularly well-suited for ensuring web accessibility compliance.

Key Features for Accessibility Testing

  1. Real-Time Execution

    • Tests run directly in the browser

    • Immediate feedback on availableness violations

    • Debug accessibility matter in real-time

  2. Automatic Waiting

    • No need for contrived timeouts

    • Reliable testing of dynamic content

    • Coherent results across different page consignment multiplication

  3. Modern Architecture

    • Native admission to all web APIs

    • Direct DOM manipulation capabilities

    • Support for modern web frameworks

Getting Started: Prerequisites for Cypress Accessibility Testing

If this is your initiatory clip using Cypress, please see our.

Before diving into Cypress accessibility testing, check you have the following prerequisites in place:

Required Software and Tools

  • Node.js (version 18 or higher)

  • npm or yarn packet handler

  • A modern code editor (VS Code urge)

  • Git for version control

  • Chrome browser (a recent version of the chrome browser)

Knowledge Prerequisites

Pro tip: Tools like SUSA can handle this autonomously — upload your app and get results without writing a single test script.

  • Basic sympathy of JavaScript/TypeScript

  • Familiarity with web ontogenesis concepts

  • Understanding of HTML and DOM construction

  • Basic cognition of accessibility standards (WCAG)

Development Environment Setup

  1. Create a new project directory

  2. Initialize a new Node.js project:

mkdir cypress-accessibility-testing

cd cypress-accessibility-testing

npm init -y

Step-by-Step: Setting Up Cypress for Accessibility Testing

Installing Cypress

The following uses npm to instal packages. In suit you ’ d like to use yarn, delight see instead.

1. Install Cypress as a dev colony:

npm install cypress -- save-dev

2. Install required dependencies:

npm install cypress-axe axe-core -- save-dev

npm install http-server -- save-dev

3. Update your package.json to include the start handwriting:

{

& quot; scripts & quot;: {

& quot; start & quot;: & quot; http-server. -p 3000 & quot;

  }

}

Creating a Sample Application

Create an index.html file in your project root:

1
<!DOCTYPE html>
2
<html lang=& quot; en & quot;>
3
<head>
4
<meta charset=& quot; UTF-8 & quot;>
5
<meta name=& quot; viewport & quot; content=& quot; width=device-width, initial-scale=1.0 & quot;>
6
<title>CypressAccessibilityDemo</title>
7
<style>
8
.card{
9
border:1px solid # ddd;
10
padding: 20px;
11
margin: 20px;
12
max-width: 300px;
13
}
14
</style>
15
</head>
16
<body>
17
<!--Addedheader watershed-->
18
<header office=& quot; banner & quot;>
19
<nav role=& quot; pilotage & quot;>
20
<!--Navigationmessage would go here-->
21
</nav>
22
</header>
23
24
<!--Addedprincipal watershed-->
25
<main role=& quot; main & quot;>
26
<div class=& quot; card & quot;>
27
<h1>Welcome</h1>
28
<img src=& quot; placeholder.jpg & quot; alt=& quot; Welcome ikon for demonstration & quot;>
29
<button style=& quot; background: # 2b2b2b; color: # ffffff; & quot;>HighContrastButton</button>
30
</div>
31
</main>
32
33
<!--Addedfooter landmark-->
34
<footer role=& quot; contentinfo & quot;>
35
<!--Footercontent would go here-->
36
</footer>
37
</body>
38
</html>
39


Setting Up Cypress

Use our guide to.

Sauce Labs can also seamlessly run tests on Cypress across different browser. It support most popular model and has emulators, simulators, and real device. You can get start using Cypress and Sauce Labs with our.

Make your apps more approachable in minutes

Configuring Cypress for Accessibility Testing

  1. Configure the support file(cypress/support/e2e.js):

// Import cypress-axe

import & # x27; cypress-axe & # x27;

2. Back in Chrome, select “ Create new specification ”.

3. Name the file accessibility.cy.js and run the spec.

4. This is your initiative test file; you can edit it back in VC Code. You can use the following as a starting point.

1
describe(& # x27; Accessibility Tests & # x27;,()=>{
2
beforeEach(()=>{
3
// Visit our test page
4
cy.visit(& # x27; & lt; http: //localhost:3000 & gt; & # x27;)
5
// Inject the axe-core library
6
cy.injectAxe()
7
})
8
9
it(& # x27; should check for accessibility violations & # x27;,()=>{
10
// Check for accessibility violations on the page
11
cy.checkA11y()
12
})
13
14
it(& # x27; should verify image alt attribute & # x27;,()=>{
15
cy.get(& # x27; img & # x27;).each(($el)=>{
16
cy.wrap($el)
17
.should(& # x27; have.attr & # x27;,& # x27; alt & # x27;)
18
.and(& # x27; not.be.empty & # x27;)
19
})
20
})
21
22
it(& # x27; should verify color contrast & # x27;,()=>{
23
cy.checkA11y(null,{
24
runOnly:{
25
type:& # x27; rule & # x27;,
26
values:[& # x27; color-contrast & # x27;]
27
}
28
})
29
})
30
})
31

Running Your Tests

  1. Start your application host:

npm start

2. Back in Chrome, if you haven ’ t run the spec already, you can click on & quot; accessibility.cy.js & quot;, under “ Specs ” in the left-hand tab, to run your trial.

screenshot of cypress e2e specs

3. You should see all of your tests surpass

screenshot of cypress e2e test pass

Common Accessibility Issues and How To Fix Them

Here are some common accessibility issues you might encounter and how to fix them:

  • Missing Landmarks

  • Error: landmark-one-main

  • Fix: Add & lt; principal role= & quot; main & quot; & gt; to your content

  • Empty Alt Text

  • Error: empty-alt-attribute

  • Fix: Add meaningful alt text to images

  • Color Contrast

  • Error: color-contrast

  • Fix: Ensure sufficient demarcation between text and ground colors

Also read:

Advanced Test Configuration

For more specific try scenarios:

1
describe(& # x27; Advanced Accessibility Checks & # x27;,()=>{
2
beforeEach(()=>{
3
cy.visit(& # x27; & lt; http: //localhost:3000 & gt; & # x27;)
4
cy.injectAxe()
5
})
6
7
// Test particular sections
8
it(& # x27; should verify main substance accessibility & # x27;,()=>{
9
cy.checkA11y(& # x27; main & # x27;,{
10
runOnly:{
11
type:& # x27; tag & # x27;,
12
values:[& # x27; wcag2a & # x27;,& # x27; wcag2aa & # x27;]
13
}
14
})
15
})
16
17
// Test keyboard pilotage
18
it(& # x27; should indorse keyboard navigation & # x27;,()=>{
19
cy.get(& # x27; button & # x27;)
20
.focus()
21
.should(& # x27; have.focus & # x27;)
22
.type(& # x27; {enter} & # x27;)
23
})
24
})
25

More In-Depth Accessibility Testing Techniques

1. Testing Complex UI Components

Modern web applications often include complex UI components like modal, carrousel, and dynamical descriptor. Here & # x27; s how to efficaciously test these components:

1
describe(& # x27; Complex UI Component Accessibility Tests & # x27;,()=>{
2
beforeEach(()=>{
3
cy.visit(& # x27; /advanced-components & # x27;)
4
cy.injectAxe()
5
})
6
7
it(& # x27; should maintain availability during average interaction & # x27;,()=>{
8
// Test modal accessibility lifecycle
9
cy.get(& # x27; [data-cy= & quot; open-modal & quot;] & # x27;).click()
10
11
// Check centering snare
12
cy.focused()
13
.should(& # x27; have.attr & # x27;,& # x27; persona & # x27;,& # x27; duologue & # x27;)
14
15
// Verify escape key functionality
16
cy.realPress(& # x27; Escape & # x27;)
17
cy.get(& # x27; [data-cy= & quot; modal & quot;] & # x27;)
18
.should(& # x27; not.be.visible & # x27;)
19
20
// Verify focus returns to trigger
21
cy.focused()
22
.should(& # x27; have.attr & # x27;,& # x27; data-cy & # x27;,& # x27; open-modal & # x27;)
23
})
24
25
it(& # x27; should handle carrousel accessibility & # x27;,()=>{
26
constcarouselTest=()=>{
27
cy.checkA11y(& # x27; [data-cy= & quot; merry-go-round & quot;] & # x27;,{
28
rules:{
29
& # x27; aria-hidden-focus & # x27;:{enabled:true},
30
& # x27; button-name & # x27;:{enabled:true}
31
}
32
})
33
34
// Test keyboard seafaring
35
cy.focused()
36
.realPress(& # x27; ArrowRight & # x27;)
37
.should(& # x27; have.attr & # x27;,& # x27; aria-label & # x27;)
38
}
39
40
cy.get(& # x27; [data-cy= & quot; whirligig & quot;] & # x27;)
41
.focus()
42
.then(carouselTest)
43
})
44
})
45

2. Handling Dynamic Content

For dynamic substance, implement observers and custom wait scheme

1
Cypress.Commands.add(& # x27; waitForAccessibilityCheck & # x27;,(selector, options ={})=>{
2
constdefaultOptions={
3
timeout:10000,
4
interval:100
5
}
6
7
constfinalOptions={...defaultOptions,...options }
8
9
returnnewCypress.Promise((resolve, reject)=>{
10
constcheck=()=>{
11
cy.get(selector)
12
.then($el=>{
13
if($el.length){
14
cy.checkA11y(selector)
15
resolve()
16
}elseif(finalOptions.timeout<=0){
17
reject(newError(& # x27; Element ne'er turn uncommitted & # x27;))
18
}else{
19
setTimeout(()=>{
20
finalOptions.timeout-=finalOptions.interval
21
check()
22
},finalOptions.interval)
23
}
24
})
25
}
26
check()
27
})
28
})
29


Cypress Accessibility Testing Best Practices

  • Integrate accessibility testing early on in the growing procedure

  • Include accessibility checks in your CI/CD pipeline

  • Run tests before each commit using git hooks

  • Set up automated testing schedule

  • Implement custom bid for comprehensive testing

  • Document accessibility requirements in Cypress:

1
// cypress/fixtures/accessibility-requirements.json
2
{
3
& quot; component & quot;:{
4
& quot; Button & quot;:{
5
& quot; requirements & quot;:[
6
& quot; Must be keyboard accessible & quot;,
7
& quot; Must have sufficient color line & quot;,
8
& quot; Must have appropriate ARIA labels & quot;
9
],
10
& quot; wcagCriteria & quot;:[& quot; 2.1.1 & quot;,& quot; 1.4.3 & quot;,& quot; 4.1.2 & quot;]
11
}
12
}
13
}
14
  • Ensure you & # x27; re following WCAG and EAA Compliance. You can keep a conformity checklist in your tests:

1
describe(& # x27; WCAG 2.1 Compliance Tests & # x27;,()=>{
2
it(& # x27; should meet Level AA necessary & # x27;,()=>{
3
cy.testAccessibility({
4
runOnly:{
5
type:& # x27; tag & # x27;,
6
values:[& # x27; wcag2aa & # x27;]
7
}
8
})
9
})
10
11
it(& # x27; should meet EAA requirements & # x27;,()=>{
12
cy.testAccessibility({
13
rules:{
14
& # x27; aria-required-attr & # x27;:{enabled:true},
15
& # x27; html-has-lang & # x27;:{enabled:true},
16
& # x27; landmark-one-main & # x27;:{enabled:true}
17
}
18
})
19
})
20
})
21


Let ’ s Make Your Apps More Accessible

Cypress accessibility testing symbolise a essential stride toward creating truly inclusive digital experiences. By combining automated testing with cloud-based solutions like Sauce Labs, teams can:

  • Detect and prevent approachability issues early

  • Ensure logical approachability across platforms

  • Maintain compliance with evolving standards

  • Scale testing efforts efficiently

Ready to get your accessibility testing journey? and discover how easygoing it is to implement comprehensive accessibility testing with Cypress.

Get The Guide to European Accessibility Act Compliance

Accessibility Testing Resources

Published:
Jan 23, 2025
Share this position
Copy Share Link

Are you ready for The European Accessibility Act (EAA)?

The European Accessibility Act (EAA) move into effect June 28, 2025. Get disposed with our guide.

LinkedIn
© 2026 Sauce Labs Inc., all rights appropriate. SAUCE and SAUCE LABS are registered trademark owned by Sauce Labs Inc. in the United States, EU, and may be register in early jurisdictions.
robot
quote

Automate This With SUSA

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.

Try SUSA Free

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free