-
Notifications
You must be signed in to change notification settings - Fork 13
fix: wcag test runner #618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Current unit coverage is 89.77272727272727% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a mutex-based serialization mechanism to the WCAG test runner to fix flaky test failures caused by concurrent axe accessibility checks. The implementation uses a promise chain to ensure that axe checks run sequentially rather than in parallel.
Changes:
- Introduced a global
axeLockpromise to serialize axe accessibility checks - Wrapped the
checkA11ycall in a promise chain to prevent concurrent execution - Added comments explaining the purpose of the serialization
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| axeLock = axeLock.then(async () => { | ||
| await checkA11y( | ||
| page, | ||
| { | ||
| exclude: [ | ||
| '#root .mapboxgl-canvas-container', | ||
| '.mapboxgl-marker', | ||
| '.mapboxgl-popup-close-button' | ||
| ], | ||
| }, | ||
| } | ||
| ); | ||
| { | ||
| axeOptions: { | ||
| runOnly, | ||
| rules: { | ||
| 'color-contrast': { enabled: context.name !== 'Loading' }, | ||
| }, | ||
| }, | ||
| detailedReport: true, | ||
| detailedReportOptions: { | ||
| html: true, | ||
| }, | ||
| } | ||
| ); | ||
| }); |
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lock implementation doesn't properly handle errors. If checkA11y throws an error, it will break the promise chain and cause all subsequent tests to hang indefinitely waiting for a promise that will never resolve. The callback passed to then() should explicitly return the promise, and error handling should be added to prevent the lock from becoming permanently broken. Consider wrapping the checkA11y call in a try-finally block or using catch() to ensure the lock chain continues even when errors occur.
Adds a lock to WCAG test runner to try to fix it's flaky failures.