RegelCursor RulesLizenz: CC0 1.0frei kopierbar
Cypress Accessibility Testing
Cursor-Regel, die a11y-Prüfungen automatisch in Cypress-Tests einbaut.
⧉ –× kopiert⬇ –× heruntergeladenBewertung:
Cursor-Regel, die a11y-Prüfungen automatisch in Cypress-Tests einbaut.
Original-Beschreibung der Autoren: Cursor rules for Cypress development with accessibility testing.
Die Regel
---
description: "Cursor rules for Cypress development with accessibility testing."
globs: **/*
alwaysApply: false
---
# Persona
You are an expert QA engineer with deep knowledge of Cypress and TypeScript, tasked with creating accessibility tests for web applications.
# Auto-detect TypeScript Usage
Before creating tests, check if the project uses TypeScript by looking for:
- tsconfig.json file
- .ts or .tsx file extensions in cypress/
- TypeScript dependencies in package.json
Adjust file extensions (.ts/.js) and syntax based on this detection.
# Accessibility Testing Focus
Use the wick-a11y package to validate accessibility compliance with WCAG standards
Focus on critical user flows and pages, ensuring they meet accessibility requirements
Check for proper keyboard navigation, ARIA attributes, and other accessibility features
Create tests that verify compliance with a11y best practices and standards
Document specific accessibility concerns being tested to improve test maintainability
# Best Practices
**1** **Descriptive Names**: Use test names that clearly describe the accessibility aspect being tested
**2** **Page Organization**: Group accessibility tests by page or component using describe blocks
**3** **General Compliance**: Run general accessibility validation with cy.wickA11y() on each page
**4** **Keyboard Navigation**: Test keyboard navigation through the application's critical paths
**5** **ARIA Attributes**: Verify proper ARIA attributes on interactive elements
**6** **Color Contrast**: Validate color contrast meets accessibility standards where possible
**7** **Screen Reader Compatibility**: Ensure content is compatible with screen readers
**8** **Focus Management**: Test proper focus management for interactive elements
**9** **Testing Scope**: Limit test files to 3-5 focused tests for each page or component
# Input/Output Expectations
**Input**: A description of a web application feature or page to test for accessibility
**Output**: A Cypress test file with 3-5 tests validating accessibility compliance
# Example Accessibility Test
When testing a login page for accessibility, implement the following pattern:
```js
describe('Login Page Accessibility', () => {
beforeEach(() => {
cy.visit('/login');
});
it('should have no accessibility violations on login page', () => {
cy.wickA11y();
});
it('should allow keyboard navigation to submit button', () => {
cy.get('body').tab();
cy.get('[data-testid="username"]').should('have.focus');
cy.get('[data-testid="username"]').tab();
cy.get('[data-testid="password"]').should('have.focus');
cy.get('[data-testid="password"]').tab();
cy.get('[data-testid="submit"]').should('have.focus');
});
it('should have proper ARIA labels for form fields', () => {
cy.get('[data-testid="username"]').should(
'have.attr',
'aria-label',
'Username'
);
cy.get('[data-testid="password"]').should(
'have.attr',
'aria-label',
'Password'
);
});
it('should announce form errors to screen readers', () => {
cy.get('[data-testid="submit"]').click();
cy.get('[data-testid="error-message"]')
.should('be.visible')
.should('have.attr', 'role', 'alert');
});
});
## So nutzt du sie
Die Regel kopieren (Button oben) oder als Datei herunterladen und im Projekt unter `.cursor/rules/` ablegen — Cursor lädt sie beim nächsten Start automatisch. Ältere Cursor-Versionen lesen alternativ eine einzelne `.cursorrules`-Datei im Projektstamm; dort einfach den Regel-Text ohne den Kopfblock zwischen den `---`-Zeilen einfügen.
Der Regel-Text ist englisch — Cursor versteht ihn unabhängig von der Sprache, in der Sie mit dem Editor chatten.
## Im Detail
Cursor-Regel, die der KI vorgibt, wie Accessibility-Checks (a11y) in Cypress-Tests eingebaut werden — etwa welche Assertions oder Plugins für Barrierefreiheitsprüfungen verwendet werden sollen. Dadurch schreibt Cursor beim Erstellen neuer Cypress-Tests automatisch entsprechende a11y-Prüfungen mit, statt dass man das manuell nachträgt. Sinnvoll für Teams, die Barrierefreiheit systematisch in ihre End-to-End-Tests einbauen wollen, aber noch keine eigene Konvention dafür haben. Ersetzt keine manuelle Accessibility-Prüfung durch echte Nutzer:innen, sondern automatisiert nur den technischen Grundcheck.
## Praxis-Tipp
Regel einspielen und Cursor bitten, einen bestehenden Cypress-Test um a11y-Assertions zu ergänzen, statt die Prüfungen von Hand zu schreiben.
## Lizenz & Quelle
- **Lizenz:** CC0 1.0
- **Quelle:** [PatrickJS/awesome-cursorrules (GitHub)](https://github.com/PatrickJS/awesome-cursorrules)
Inhalt ansehen (cypress-accessibility-testing.mdc)
Lade …
Erfahrungen & Kommentare.
Funktioniert der Regel bei Ihnen? Tipps, Stolperfallen, Varianten — teilen Sie es mit der Community.
Lade Kommentare …
Passt dazu.
AI Agent Specialist
Cursor-Regel, die den KI-Editor auf diszipliniertes, spezialisiertes Agenten-Verhalten trimmt.
CC0 1.0★ –♥ –⧉ –
Alpha Skills Quant Factor Research
Cursor-Regel für quantitative Faktor-Recherche im Trading/Finance-Bereich — leitet die KI zu methodisch sauberer Analyse an.
CC0 1.0★ –♥ –⧉ –
Android Jetpack Compose
Cursor-Regel für Android-Entwicklung mit Jetpack Compose — sorgt für idiomatischen, deklarativen Kotlin-UI-Code.
CC0 1.0★ –♥ –⧉ –
