doc.haus Atlas Legal-document workflows on OpenCode, bound to their code
237 documents
apps/web/e2e/README.md

doc.haus web E2E acceptance runners, each a Playwright script with its own base URL and DOCHAUS_EVIDENCE_DIR. Most run against a separately started server with intercepted fixtures: setup browser, Settings keyboard focus, provider health and reconnection, matter composer layout, completed-run Open items, sample matter, page layout, the Material-expressive design captures (optional AXE_SCRIPT for WCAG 2.2 AA), PDF preview with citation page jumps, document versions and the dashboard. Others start the real ingest service on a temporary data root with a scripted local engine fixture: working Word review, counterparty markup triage, comment replies, post-Save follow-ups, and change-timeline hover cards. Each spells out the states it asserts, typically at desktop and ~400px widths, and none uses real credentials, providers or paid requests. Read when running or extending doc.haus web acceptance and regression tests.

Run the setup browser regression against a separately started Vite or preview server:

PLAYWRIGHT_BASE_URL=http://127.0.0.1:5189 \
DOCHAUS_EVIDENCE_DIR=/tmp/doc-haus-setup-evidence \
bun apps/web/e2e/release-setup.ts

The runner uses @playwright/test and an already installed Chromium. When that package is installed in another workspace, set PLAYWRIGHT_MODULE to its index.mjs entrypoint. Set PLAYWRIGHT_CHROMIUM_EXECUTABLE if the installed browser version differs from the Playwright package cache. It never installs packages or starts a backend.

All backend/auth traffic is intercepted with local fixtures; unexpected requests are blocked and fail the run. Browser contexts are isolated per scenario. The URL can target either private or public code; screenshots and the JSON result are written only beneath DOCHAUS_EVIDENCE_DIR.

Run the focused desktop Settings keyboard regression with the same environment:

PLAYWRIGHT_BASE_URL=http://127.0.0.1:5189 \
DOCHAUS_EVIDENCE_DIR=/tmp/doc-haus-settings-evidence \
bun apps/web/e2e/settings-focus.ts

It covers initial focus, native modal Tab containment, Escape/Close/backdrop dismissal, opener restoration, nested jurisdiction search and unsaved model choices. Its Save check writes only to the intercepted in-memory config fixture.

Run startup provider health and reconnection acceptance with the same environment:

PLAYWRIGHT_BASE_URL=http://127.0.0.1:5189 \
DOCHAUS_EVIDENCE_DIR=/tmp/doc-haus-provider-health-evidence \
bun apps/web/e2e/provider-health.ts

It covers launch/setup gating, one check per distinct selected model, verified, expired-key, model-access and transient states, native scoped event failures, and recovery after replacing a synthetic key. Desktop and 390px screenshots also verify pointer targets and horizontal overflow. No real credentials or provider traffic are used.

Run the working Word review acceptance against a Vite server whose /ingest proxy targets a free port and whose /engine proxy targets an unused port:

(cd apps/web && VITE_INGEST_URL=/ingest VITE_OPENCODE_URL=/engine \
  DOC_HAUS_INGEST_PORT=4801 DOC_HAUS_ENGINE_PORT=4397 \
  bun run dev -- --host 127.0.0.1 --port 5474 --strictPort)

PLAYWRIGHT_BASE_URL=http://127.0.0.1:5474 \
DOCHAUS_E2E_INGEST_PORT=4801 \
DOCHAUS_EVIDENCE_DIR=/tmp/doc-haus-word-evidence \
bun apps/web/e2e/working-word-review.ts

Unlike the checks above, this runner starts the real ingest service itself on DOCHAUS_E2E_INGEST_PORT, with a temporary data root and settings directory, and restarts it mid-run. Its legal generation reaches a scripted local engine fixture, never a provider. Browser engine traffic (ready, session and agent lists, the event stream) and the release update check are intercepted. It seeds a synthetic Word deliverable with a numbered list and a table, then covers Prepare, single acceptance, stale proposals, API refusals, a redline export that leaves stale proposals out, restart persistence, rejection and the downloaded package XML. Prepare's line must count only the batch's proposals still fresh after each accept. Its open items must stay listed, including after the restart and reload, and a second seeded deliverable must show none of them until the first is opened again. The temporary data root is removed afterwards.

Run the counterparty markup triage (#200) the same way, with its own ports:

PLAYWRIGHT_BASE_URL=http://127.0.0.1:5474 \
DOCHAUS_E2E_INGEST_PORT=4801 \
DOCHAUS_EVIDENCE_DIR=/tmp/doc-haus-markup-evidence \
bun apps/web/e2e/counterparty-markup.ts

It starts the real ingest service on a temporary data root, uploads the synthetic marked-up agreement as a source and the same bytes as a deliverable, and opens the Tracked changes panel: Changes lists every change undecided and Comments holds the threads. While the panel is open the page shows a pin per thread instead of margin cards, and a pin opens its thread on Comments. It filters Changes to one reviewer, rejects the shown changes with Reject all shown, accepts the other reviewer's replace, reloads to check the kept drafts, gives the attorney name once and saves. The new version must list its actor, the undecided changes and both flagged items must remain, and the deliverable must offer no panel. The source's embeddings use the local model from DOCHAUS_MODEL_CACHE_DIR (default the per-user cache); no engine or provider is contacted.

Run the replies to their comments (#200) the same way:

PLAYWRIGHT_BASE_URL=http://127.0.0.1:5221 \
DOCHAUS_E2E_INGEST_PORT=4922 \
DOCHAUS_EVIDENCE_DIR=/tmp/doc-haus-replies-evidence \
bun apps/web/e2e/counterparty-replies.ts

It uploads the agreement with its footnote comment against the real ingest service, whose model calls go to a local engine fixture with scripted drafts. On the Comments tab it drafts the open threads together, cancels one, checks that the comment written as instructions to an AI drafts with doc.haus's note in its open items and nothing of the screening in its prompt or reply, checks that Approve reply waits for the bracketed part, edits and approves two replies, discards and restores one, and saves them with one Reject as one version. At 400 px it saves the last reply alone. A second upload's comment sits on a clause the other side inserted: a reply to it with that clause rejected is refused on the thread's card, and once saved without the reply the comment shows its text was removed and offers no reply.

Run what follows a Save in Tracked changes (#200, #198) the same way:

PLAYWRIGHT_BASE_URL=http://127.0.0.1:5231 \
DOCHAUS_E2E_INGEST_PORT=4932 \
DOCHAUS_EVIDENCE_DIR=/tmp/doc-haus-markup-followups-evidence \
bun apps/web/e2e/counterparty-followups.ts

It uploads three copies of a synthetic agreement whose clauses Word numbers, with a tracked deletion of a clause another clause cites, against the real ingest service. Accepting the deletion must show the broken reference above the page with an info toast, and viewing a kept version must end it; rejecting it must show nothing; a check that could not run (forced in the browser) must show one muted line. A reply written by hand to the marked-up supply agreement and saved with no decision must be listed by the replies it added, not as a save from Word. A fresh copy of that agreement, with a drafting run's issue register delivered beside it, must show the run's answer on each change and open thread: edited in response, suggested, left for the lawyer to decide or no edit made, with its reason, which names the run's document by its title. Each tag's full sentence is captured on hover. After a Save that accepts one of their changes and rejects another, the cards it leaves must keep those answers, marked as the run's on version 1, after a reload too. A copy with a doc.haus proposal accepted into it holds the lawyer's own two edits beside their ten changes: the save bar must read "0 of 10 decided", accepting an own edit must not move it, and the confirmation must still count the own edit left tracked. Each state is captured at desktop and 400 px.

Run the change timeline card acceptance (#297) the same way, with its own ports:

PLAYWRIGHT_BASE_URL=http://127.0.0.1:5474 \
DOCHAUS_E2E_INGEST_PORT=4801 \
DOCHAUS_EVIDENCE_DIR=/tmp/doc-haus-timeline-evidence \
DOCHAUS_SCREENSHOT_DIR=/tmp/doc-haus-timeline-screenshots \
bun apps/web/e2e/change-timeline.ts

It starts the real ingest service on a temporary data root and uploads four synthetic sources: the marked-up agreement, a long clause marked up by three fictional reviewers (with an undated change, a comment thread and a comment written as HTML), a file whose text box shifts the reader's paragraph numbers, and a file with list numbers, a changed table, an inserted row and two changed sections. For every painted paragraph with markup it hovers the first mark (a changed table or row on its first paragraph) and checks that the card lists the same authors, dates and kinds as the markup route for that paragraph, oldest first with undated entries last; a section's own change belongs on the section's last paragraph. It then checks the hover delay, that a click does not pin the card (hovering another clause switches it), that a drag across a mark opens nothing and keeps the selection, the pointer crossing into the card, Escape (the viewer stays open), placement below, above, right and left (marks and window sizes chosen from measured boxes), wheel and keyboard scrolling of a long timeline, Shift+Tab back to the mark and Tab on to the next clause's mark, that a keyboard-opened card closes once its line scrolls away, that every open card stays below the viewer's toolbar and within the document pane's visible part, the marks' accessible description as Chromium computes it, that HTML in a comment shows as text and runs nothing, the planted instruction's flag, tap, Close and an outside tap at 400×860, a dark colour scheme, that the text-box file offers comment threads only, and that a list number over 16 characters gives way to "Paragraph N". Screenshots of each verified state go to DOCHAUS_SCREENSHOT_DIR (default the evidence directory) and the JSON summary to DOCHAUS_EVIDENCE_DIR. A failed step is recorded and the run continues; no engine or provider is contacted.

Run the matter chat layout regression with the same environment as the setup and settings checks:

PLAYWRIGHT_BASE_URL=http://127.0.0.1:5189 \
DOCHAUS_EVIDENCE_DIR=/tmp/doc-haus-composer-evidence \
bun apps/web/e2e/matter-composer.ts

It opens a blocked drafting run with its requirement-check form at 1512×806, 1440×900, 1280×720 and 400×860, then checks that Continue drafting, Check the full draft and Details are in view and under their own centres, that arrowing through the requirements keeps the focused one inside the scrolling list, that the composer stays inside the chat card and clear of the matter status bar, that Send is the element under its own centre and takes a real pointer click, and that the narrow window has no horizontal overflow. The click's request is answered by the fixture; nothing reaches a live run.

Run the completed-run Open items regression with the same environment:

PLAYWRIGHT_BASE_URL=http://127.0.0.1:5189 \
DOCHAUS_EVIDENCE_DIR=/tmp/doc-haus-open-items-evidence \
bun apps/web/e2e/run-open-items.ts

It opens Details on a completed run and on a run paused at the final check, each with 21 synthetic open items, at 1440×1000, 1280×720 and 400×860, shows them all, then reads the Details scroller just past the Open items summary and to its end. At each position the summary must stay in view at the scroller's top edge, be the element under its own centre and have an opaque background in the run header's colour. A real pointer click just past the summary must fold the list. It sends no writes.

Run the sample matter regression with the same environment:

PLAYWRIGHT_BASE_URL=http://127.0.0.1:5189 \
DOCHAUS_EVIDENCE_DIR=/tmp/doc-haus-sample-matter-evidence \
bun apps/web/e2e/sample-matter.ts

It checks that setup's last step pre-selects the sample matter only for an empty workspace, that finishing adds it once (and adds nothing when unchecked), that a failed add keeps setup saved and offers a retry, and that Settings → Matter defaults adds it later and is then disabled. The matters list must label it. The sample request is answered by the fixture; the real seed is covered by services/ingest/src/sample-matter.test.ts.

Run the page layout regression with the same environment:

PLAYWRIGHT_BASE_URL=http://127.0.0.1:5189 \
DOCHAUS_EVIDENCE_DIR=/tmp/doc-haus-page-layout-evidence \
bun apps/web/e2e/page-layout.ts

At 1440×1000 and 400×860 it sets every Page layout control in Settings → Drafting and checks the agreement page preview and the saved body: flat keys, with no new nested object. The first-page and firm-name checkboxes must hide while page numbers or the draft line are off and keep their value when shown again. In onboarding's details step it checks that default jurisdictions only mark suggested legends, that nothing is chosen for the lawyer, that the preview follows the firm name and legend, and that Save sends the two legends as flat keys, empty when left alone. The clock is fixed so the draft line's date is stable. Saves reach only the in-memory fixture.

Run the product design regression with the same preview environment:

PLAYWRIGHT_BASE_URL=http://127.0.0.1:5189 \
DOCHAUS_EVIDENCE_DIR=/tmp/doc-haus-design-evidence \
bun apps/web/e2e/material-expressive.ts

It captures Matters, creation/editing, all five libraries, saved conversation, document drawer/reader, review, Settings/Appearance and onboarding at 375×812, 768×1024 and 1440×1000; covers empty/error/loading states, short desktop workspaces, compact/large preferences, reduced motion, collapse hit areas and unchanged matter request bodies. The 720×500 layout checks reflow at the CSS viewport equivalent of a 1440×1000 window at 200% browser zoom. All provider and generation traffic is intercepted or refused.

Set AXE_SCRIPT to a local axe-core browser bundle to assert zero automated WCAG 2.2 AA-tag violations in each capture. There is no shipped axe dependency. Set DOCHAUS_BASELINE=1 to capture an older preview with new-design assertions skipped. Screenshots/results remain outside public source. Run focused native control regressions with bun test/material-primitives.browser.ts and bun test/jurisdiction-select.browser.ts; use PLAYWRIGHT_CHROMIUM_PATH if the installed Chromium differs from the package's default.

Run the PDF preview acceptance (#275) against a built web preview:

PLAYWRIGHT_BASE_URL=http://localhost:5321 \
DOCHAUS_EVIDENCE_DIR=/tmp/doc-haus-pdf-evidence \
PLAYWRIGHT_CHROMIUM_EXECUTABLE="<full Chromium binary>" \
bun apps/web/e2e/pdf-preview.ts

It serves a generated synthetic multi-page PDF through intercepted routes and, at 1440 px and 400 px wide, opens it from the Documents list and from a review table citation (which adds a status line). For each it asserts that the iframe fills the viewer body (within 80 px, 120 px with the status line), that the viewer fits the screen, the viewer body does not scroll, and the PDF is fetched exactly once. A citation sends one page lookup with its excerpt; for the stubbed answer the iframe must end in #page=5 and the line open with page 5, or (ambiguous and scanned at 400 px, not found and a lookup that never answers at 1440 px) stay at page 1 and open with why; a hung lookup must give way to the PDF within 6 s. The line then names the section and quotes the excerpt without its Markdown. The assertions do not depend on the PDF plugin, so they also pass in the headless shell; only the screenshots need a full Chromium (the shell renders a blank frame), and only they show that the browser's viewer honours #page=. Set DOCHAUS_MEASURE_ONLY=1 to print the heights without asserting them, DOCHAUS_ONLY=<label> to run one scenario (desktop, narrow, citation-desktop, citation-narrow, citation-ambiguous-narrow, citation-unavailable-desktop, citation-scanned-narrow or citation-hung-desktop), and PDF_FIXTURE=<file> to use another synthetic PDF. From apps/web, bun test/pdf-citation.browser.ts mounts the viewer alone and checks that a citation changed while the PDF stays open never shows the previous page.

Run the document versions regression with the same preview environment:

PLAYWRIGHT_BASE_URL=http://127.0.0.1:5189 \
DOCHAUS_EVIDENCE_DIR=/tmp/doc-haus-versions-evidence \
bun apps/web/e2e/document-versions.ts

It opens synthetic Word, PDF and email documents with kept versions (one removed by a redaction) at 1440×1000 and 400×860: the versions list, viewing an older version (what it switches off, and where focus goes there and back), the restore confirmation (Escape cancels it, and the request body is checked), the restored list, a file changed outside doc.haus, versions made elsewhere and an already-current refusal, PDF and email versions, a version blackline and the return to the list, the compare dialog's previous-version default, duplicate uploads and a file without versions, and the upload prompt's Save as new version, duplicate (with Restore, failed then made) and tracked-changes messages. Version bytes, restore, compare and upload answers are fixtures; every other request is refused.

Run the dashboard regression with the same preview environment:

PLAYWRIGHT_BASE_URL=http://127.0.0.1:5189 \
DOCHAUS_EVIDENCE_DIR=/tmp/doc-haus-dashboard-evidence \
bun apps/web/e2e/dashboard.ts

At 375×812, 768×1024 and 1440×1000 (plus 1180×900) it captures a new install, a busy synthetic practice, a load error, an empty layout and every widget at once. It checks the week total and bars across a clock change in UTC and Europe/London, hiding, adding back, moving and reloading widgets, widget menus above neighbouring cards, the Add widgets dialog, each period, and the chart and calendar tooltips. The clock is fixed, engine and ingest reads are answered from in-memory fixtures, and every other request is refused.