-
Notifications
You must be signed in to change notification settings - Fork 28
[CHORE] Add axe-core WCAG 2.2 AA accessibility tests + DuckDB query tests to CI #420
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
c991011
feat: add axe-core WCAG 2.2 AA accessibility tests to CI
lowlydba 28f85f8
docs: add WCAG 2.2 AA badge to README
lowlydba 1b9b2d9
fix: resolve 3 WCAG 2.2 AA violations caught by axe CI
lowlydba e093942
fix: prevent path traversal in a11y test static server (CodeQL js/pat…
lowlydba 81c1e82
chore: move CODEOWNERS and SECURITY.md to .github/
lowlydba bce69b7
feat: add DuckDB query smoke tests to CI
lowlydba 4f71687
fix: correct setup-python version comment (v5.6.0 not v6.2.0)
lowlydba 012b925
chore: consolidate CI into single workflow with are-we-good rollup
lowlydba a79cc31
chore: add 15 minute timeout to DuckDB query tests job
lowlydba 380b07b
test: expand a11y coverage to 7 pages
lowlydba 5818492
fix(a11y): fix WCAG AA violations on community page
lowlydba 397cde8
chore(query-tests): print query SQL and elapsed time per run
lowlydba abeb466
fix(a11y): resolve code-block, link, email, and iframe WCAG violations
lowlydba e67b6ae
chore: remove ponytail comment markers
lowlydba 40425b1
fix(query-tests): stream output live and print setup timing
lowlydba 0beba9d
feat(query-tests): colorize printed SQL to set it apart from log lines
lowlydba 7c1beab
fix(query-tests): print the exact SQL that executes
lowlydba 3f0b946
fix(query-tests): strip 'LOAD ...; --noqa' preamble so queries get LI…
lowlydba 1bc9f03
perf(query-tests): use LIMIT 0 instead of LIMIT 1
lowlydba 37e7f49
fix(query-tests): unwrap COPY queries with leading comments, add --dr…
lowlydba 775da80
fix(divisions): wire up orphaned count queries, drop dead SQL fragments
lowlydba d112c54
fix(divisions): shorten new count-tab labels so they don't truncate
lowlydba cc6276a
fix(query-tests): use AWS S3 path for Detroit and Seattle building qu…
lowlydba 100ed22
perf(query-tests): wrap COPY selects in LIMIT 0 for multi-statement s…
lowlydba eb46c7a
fix(a11y): harden static server and dedupe Tabs default
lowlydba File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| --- | ||
| name: Accessibility | ||
|
|
||
| on: | ||
| pull_request: | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: a11y-${{ github.event.number || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| a11y: | ||
| name: WCAG 2.2 AA | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repo | ||
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up Node.js | ||
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | ||
| with: | ||
| node-version-file: package.json | ||
|
|
||
| - name: Configure sustainable npm | ||
| uses: lowlydba/sustainable-npm@31d51025884f424f58f22e4e6578178bb4e79632 # v3.0.0 | ||
|
|
||
| - name: Install NPM dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Build | ||
| run: npm run build | ||
|
|
||
| - name: Install Playwright browser | ||
| run: npx playwright install chromium --with-deps | ||
|
|
||
| - name: Run accessibility tests | ||
| run: npm run test:a11y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| /** | ||
| * WCAG 2.2 AA accessibility tests using Node's built-in test runner. | ||
| * Requires a built `build/` directory — run `npm run build` first. | ||
| * Run with: npm run test:a11y | ||
| */ | ||
|
|
||
| import { test, before, after } from 'node:test'; | ||
| import assert from 'node:assert/strict'; | ||
| import { createServer } from 'node:http'; | ||
| import { readFile, access } from 'node:fs/promises'; | ||
| import { extname, join } from 'node:path'; | ||
| import { fileURLToPath } from 'node:url'; | ||
| import { chromium } from 'playwright'; | ||
| import AxeBuilder from '@axe-core/playwright'; | ||
|
|
||
| const __dirname = fileURLToPath(new URL('.', import.meta.url)); | ||
| const BUILD_DIR = join(__dirname, '..', 'build'); | ||
| const PORT = 3778; | ||
| const BASE_URL = `http://localhost:${PORT}`; | ||
|
|
||
| const MIME = { | ||
| '.html': 'text/html', | ||
| '.js': 'application/javascript', | ||
| '.mjs': 'application/javascript', | ||
| '.css': 'text/css', | ||
| '.png': 'image/png', | ||
| '.svg': 'image/svg+xml', | ||
| '.woff2': 'font/woff2', | ||
| '.json': 'application/json', | ||
| }; | ||
|
|
||
| let server, browser; | ||
|
|
||
| before(async () => { | ||
| await access(join(BUILD_DIR, 'index.html')).catch(() => { | ||
| throw new Error(`build/index.html not found — run 'npm run build' before running accessibility tests`); | ||
| }); | ||
|
|
||
| // ponytail: minimal static file server, falls back to index.html for Docusaurus client-side routing | ||
| server = createServer(async (req, res) => { | ||
| const urlPath = req.url.split('?')[0]; | ||
| const filePath = join(BUILD_DIR, urlPath === '/' ? 'index.html' : urlPath); | ||
| try { | ||
| const data = await readFile(filePath); | ||
Check failureCode scanning / CodeQL Uncontrolled data used in path expression High test
This path depends on a
user-provided value Error loading related location Loading |
||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| res.writeHead(200, { 'Content-Type': MIME[extname(filePath)] ?? 'application/octet-stream' }); | ||
| res.end(data); | ||
| } catch { | ||
| try { | ||
| const data = await readFile(join(BUILD_DIR, 'index.html')); | ||
| res.writeHead(200, { 'Content-Type': 'text/html' }); | ||
| res.end(data); | ||
| } catch { | ||
| res.writeHead(404); | ||
| res.end('Not found'); | ||
| } | ||
| } | ||
|
lowlydba marked this conversation as resolved.
|
||
| }); | ||
| await new Promise((resolve) => server.listen(PORT, resolve)); | ||
| browser = await chromium.launch(); | ||
| }); | ||
|
|
||
| after(async () => { | ||
| await browser?.close(); | ||
| await new Promise((resolve) => server.close(resolve)); | ||
| }); | ||
|
lowlydba marked this conversation as resolved.
|
||
|
|
||
| function formatViolations(violations, label) { | ||
| if (violations.length === 0) return; | ||
| const detail = violations | ||
| .map((v) => | ||
| `[${v.impact}] ${v.id}: ${v.description}\n` + | ||
| v.nodes.map((n) => ` • ${n.target}`).join('\n') | ||
| ) | ||
| .join('\n\n'); | ||
| assert.fail(`${violations.length} WCAG 2.2 AA violation(s) — ${label}:\n\n${detail}`); | ||
| } | ||
|
|
||
| async function runAxe(url) { | ||
| const context = await browser.newContext(); | ||
| const page = await context.newPage(); | ||
| try { | ||
| await page.goto(`${BASE_URL}${url}`, { waitUntil: 'domcontentloaded' }); | ||
| await page.waitForSelector('main', { timeout: 10000 }); | ||
| const { violations } = await new AxeBuilder({ page }) | ||
| .withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa', 'wcag22aa']) | ||
| .analyze(); | ||
| return violations; | ||
| } finally { | ||
| await context.close(); | ||
| } | ||
| } | ||
|
|
||
| const PAGES = [ | ||
| { path: '/', label: 'homepage' }, | ||
| { path: '/docs/', label: 'docs index' }, | ||
| ]; | ||
|
|
||
| for (const { path, label } of PAGES) { | ||
| test(`${label} passes WCAG 2.2 AA`, async () => { | ||
| formatViolations(await runAxe(path), label); | ||
| }); | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.