Files
supabase/e2e/docs
Alexis Aguilar c1330ca99f ci(docs): scan every docs guide for accessibility issues daily (#54339)
## Problem

Since #53899, Docs E2E skips the accessibility scan on every CI run,
because the scan is slow and only covers the pages a diff names. Nothing
checks docs accessibility automatically, and a change to a shared
component can break pages that no pull request lists.

## Solution

A new **Docs Accessibility Scan** workflow scans every MDX guide on
production once a day.

- `.github/workflows/docs-a11y-scan.yml` runs `pnpm e2e:docs:all --grep
@a11y` against `https://supabase.com` at 05:17 UTC, off the top of the
hour when GitHub can delay or drop scheduled runs, and on demand through
`workflow_dispatch`. Its concurrency group includes the ref, so a manual
run on a branch can't cancel the scheduled run on `master`. It uploads
the Playwright report when the scan fails.
- `docs-master-alert.yml` now watches the new workflow, so a failed run
posts to the docs alerts Slack channel the same way the Production Smoke
Tests do.
- The shared alert no longer names the latest `master` commit and its
author. That commit often didn't cause the failure: a scheduled or
manual run tests whatever is deployed, and a workflow that was already
failing keeps failing on later commits. The alert now names the
workflow, says whether a push, schedule, or manual run failed, and links
the run. This applies to every workflow the alert watches.
- The scope resolver skips guides that `static-redirects.json` sends
elsewhere, in both the pull request scope and the full run. A redirected
guide has no docs article to scan, so it could never pass. Today that's
only `getting-started/features`. Docs E2E's sparse checkout now includes
`apps/docs/lib/redirects` so the resolver can read the file. One helper
lists every guide with no docs article to test (nav-disabled and
redirected), and both resolvers use it.
- The README says where and when the scans run, which checks fail the
scan, and how to start one by hand. It also lists guides with no MDX
file, such as the CLI and self-hosting config pages, as a known
limitation: the full run only resolves MDX guides, so the scan skips
them.

The full run doesn't need sharding. A list over 20 pages already runs on
3 workers, and the whole site took 15.3 minutes against production,
inside the job's 45-minute timeout.

## Known failures

A full run against production on 2026-11-30 failed on 5 guides with real
accessibility issues: 4 `duplicate-id` and 1 `heading-order`. Until
[DOCS-1817](https://linear.app/supabase/issue/DOCS-1817/fix-the-accessibility-issues-the-daily-docs-scan-finds-on-5-guides)
fixes them, each daily run fails and posts an alert.

## Follow-ups

-
[DOCS-1831](https://linear.app/supabase/issue/DOCS-1831/trace-each-docs-accessibility-scan-failure-to-the-commit-that):
keep a list of open failures in every docs alert, each with the commit
that introduced it, or its possible commits marked unconfirmed.

## Review instructions

1. Run `pnpm -C e2e/docs test` and confirm all 15 tests pass, including
the two redirect tests.
2. Confirm a change to a redirected guide resolves to no pages:
   ```bash
printf 'apps/docs/content/guides/getting-started/features.mdx\n' | pnpm
-C e2e/docs resolve-docs-scope
   ```
   Expect `skip=true`.
3. Run the scan the way the workflow does, on one passing guide and one
guide from DOCS-1817:
   ```bash
cd e2e/docs && PLAYWRIGHT_BASE_URL=https://supabase.com
DOCS_E2E_PAGE_PATHS=/docs/guides/auth,/docs/guides/resources pnpm exec
playwright test --grep @a11y
   ```
Expect `/docs/guides/auth` to pass and `/docs/guides/resources` to fail
on `heading-order`.
4. Check the alert payload. Copy the `run` script from
`docs-master-alert.yml`, replace the `curl` call with `echo "$PAYLOAD"`,
and run it with `TRIGGER` set to `push`, then `schedule`. Expect no
commit or author in either, and the run type in the workflow line.
5. After merge, start the workflow with `gh workflow run
docs-a11y-scan.yml` and confirm it finishes in about 15 to 20 minutes.

Verified locally: unit tests, mutation probes on both redirect tests,
typecheck, actionlint on the changed workflows, the alert payload for
push, scheduled, and manual runs, the resolver on a sparse checkout like
the workflow's, and a full-site scan against production. A scheduled
workflow only runs from `master`, so the workflow itself hasn't run on
GitHub yet.

Resolves
[DOCS-1816](https://linear.app/supabase/issue/DOCS-1816/run-the-docs-e2e-accessibility-scan-on-a-schedule-across-the-whole)
Resolves
[DOCS-1826](https://linear.app/supabase/issue/DOCS-1826/word-docs-slack-alerts-for-scheduled-workflow-failures-without-blaming)

## Checklist

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
2026-12-01 14:24:35 -07:00
..
2026-11-24 10:43:35 +00:00

Docs E2E tests

This guide explains how to run Playwright end-to-end checks against docs pages this repo owns.

Use this suite when you change guides or shared partials under apps/docs/content. It loads each in-scope page, checks that the article renders, and verifies that docs-owned links in the article resolve. For links with an anchor, it also checks that the target page's article has an element with that id or an a[name] with that value, including same-page #anchor links.

This page covers:

Set up

  1. From this directory, install the Playwright Chromium browser once:

    cd e2e/docs
    pnpm exec playwright install chromium
    

Run the tests

By default, pnpm e2e:docs tests pages affected by your current changes: commits since origin/master, plus staged and unstaged working-tree files. If nothing in scope changed, the command exits successfully without starting Playwright.

  1. From the repository root, point the suite at a deployed docs site and run it:

    PLAYWRIGHT_BASE_URL=https://supabase.com pnpm e2e:docs
    
  2. Optional: open Playwright UI mode for the same scoped run:

    PLAYWRIGHT_BASE_URL=https://supabase.com pnpm e2e:docs:ui
    

You can also run from e2e/docs with pnpm run e2e:docs.

Choose a target URL

Tests use PLAYWRIGHT_BASE_URL. When unset, they default to the local docs dev server at http://localhost:3001.

Prefer a deployed site for day-to-day checks. Use the local server only when you need unpublished content that production does not serve yet.

Deployed site

PLAYWRIGHT_BASE_URL=https://supabase.com pnpm e2e:docs

For a protected Vercel preview, also set VERCEL_AUTOMATION_BYPASS_SECRET.

Local docs server

  1. From the repository root, start docs in a separate terminal:

    pnpm dev:docs
    
  2. Run the suite without PLAYWRIGHT_BASE_URL, or set it to http://localhost:3001.

The local server needs a full monorepo install and credentials for some content.

Local runs are unreliable for pages whose docs-owned links point into /docs/reference/* or /docs/guides/auth/server-side/*: reference pages can take over a minute to compile on first request in dev mode, which exceeds the suite's per-test timeout, and server-side auth guides have a known local-only routing issue that 404s even though the page serves correctly in production. Prefer a deployed site for pages that link into either of those sections.

Override which pages run

Leave DOCS_E2E_PAGE_PATHS unset to keep the default changed-files scope.

To test specific pages instead of the git diff:

DOCS_E2E_PAGE_PATHS=/docs/guides/getting-started/quickstarts/nextjs \
  PLAYWRIGHT_BASE_URL=https://supabase.com pnpm e2e:docs

To compare against a different base ref:

DOCS_E2E_BASE_REF=origin/develop \
  PLAYWRIGHT_BASE_URL=https://supabase.com pnpm e2e:docs

DOCS_E2E_PAGE_PATHS accepts a comma- or newline-separated list of /docs/... paths.

Run every in-scope page

To test every guide instead of a changed-files scope — for example, a periodic full-site check — run:

PLAYWRIGHT_BASE_URL=https://supabase.com pnpm e2e:docs:all

This ignores DOCS_E2E_PAGE_PATHS and tests every page listed by pnpm -C e2e/docs resolve-docs-scope across the whole guides tree — several hundred pages as of this writing. Expect a long run. A list that long runs on three workers, and --workers overrides that.

Run this against a deployed site, not the local dev server — see Local docs server for why local runs are unreliable for pages linking into reference docs or server-side auth guides.

What the suite covers

In scope

Changed path Behavior
apps/docs/content/guides/**/*.mdx Test /docs/guides/<slug>, excluding federated sections
apps/docs/content/_partials/** Test owned pages that include that partial

Out of scope

  • Federated guide sections: graphql, database/extensions/wrappers, ai/python, deployment/terraform, deployment/ci
  • Reference docs under /docs/reference
  • Non-docs routes such as /dashboard and /ui, which the link checker skips
  • Guides that the nav disables, listed in NAV_DISABLED_PAGES in utils/resolve-docs-scope.ts, because their HTML page returns 404
  • Guides that apps/docs/lib/redirects/static-redirects.json redirects elsewhere, because they have no docs article to test
  • Guides with no MDX file, such as the CLI and self-hosting config pages that the docs app builds from config files, because the suite only resolves MDX guides. This is a known limitation.

Limits

The suite tests every in-scope page, with no cap, and doesn't stop early on failures, so a run reports every page with a broken link. Past 20 pages it runs on three workers instead of one.

To inspect the resolved list without running Playwright, replicate the same scope pnpm e2e:docs uses by default: commits since origin/master, plus staged and unstaged working-tree changes.

{
  git diff --name-only --diff-filter=ACMR origin/master...HEAD
  git diff --name-only --diff-filter=ACMR
  git diff --name-only --diff-filter=ACMR --cached
} | pnpm -C e2e/docs resolve-docs-scope

Accessibility scans

The @a11y-tagged test scans each in-scope page with @axe-core/playwright. It reports WCAG 2.1 A/AA violations in the main article, and fails on the rules in ENFORCED_RULES in utils/axe-helpers.ts, which it checks across the whole page. The scans are slow, so Docs E2E runs skip them. Instead, the Docs Accessibility Scan workflow (.github/workflows/docs-a11y-scan.yml) scans every MDX guide on production daily at 05:17 UTC, and a failure posts to the docs alerts channel in Slack. To start it by hand, run gh workflow run docs-a11y-scan.yml.

PLAYWRIGHT_BASE_URL=https://supabase.com pnpm e2e:docs:a11y

Which pages get scanned comes from your branch, but the content comes from whatever you point PLAYWRIGHT_BASE_URL at. Production won't have your edits and will 404 on a page you just added, so use your pull request's preview to scan your own content.

EXCLUDED_RULES in utils/axe-helpers.ts lists the rules the scan skips. color-contrast is most of the scan time and finds nothing inside an article, since docs contrast comes from shared tokens and chrome. The rest target <html>, <head>, and <body>, which an article-scoped scan can't reach.

Cross-origin frames are skipped, so a third-party embed isn't reported as ours.

Not covered: /docs/reference/*, shared chrome, and most of WCAG. Keyboard navigation, focus management, and screen reader behavior need manual testing.

Debug failures

  1. Open the HTML report after a run:

    pnpm -C e2e/docs exec playwright show-report
    
  2. Inspect traces and screenshots under test-results/ for failed runs.

How CI uses this suite

The workflow at .github/workflows/docs-e2e.yml runs on pull requests that touch owned docs content, partials, or e2e/docs.

  1. When e2e/docs or e2e/shared changed, run the harness unit tests (pnpm -C e2e/docs test).
  2. Diff the pull request against its base branch and resolve in-scope page paths.
  3. Skip Playwright when nothing in scope changed.
  4. When apps/docs changed, wait for the Vercel docs preview and set PLAYWRIGHT_BASE_URL to that preview. If Vercel skipped the head commit's build as not affected, the newest ready preview from an earlier commit of the pull request is used instead. When no preview resolves, skip rather than test against production.
  5. Run the suite with DOCS_E2E_PAGE_PATHS set to the resolved list, without the @a11y accessibility scans.

Draft pull requests stay skipped until you mark them ready for review. Manual workflow_dispatch runs require a page_paths input and accept an optional base_url, which defaults to production.