Skip to content

Conversation

@mkouzel-yext
Copy link
Contributor

Adds a lock to WCAG test runner to try to fix it's flaky failures.

@github-actions
Copy link
Contributor

Current unit coverage is 89.77272727272727%
Current visual coverage is 70.33571821684095%
Current combined coverage is 92.77456647398844%

@coveralls
Copy link

Coverage Status

coverage: 85.208%. remained the same
when pulling 9fe264d on fix-wcag-test-runner
into 709cdfb on main.

Copy link
Contributor

Copilot AI left a 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 axeLock promise to serialize axe accessibility checks
  • Wrapped the checkA11y call 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.

Comment on lines +19 to +42
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,
},
}
);
});
Copy link

Copilot AI Jan 23, 2026

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants