From 95d553501c283d5c0753ddae80ac6e0f2b846bde Mon Sep 17 00:00:00 2001 From: waterWang Date: Fri, 21 Aug 2026 17:26:42 +0800 Subject: [PATCH] feat: add automated axe-core accessibility scan in CI (Closes #175) Add @axe-core/playwright to scan all frontend pages (landing, login, register, dashboard, marketplace, invoice detail, portfolio, settings, transactions, profile) for serious/critical accessibility violations. The scan runs as a new `frontend-a11y` job in the CI pipeline on every PR, with known-waiver violations documented in a waiver list. Signed-off-by: waterWang --- .github/workflows/ci.yml | 28 +++- invofi/apps/frontend/e2e/a11y.spec.ts | 175 +++++++++++++++++++++++++ invofi/apps/frontend/package-lock.json | 16 ++- invofi/apps/frontend/package.json | 8 +- 4 files changed, 222 insertions(+), 5 deletions(-) create mode 100644 invofi/apps/frontend/e2e/a11y.spec.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f859c2151..530fc6747 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,6 +44,32 @@ jobs: - run: npm ci - run: npm test + frontend-a11y: + name: Frontend / Accessibility Scan + runs-on: ubuntu-latest + defaults: + run: + working-directory: invofi/apps/frontend + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7 + with: + node-version: 20 + cache: npm + cache-dependency-path: invofi/apps/frontend/package-lock.json + - run: npm ci + - name: Install Playwright Chromium + system deps + run: npx playwright install --with-deps chromium + - name: Run accessibility scan + run: npm run test:a11y + - name: Upload Playwright report + if: failure() + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: playwright-a11y-report + path: invofi/apps/frontend/playwright-report + retention-days: 14 + frontend-build: name: Frontend / Build runs-on: ubuntu-latest @@ -88,4 +114,4 @@ jobs: - uses: wagoid/commitlint-github-action@b948419dd99f3fd78a6548d48f94e3df7f6bf3ed # v6 # Smart contract tests and WASM builds moved to Stellar-VaultLink/invofi-contracts - # (Rust-only CI) as part of the two-repo topology migration. + # (Rust-only CI) as part of the two-repo topology migration. \ No newline at end of file diff --git a/invofi/apps/frontend/e2e/a11y.spec.ts b/invofi/apps/frontend/e2e/a11y.spec.ts new file mode 100644 index 000000000..46bedd8fb --- /dev/null +++ b/invofi/apps/frontend/e2e/a11y.spec.ts @@ -0,0 +1,175 @@ +/** + * Automated accessibility scan (axe-core) for the InvoFi frontend. + * + * Scans every page listed in issue #175 using @axe-core/playwright and fails CI + * on serious/critical violations. Known, unavoidable violations are documented + * in a waiver list (see waivers below). + * + * The scan runs alongside the Playwright smoke suite as a separate CI job + * (see .github/workflows/ci.yml) so it does not block the fast-feedback unit + * test / lint pass. + */ +import { test, expect } from '@playwright/test'; +import AxeBuilder from '@axe-core/playwright'; +import { + authenticate, + SMOKE_INVOICE, + SMOKE_INVOICES, + SMOKE_LISTINGS, + mockPositionListings, +} from './fixtures'; + +/** + * Known-violation waiver list. + * + * Every entry documents a specific rule + CSS selector that we accept as a + * known limitation. Add entries here only when: + * 1. The violation is a false positive (axe-core heuristic limitations). + * 2. The element is from a third-party library we cannot patch. + * 3. The fix would require a cross-cutting refactor tracked in a separate issue. + * + * Format: { ruleId: string, selector: string, reason: string } + */ +const WAIVERS = [ + // The Stellar Wallet Kit dialog injects a