2.1 KiB
2.1 KiB
name, description
| name | description |
|---|---|
| write-e2e-test | Write or change a ChatterMate Playwright end-to-end test (e2e/). Use when adding e2e coverage for a feature, fixing a failing e2e spec, or adding a page object, fixture or fake-LLM script. |
Writing a ChatterMate e2e test
The suite lives in e2e/. Read e2e/AUTHORING.md first — it is the source of truth for
layout and rules. The essentials:
- Specs speak product language.
specs/<feature>/<name>.spec.ts, imports only from@e2e, no selectors (page.locator) and no raw HTTP — lint fails otherwise. Title ends with tags:@<feature>, plus@smokeonly for the few journeys that must run on every PR. - Selectors go in
src/pages/(a screen) orsrc/components/(shared UI). PrefergetByRole/getByLabel; if the element has no accessible name, add anaria-labelto the Vue component rather than reaching for CSS. CSS needs a one-line "why" comment. - Seed through
src/api/, assert through the UI. Need a new endpoint? Add a function to the matchingsrc/api/*.tsmodule. - Script the AI with
llm.script(agent, s => …)—reply,handOver,createTicket,callTool(...).thenReply(...). Replies are structured ChatResponse JSON; handover and tickets are boolean fields, not tool calls. - Fixtures give each test its own
agent+widget.test.use({ agentSettings: { transferToHuman: true } })for handover.inboxis Sam Agent's dashboard in a second browser. Never change org-wide settings outside a*.org.spec.ts. - Prove it is stable before finishing:
cd e2e && npx playwright test specs/<feature> --repeat-each=10 && npm run lint && npm run typecheck(start the stack once with./scripts/stack.sh up; in a Claude worktree passE2E_PYTHONandE2E_FRONTEND_NODE_MODULESpointing at the main checkout, and run with the sandbox disabled — Postgres, ports and the node_modules symlink need it). - Update
e2e/FEATURES.md— the row for the journey, with the spec path and ✅.
Enterprise specs live in the private enterprise_frontend repo under e2e/, import only
from @e2e, and must never be added to this public repo.