docs/solutions/developer-experience/agent-browser-mock-api-verification.md
Local UI verification can waste time when the page depends on backend state that the browser cannot reach. In the Voice Pack admin page work, opening the page through the browser first showed only Admin access required because the root app requests /api/admin/me before rendering child routes. The form itself was fine, but the real page could not be inspected until the auth boundary was handled.
The same session also hit two tool-environment traps:
pnpm through the proto shim failed with fs::perms because the shim attempted to update ~/.proto/.../pnpx, which was outside the active workspace sandbox.Start with the in-app Browser or Playwright MCP against the real local URL, but treat an auth-only page as an environment boundary, not as proof the feature page is broken. Capture a snapshot first because it identifies the blocking text and accessible controls faster than screenshots.
When the root app blocks on auth or backend bootstrap, provide a tiny local mock API and point the Vite app at it. For AIRI admin pages, the useful pattern is:
node -e "const http=require('http'); /* serve /api/admin/me and required page APIs */"
Then run the app with the mock server as the API origin:
VITE_SERVER_URL=http://127.0.0.1:8787 ./node_modules/.bin/vite --host 127.0.0.1 --port 5175
Prefer the repository binary or the actual pnpm CJS entrypoint when the global pnpm command fails before the project script starts:
node /Users/luoling8192/.proto/tools/pnpm/10.33.0/bin/pnpm.cjs -F @proj-airi/ui-admin exec vue-tsc --noEmit
This avoids the proto shim permission update and keeps validation focused on project failures. If a new Codex thread has /Users/luoling8192/.proto in its writable roots, normal pnpm may be fine again; verify with:
test -w /Users/luoling8192/.proto
Use the browser tools in this order:
Do not over-claim browser behavior from a fake backend. Mock verification can prove layout, accessible controls, routing, and button wiring are present. It cannot prove real provider behavior, real audio generation, auth cookies, billing, or production routing unless those real services were used.
Without this sequence, browser verification turns into tool thrash: trying new tabs, launching standalone Playwright, retrying screenshots, and rerunning pnpm with escalation while the real problem is simply that the app has not rendered the target page yet.
Separating boundaries keeps the evidence clean:
VITE_SERVER_URL.pnpm reports fs::perms around ~/.proto before printing project script output.Before:
Open /admin/voice-packs/new
See "Admin access required"
Try screenshots and standalone Playwright
Treat missing form as ambiguous UI failure
After:
Open /admin/voice-packs/new
Snapshot shows /api/admin/me blocks rendering
Mock /api/admin/me, /api/admin/voice-packs, /api/v1/audio/models, and /api/v1/audio/voices
Run Vite with VITE_SERVER_URL pointing to the mock API
Snapshot confirms the form, combobox fields, catalog counts, and buttons render
Reserve real audio claims for a real /api/v1/audio/speech backend run
For audio or media tests, a mock response can confirm the request path is wired, but it may not prove browser playback. Confirm <audio controls> appears only when the DOM shows it, and confirm provider behavior only with the real backend and a valid media response.
docs/ai/context/verification-automation.mddocs/ai/context/ui-components.md