test(e2e): add Playwright smoke test suite for core OL pages - #12998
test(e2e): add Playwright smoke test suite for core OL pages#12998mekarpeles wants to merge 16 commits into
Conversation
| test('header search trigger is present', async ({ page }) => { | ||
| await page.goto('/'); | ||
| // The search bar is a Lit web component — the visible affordance is a trigger button | ||
| // that opens a search dialog; there is no plain <input> in the DOM until the dialog opens. |
There was a problem hiding this comment.
WCAG 4.1.2: Form element has no accessible label.
Form elements must have labels. Use <label>, aria-label, or aria-labelledby.
Details
Every form input needs an accessible label so users understand what information to enter. Use a <label> element with a for attribute matching the input's id, wrap the input in a <label>, or use aria-label/aria-labelledby for custom components. Placeholders are not sufficient as labels since they disappear when typing.
- home: search bar is a Lit component; replace input[type=text] locator with .search-bar-component (the trigger button is what's in the DOM) - subjects: skipIfNoSolr only guarded on 404; also skip if #header-bar is absent (Solr unhealthy returns 200 error page); fix .contentBody → #contentBody; add skip guard to the unknown-subject 500 test (Solr down breaks that path too)
Add @axe-core/[email protected] and create tests/e2e/a11y/ with: - axe-helpers.ts: shared AxeBuilder factory (WCAG 2.1 AA tags) and violation formatter for test annotations - a11y-scan.spec.ts: 6 core pages tagged @a11y; annotates violations but does not fail — baseline is 218 errors (2026-06-23); hardening comment explains the per-class upgrade path as fixes land GH: #13007
Playwright axe-core test covering the fix in PR #13011: ReadButton.html <summary> elements must have an accessible name. Tests search results, author works, and work pages — all pages that render the ReadButton macro with listen/locate options. Currently fails against openlibrary.org (fix pending #13011 merge); will pass once the fix deploys.
Playwright axe-core tests covering the fix in PR #13012: - login page: ia_thirdparty_logins iframe must have title - work page: BookPreview iframe must have title - signup page: OL iframes must have title (reCAPTCHA excluded) All three tests currently fail against openlibrary.org (expected — fix pending #13012 merge); will pass once the fix deploys.
8096043 to
7c9dd64
Compare
|
Hi — I'm Pierre, an AI-assisted PR tidier running on behalf of @mekarpeles. I rebased this branch onto the latest master (was 306 commits behind). What changed: Only the rebase itself — no content changes. The one conflict was in Why: Brings the branch up to date so GitHub can compute mergeability and CI can run against current master. Safeguards: All 12 commits on this branch are authored by @mekarpeles. Zero unresolved review threads before proceeding. Used To reverse: Run |
Regression guard for PR #13031: home page carousel slides must not have role=option (nested-interactive WCAG 4.1.2). Test currently passes against local env with fix applied.
|
Heads up @mekarpeles — I've opened #13072 as a scoped-down slice of this branch to get Playwright landed with minimal risk, and I'd suggest we move forward with that one and repurpose this PR for the a11y follow-up. What #13072 keeps from here: the core-page smoke specs, the What it changes:
What stays here / comes back as its own PR: the axe-core a11y suite ( Proposed sequence: merge #13072 → rebase the a11y work here (or a fresh PR) on top of it → gate each rule as its fix confirms on master. Happy to do that rebase. Sound good? |
Introduces Playwright as a dev dependency and a small, manually-run smoke suite covering 7 core pages (home, login, search, work, subjects, author, edition). Tests run against local Docker or any OL_BASE_URL via `npm run test:e2e`. Intentionally minimal first step for a new dev tool: - NOT wired into CI and does not block anything yet - no axe-core / a11y scans (deferred to a follow-up) - no Storybook scripts (out of scope) Scoped down from #12998. Refs #12885
* fix(a11y): add title attributes to iframes (WCAG 2.4.1 H64) Iframes must have a title attribute so screen readers can identify their purpose before deciding whether to enter them. - ia_thirdparty_logins.html: title="Sign in with a third-party account" (IA social login widget rendered on login and signup pages) - BookPreview.html: title="Book preview" (floating preview dialog, JS-populated on demand) Excluded: reCAPTCHA iframe on signup page is third-party JS (Google); its title is not under OL template control. Playwright regression test staged in #12998 (tests/e2e/a11y/frame-title.spec.ts). Fixes: frame-title axe rule / WCAG 2.4.1 H64 Closes: #13008 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…enu (WCAG 1.4.3) (#13027) * fix(a11y): fix color contrast violations in OlToggle and nav-bar (WCAG 1.4.3) Two WCAG 1.4.3 (Contrast Minimum) violations fixed: OlToggle.js: sublabel used hardcoded #777 (contrast 4.47:1, fails AA). Changed to var(--accessible-grey) which is already defined in tokens as the minimum accessible grey (hsl 0, 0%, 46.3% = 4.54:1 against white). nav-bar.css (work-menu): selected tab used --blue-5e88B9 background (hsl 212, 39%, 55%) with white text — contrast only 3.4:1. Changed to --primary-blue (hsl 202, 96%, 37%, 4.82:1) for selected state and --header-nav-hover-color (hsl 207, 83%, 33%, 6.56:1) for hover. Note: .star.star--small gold color contrast (pa11y-only, not axe) is a design decision tracked separately in #13009. Playwright regression tests staged in #12998 (tests/e2e/a11y/color-contrast.spec.ts). Fixes: color-contrast axe rule / WCAG 1.4.3 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
|
Closing this one out — the work here has since landed through a few smaller PRs. Where it went:
So The one bit that didn't come along is the set of per-rule regression guards — @mekarpeles if you'd rather keep this open, please just reopen — no objections from me. |
Summary
Adds a Playwright end-to-end smoke test suite covering 7 core Open Library pages. Tests run against a local Docker instance or any deployed OL environment via
OL_BASE_URL.Pages covered
home.spec.tslogin.spec.tssearch.spec.tswork.spec.tssubjects.spec.tsauthor.spec.tsedition.spec.tsAll
test.describeblocks are tagged@smoke— run targeted with:Test design
helpers.ts(filters known env noise)Running locally
Verified
Closes #12885