← back to Studio Zero

test/README.md

34 lines

# Studio Zero — UI verification

`ui.spec.js` is a headless Playwright suite (18 checks) covering the wizard: hero,
7-step stepper, **live** generation via the Max-plan `claude` CLI (mode chip reads
"LIVE"), markdown render, Step-3 calendar sort+density grid, saved-project cards with
created date+time, and the download/copy-markdown export.

Run (needs Playwright on NODE_PATH; the app served on $BASE):
```bash
SZ_PROVIDER=demo PORT=4321 node ../server.js &        # or omit SZ_PROVIDER for the LIVE path
SAVEDIR=$(pwd)/.. NODE_PATH=~/Projects/animals/node_modules BASE=http://127.0.0.1:4321 node ui.spec.js
```
Exit 0 = all checks pass, 0 console/page errors. NOTE: avoid WHATWG "bad ports"
(4190, 6000, 5060, …) — undici fetch refuses them ("fetch failed / bad port").

`fallback.spec.js` is a **self-contained** regression guard (7 checks) for the
demo-fallback **honesty banner**: it spawns its own studio-zero in LIVE API mode
with a deliberately bogus key (→ 401), then asserts that when the live call fails
the front-end raises a persistent "generation unavailable — placeholder demo
content" banner (real reason surfaced, `fallback demo` badge, survives step
navigation) so fabricated demo output is never mistaken for a real result.
```bash
NODE_PATH=~/Projects/animals/node_modules node fallback.spec.js   # spawns + tears down its own server
```

`auth.spec.js` is a **zero-dependency** pure-HTTP regression guard (7 checks) for the
optional Basic-Auth gate (`SZ_BASIC_AUTH`): asserts the flag is default-OFF (`/` and
`/api/config` open, byte-for-byte unchanged) and, when on, rejects missing/wrong
credentials with `401` + a `WWW-Authenticate` challenge while admitting the correct ones.
No browser needed.
```bash
node auth.spec.js                 # spawns two instances (off + on), tears them down
```