ts/tests/e2e/ and are entirely separate from the Vitest unit tests.
Prerequisites
Build Anki at least once before running e2e tests:just test-e2e automatically installs Playwright’s Chromium browser
into out/playwright-browsers/ on the first run (idempotent on subsequent runs).
Running tests
Managed mode (CI-style)
Playwright starts and stops a throwaway Anki instance automatically:Reuse-server mode (recommended for development)
Start Anki once in a separate terminal, then reuse it across multiple test runs:Interactive UI mode
Open Playwright’s browser UI to inspect each test step with snapshots:Writing tests
Add test files tots/tests/e2e/ with the .test.ts suffix and import from
./fixtures instead of directly from @playwright/test:
fixtures.ts re-exports expect and a pre-configured test object. Add
shared fixtures there as new features require them.
Calling the Anki API from tests
Anki’s/_anki/ endpoints accept and return protobuf-encoded binary payloads
(Content-Type: application/binary). Use page.request.post with
Buffer.from(protoMsg.toBinary()) and decode the response with the matching
generated type from ts/lib/generated/.
Accessing Anki pages
Anki’s mediasrv serves the following pages over HTTP (non-exhaustive):CI
The e2e tests run as part of thecheck-linux job in .github/workflows/ci.yml,
after the regular build and test steps. Screenshots and traces from failed runs
are uploaded as artifacts and kept for 7 days.