Skip to content

Question Types Browser Smoke

Scope

This opt-in smoke verifies the browser-facing P3-003 route path without changing the default gateway route table. It opens the real /teacher/questions/types page, seeds the same browser auth and organization state that the frontend reads, and verifies the browser-observed GET /api/question-types response came through the non-default native question-types-read 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.question-types-native-localhost-example.json
  • gateway route table: GATEWAY_ROUTE_TABLE=deploy/gateway/routes.question-types-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_TYPES_BROWSER_SELF_TEST=1 make test-question-types-browser

Live browser mode:

bash
cd go-platform
QUESTION_TYPES_BROWSER_AUTHORIZATION='Bearer <teacher-or-admin-token>' \
QUESTION_TYPES_BROWSER_ORGANIZATION_ID=<org-id> \
make test-question-types-browser

Useful optional variables:

  • QUESTION_TYPES_BROWSER_HEADLESS=0 to see Chromium.
  • QUESTION_TYPES_BROWSER_PATH=/teacher/questions/types to override the page.
  • QUESTION_TYPES_BROWSER_ARTIFACT_DIR=output/playwright/<name> to control artifact output.

Assertions

The smoke fails unless:

  • the route table has question-types-read as exact GET native_read
  • the route table has question-types-write as native_write
  • the broad question-types fallback remains legacy_proxy
  • the browser observes X-Hoctapaz-Gateway-Route: question-types-read for GET /api/question-types
  • the browser observes X-Hoctapaz-Gateway-Route-State: native_read
  • the response contains core question type codes such as SINGLE_CHOICE, MULTIPLE_CHOICE, TRUE_FALSE, or ESSAY

Live artifacts are written under output/playwright/ and include response headers, response body, a summary file, and a page screenshot.

Rollback

Switch GATEWAY_ROUTE_TABLE back to deploy/gateway/routes.json, remove the native route-table entries, or set them to legacy_proxy. This smoke does not modify question type data.

Go-platform documentation is generated from repository Markdown.