Skip to content

Get started ​

This guide uses experimental a11y-journey-evidence 0.1.0 with Playwright 1.64.1. It adds evidence to native Playwright tests. You still choose the assertions and what the expected behavior should be.

Prerequisites ​

The package baseline was verified with Node 24.21.0, npm 11.19.0, TypeScript 7.0.2, Playwright 1.64.1, Chromium 156.0.8078.4, and macOS 27.0.1 arm64. Other package hosts/browsers remain untested. Documentation site checks have their own verification context.

Use an empty directory outside this repository so installation exercises npm's published package:

sh
mkdir journey-evidence-demo
cd journey-evidence-demo

Create the project files ​

Save each file below in that directory. The project is ESM; .js import suffixes refer to TypeScript files that Playwright loads.

json
{
  "name": "journey-documentation-examples",
  "private": true,
  "type": "module",
  "scripts": { "typecheck": "tsc --noEmit", "test": "playwright test" },
  "devDependencies": {
    "a11y-journey-evidence": "0.1.0",
    "@playwright/test": "1.64.1",
    "typescript": "7.0.2",
    "@types/node": "24.19.2"
  }
}
json
{
  "compilerOptions": {
    "target": "ES2022", "module": "NodeNext", "moduleResolution": "NodeNext",
    "strict": true, "noEmit": true, "erasableSyntaxOnly": true, "skipLibCheck": true,
    "lib": ["ES2022", "DOM"], "types": ["node"]
  },
  "include": ["*.ts"]
}
ts
import { defineConfig } from '@playwright/test';
export default defineConfig({
  testDir: '.', testMatch: '*.spec.ts', workers: 1,
  timeout: 15_000, expect: { timeout: 1_000 },
  outputDir: '.artifacts/results',
  reporter: [
    ['list'], ['json', { outputFile: '.artifacts/native.json' }],
    ['html', { outputFolder: '.artifacts/html', open: 'never' }],
    ['a11y-journey-evidence/reporter', {
      outputDir: '.artifacts/evidence', reproductionCommand: 'npm test',
    }],
  ],
  use: { browserName: 'chromium', trace: 'on', viewport: { width: 1280, height: 720 } },
});
ts
import { test as base, mergeTests } from '@playwright/test';
import { test as evidenceTest } from 'a11y-journey-evidence';
const existingTest = base.extend<{ tenant: string }>({ tenant: 'synthetic-team' });
export const test = mergeTests(existingTest, evidenceTest);
export const plainTest = existingTest;
ts
import { expect } from '@playwright/test';
import { test } from './fixtures.js';
import { loadDialog, exerciseDialog, type DialogVariant } from './dialog.js';

for (const variant of ['correct', 'escaping-focus', 'failed-restoration'] as DialogVariant[]) {
  test(`dialog ${variant}`, async ({ page, journey, tenant }) => {
    if (variant !== 'correct') test.fail();
    await test.step('Setup: load synthetic dialog', async () => {
      expect(tenant).toBe('synthetic-team');
      await loadDialog(page, variant);
    });
    await journey.start({ root: page.locator('#dialog') });
    await exerciseDialog(page);
  });
}

Also save dialog.ts from the complete dialog fixture and journey alongside them. These six files are enough for the first dialog run. The form recipe adds two more files; the integration guide supplies an optional control test.

Install and run ​

sh
npm install
npx playwright install chromium
npm run typecheck
npm test -- --grep "dialog correct"
npm test -- --grep "dialog escaping-focus"

The manifest pins npm package a11y-journey-evidence@0.1.0 and its Playwright peer @playwright/test@1.64.1. Install from npm; GitHub source archives are repository snapshots, not the compiled npm distribution.

The correct dialog has an actual passed result. The escaping-focus case has an actual failed assertion in Forward containment boundary. It uses test.fail() to declare that failure expected, so its command can exit 0. That means the demonstration behaved as expected; it does not mean containment passed. An unexpected pass makes Playwright fail the run. An unrelated failure also requires investigation; the repository's example verifier checks the exact failed step and message.

Run all copied cases with npm test. With the form and control files added, the verified example set contains three actual passes and four intended actual failures.

Find the evidence ​

The reporter prints a bundle path beneath .artifacts/evidence/<run-id>/report.md. Each invocation creates a new run directory. The report retains native actual/expected status and executed assertions, plus observations and available failure artifacts.

  • Native HTML: .artifacts/html/index.html; open with npx playwright show-report .artifacts/html.
  • Native JSON: .artifacts/native.json.
  • Native test output and traces: .artifacts/results/.

Start with the dialog failure walkthrough. Copy the whole run directory when sharing a portable bundle; its relative artifact links need their files. Inspect it for application data before sharing. This site publishes curated synthetic excerpts, not complete raw bundles.

Bring it into an existing suite ​

Compose your fixtures and reporters, then read the API and lifecycle reference. Use synthetic data first. Passing sampled assertions and complete evidence do not establish accessibility conformance, screen-reader announcements or inclusive usability.

Experimental v0.1.0 · External validation pending