Skip to content

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 from deploy/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-browser

Live 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-browser

Live 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-browser

Admin 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-admin

Useful optional variables:

  • QUESTION_READ_BROWSER_HEADLESS=0 to see Chromium.
  • QUESTION_READ_BROWSER_PATH=/teacher/questions to override the list page.
  • QUESTION_READ_BROWSER_EXPECT_QUERY=allOrgs=1 to 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=auto to use the first list item.
  • QUESTION_READ_BROWSER_REQUIRE_ITEMS=1 to 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-list as exact GET native_read
  • the route table has questions-detail as one-segment GET native_read
  • both native read routes target /v1/legacy/questions
  • the broad questions fallback and global fallback stay legacy_proxy
  • the browser observes X-Hoctapaz-Gateway-Route: questions-list for GET /api/questions
  • the browser observes X-Hoctapaz-Gateway-Route-State: native_read
  • when QUESTION_READ_BROWSER_EXPECT_QUERY is set, the matched browser request includes those query params
  • the list response contains the legacy-compatible items/meta shape
  • when detail mode is enabled, the browser observes X-Hoctapaz-Gateway-Route: questions-detail for GET /api/questions/{id}?view=editor
  • when detail mode is enabled, the detail response contains the requested id and a currentVersion object

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.

Go-platform documentation is generated from repository Markdown.