chore(audit): axe harness and notes template for UX audit

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Tudor
2026-07-02 10:53:50 +01:00
co-authored by Claude Fable 5
parent eeb3f2491a
commit ee5b94099a
2 changed files with 56 additions and 0 deletions
@@ -0,0 +1,27 @@
// Body for playwright browser_evaluate: () => { ...this content... }
// Loads axe-core 4.x from CDN (skips if already present), runs WCAG A/AA scan.
return (async () => {
if (!window.axe) {
await new Promise((resolve, reject) => {
const s = document.createElement('script');
s.src = 'https://cdn.jsdelivr.net/npm/axe-core@4.10.2/axe.min.js';
s.onload = resolve;
s.onerror = () => reject(new Error('axe failed to load'));
document.head.appendChild(s);
});
}
const results = await window.axe.run(document, {
runOnly: { type: 'tag', values: ['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa', 'wcag22aa'] }
});
return {
url: location.pathname,
violationCount: results.violations.length,
violations: results.violations.map(v => ({
id: v.id,
impact: v.impact,
description: v.help,
nodes: v.nodes.length,
sampleTargets: v.nodes.slice(0, 3).map(n => n.target.join(' '))
}))
};
})();