End-to-end tests #
Playwright tests that drive the Solid frontend in a real Chromium against the real Go router, using an in-memory fixture instead of an account or a PDS.
Run #
pnpm --dir web exec playwright test # build frontend, boot fixture, run, tear down
pnpm --dir web exec playwright test --ui # same, with the UI runner
The config runs pnpm run build:web once, starts tests/e2e/server on
127.0.0.1:18939, and Playwright stops the fixture and the browser when the run
ends. Set OOLONG_E2E_NO_BUILD=1 to skip that build and serve the existing
web/dist. Chromium comes from Playwright's install by default; set
CHROMIUM_PATH to a system Chromium (e.g. a Nix store path) to use that
instead.
| Variable | Effect |
|---|---|
OOLONG_E2E_PORT |
Fixture port (default 18939). |
OOLONG_E2E_BASE_URL |
Fixture address to start instead of the default; must be an http loopback origin with no path, and its port must match OOLONG_E2E_PORT when both are set. |
OOLONG_E2E_NO_BUILD |
Skip the frontend build and serve the existing web/dist. |
OOLONG_E2E_WEB_DIST |
Frontend build directory the fixture serves (default web/dist). |
CHROMIUM_PATH |
Chromium executable for Playwright. |
The fixture is not reused: Playwright fails if the port is already taken, so a
stale Go binary cannot quietly answer tests. It serves web/dist from disk on
every request (spa.Config.DevDir), which is why the webserver builds first
rather than relying on the embedded snapshot.
Fixture #
tests/e2e/server/main.go boots the real router, JSON API, SPA shell, and
assets against:
memoryStore, an in-memoryrecords.Store, so record CRUD is real code with a map behind it; every write is lost on exit.- a synthetic session (
atpmiddleware.ContextWithAuth) for every request, so there is no OAuth flow. Afixture-signed-outcookie (set byGET /logout, or directly by the test) makes requests anonymous, including the shell'sdata-*session attributes. - a Playwright route guard that aborts every request leaving the fixture origin (and fails the test), so the browser cannot reach the network either.
fixtureTransportonhttp.DefaultTransport, which answersapp.bsky.actor.getProfile,com.atproto.identity.resolveHandle, the DID document, andcom.atproto.repo.listRecords/getRecordfrom the same store. Any other outbound request fails withfixture blocked external request, so a test cannot reach a real PDS, relay, or account.- seed records: vendor
harney, teaearlgrey, vesselmug, brewmorning.
Each run gets a fresh fixture. Tests share it with one worker, use unique record names, and lifecycle tests delete their records. There is no reset endpoint and no production test hook.
What is covered #
brew-lifecycle.spec.ts: log a steep through the Solid form, verify the saved state, edit it via/brews/{rkey}/edit, confirm the stored record throughGET /api/brews/{rkey}, then delete it with a same-originfetchand confirm404— and that a tea created throughPOST /api/teasshows up in the steep tea picker.tea-lifecycle.spec.ts: create a tea in/teas/new, edit it in/teas/{rkey}/edit, delete it from its/my-teacard (confirming the dialog), and confirm each step through the JSON API.smoke.spec.ts: signed-in shell navigation to the steep form; signed-out home and steep page keep public chrome and offer login instead of the form.
Not covered: OAuth login/logout/reauth, PDS and network failures, likes, comments, moderation, settings mutations, visual regression.
Selector contract #
Tests use roles, labels, and hrefs rather than copy or class names, so page
redesigns mostly survive. These anchors are relied on today:
- main navigation landmark:
navigationnamed "Main navigation" - a visible link to
/brews/new - steep form:
comboboxnamed "Tea", labelled inputsTime (seconds)/Temperature (°C), submit buttons "Save steep" / "Update steep", and a heading matching/saved/iafter a successful save - entity form (
/teas/new,/teas/{rkey}/edit): heading "New tea"/"Edit tea", labelled fields "Tea" (name), "Category", "Origin (if known)", submit buttons "Save tea"/"Update tea", success by navigating to/my-tea /my-tea: heading "My tea", tabs in anavigationnamed "Your collections" (buttons "Steeps", "Teas", ...), onearticleper record carrying anEditlink and aDelete <name>button that openswindow.confirm- signed-out steep page: a link to
/logininsidemain
Owners of the pages and shell should keep those anchors, or tell the E2E owner so the tests move with the UI.