Test Overview
This test uses cypress-axe to check if the web page meets accessibility standards. It loads the page, injects the accessibility tool, runs the accessibility checks, and verifies there are no violations.
This test uses cypress-axe to check if the web page meets accessibility standards. It loads the page, injects the accessibility tool, runs the accessibility checks, and verifies there are no violations.
import 'cypress-axe'; describe('Accessibility check with cypress-axe', () => { it('should have no accessibility violations on load', () => { cy.visit('https://example.cypress.io'); cy.injectAxe(); cy.checkA11y(); }); });
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Test runner initialized, Cypress ready to run tests | - | PASS |
| 2 | Browser opens and navigates to 'https://example.cypress.io' | Example Cypress page loaded in browser | Page loaded successfully with status 200 | PASS |
| 3 | Inject axe-core accessibility testing library into the page | axe-core script injected and ready to run accessibility checks | axe-core script is present in the page context | PASS |
| 4 | Run accessibility checks on the entire page using cy.checkA11y() | axe-core analyzes page elements for accessibility issues | No accessibility violations found | PASS |
| 5 | Test ends | Test completed with no accessibility violations | - | PASS |