Skip to content

Add ssrFixture() and an opt-in a11y assertion to the test layer #268

@vivek7405

Description

@vivek7405

Problem

The shipped fixture() renders via renderToString and parses HTML into a container; it never drives client hydration or awaits a true update cycle (waitForUpdate yields two macrotasks, never el.updateComplete), and there is no packaged ssrFixture() that server-renders then hydrates in one call. Separately, nothing touches accessibility testing: no axe-core integration, no assertion helper, and the scaffold browser test only checks the DOM exists. Both live in the existing real-Chromium WTR layer.

Design / approach

Export a small ssrFixture() that renders then hydrates in the existing WTR Chromium session awaiting the native el.updateComplete, plus an opt-in axe assertion. Thin wrappers over the real browser already running.

Web-standards fit: Runs in real Chromium and awaits the native updateComplete; the helpers are small and axe is opt-in, not a forced gate.

Prior art: Lit @lit-labs/testing ssrFixture/csrFixture + WTR SSR plugin; Lit @open-wc/testing + axe for a11y.

Acceptance criteria

  • A packaged ssrFixture() server-renders then hydrates a component in the WTR Chromium layer and awaits el.updateComplete
  • ssrFixture() is exported from the testing module alongside fixture() and documented in agent-docs/testing.md
  • An opt-in assertNoA11yViolations(el) helper runs axe in the WTR Chromium session, not a forced gate
  • The scaffold browser test demonstrates assertNoA11yViolations
  • Tests prove ssrFixture catches a hydration-mismatch counterfactual and the a11y helper flags a missing-label/role case
  • Tests cover the new behaviour at the applicable layer(s)
  • Docs / AGENTS.md / CONVENTIONS.md updated if the public surface changed

Filed from the production-readiness audit (webjs vs Next.js / Remix / Rails / Turbo / Lit). Theme: testing. Priority: P2. Kept to webjs identity: no-build, progressive enhancement, web-components-first, AI-first, batteries-included, close to web standards.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions