Appearance
Question Read Browser Smoke
Scope
This opt-in smoke verifies the browser-facing P6-003/P6-004 question read path without changing the default gateway route table. It opens the real /teacher/questions page, seeds the browser auth and organization state used by the frontend, and verifies the browser-observed GET /api/questions response came through the non-default native questions-list gateway route.
When QUESTION_READ_BROWSER_DETAIL_ID is set, the smoke also opens /teacher/questions/{id}/edit and verifies the browser-observed GET /api/questions/{id}?view=editor response came through the non-default native questions-detail gateway route.
Required Runtime
Start these processes before live mode:
- Next.js web app, default
WEB_BASE_URL=http://localhost:3000 - API gateway, default
GATEWAY_BASE_URL=http://localhost:8085 question-bank-service, default target fromdeploy/gateway/routes.questions-read-native-localhost-example.json- gateway route table:
GATEWAY_ROUTE_TABLE=deploy/gateway/routes.questions-read-native-localhost-example.json
The web app must be started with NEXT_PUBLIC_API_URL pointing at the gateway base URL. If the frontend still points at the legacy API process, the smoke fails because the browser response will not include gateway route headers.
Run
Static self-test:
bash
cd go-platform
QUESTION_READ_BROWSER_SELF_TEST=1 make test-question-read-browserLive browser mode:
bash
cd go-platform
QUESTION_READ_BROWSER_AUTHORIZATION='Bearer <teacher-or-admin-token>' \
QUESTION_READ_BROWSER_ORGANIZATION_ID=<org-id> \
make test-question-read-browserLive browser mode with editor-detail evidence:
bash
cd go-platform
QUESTION_READ_BROWSER_AUTHORIZATION='Bearer <teacher-or-admin-token>' \
QUESTION_READ_BROWSER_ORGANIZATION_ID=<org-id> \
QUESTION_READ_BROWSER_DETAIL_ID=auto \
QUESTION_READ_BROWSER_REQUIRE_ITEMS=1 \
make test-question-read-browserAdmin all-organization browser mode:
bash
cd go-platform
QUESTION_READ_BROWSER_AUTHORIZATION='Bearer <admin-token>' \
QUESTION_READ_BROWSER_ORGANIZATION_ID=<org-id> \
make test-question-read-browser-adminUseful optional variables:
QUESTION_READ_BROWSER_HEADLESS=0to see Chromium.QUESTION_READ_BROWSER_PATH=/teacher/questionsto override the list page.QUESTION_READ_BROWSER_EXPECT_QUERY=allOrgs=1to wait for a list request containing required query params.QUESTION_READ_BROWSER_DETAIL_ID=<question-id>to verify editor detail.QUESTION_READ_BROWSER_DETAIL_ID=autoto use the first list item.QUESTION_READ_BROWSER_REQUIRE_ITEMS=1to fail on an empty list.QUESTION_READ_BROWSER_ARTIFACT_DIR=output/playwright/<name>to control artifact output.
Assertions
The smoke fails unless:
- the route table has
questions-listas exactGETnative_read - the route table has
questions-detailas one-segmentGETnative_read - both native read routes target
/v1/legacy/questions - the broad
questionsfallback and globalfallbackstaylegacy_proxy - the browser observes
X-Hoctapaz-Gateway-Route: questions-listforGET /api/questions - the browser observes
X-Hoctapaz-Gateway-Route-State: native_read - when
QUESTION_READ_BROWSER_EXPECT_QUERYis set, the matched browser request includes those query params - the list response contains the legacy-compatible
items/metashape - when detail mode is enabled, the browser observes
X-Hoctapaz-Gateway-Route: questions-detailforGET /api/questions/{id}?view=editor - when detail mode is enabled, the detail response contains the requested
idand acurrentVersionobject
Live artifacts are written under output/playwright/ and include response headers, response bodies, a summary file, and page screenshots.
Rollback
Switch GATEWAY_ROUTE_TABLE back to deploy/gateway/routes.json, remove the native read route-table entries, or set questions-list and questions-detail back to legacy_proxy. This smoke does not modify question data.