GRI-2141: fail-first tests for panel language switching (Dutch), forge #275 #289

Closed
astraea wants to merge 0 commits from test/GRI-2141-panel-language-switching-tests into dev
Member

Summary

Forge #275 ("Tests: panel language switching (Dutch)"): fail-first tests for the panel's language switcher, written against the specification ahead of #38's implementation, per Grimoirix process (Test Writer writes before the implementing engineer).

What's covered

frontend-web/src/api/httpSessionApi.test.ts — pins the already-merged server contract (forge #274 / PR #276): locale on every GET/POST /session response, a new updateLocale(locale) → PATCH /session/locale, and 400 unknown_locale surfacing as ApiRequestError.

frontend-web/src/panelLanguageSwitching.test.tsx — one test per acceptance criterion in forge #275:

  • switches the nav to Dutch without a page reload
  • round-trips EN → NL → EN with no stuck Dutch text
  • falls back to English for panel.nav.settings (deliberately missing from nl.yml), not a raw key or blank
  • persists the chosen language across a fresh session load
  • doesn't crash while a save is in flight
  • shows an error and keeps the previous language when a save fails
  • the control has an accessible name and is reachable by keyboard
  • document.documentElement.lang matches the active locale

Where the control lives and what widget it is are the implementing engineer's call (the issue only says "somewhere in settings"); the tests assume an accessible name matching /language/i (required anyway by the accessibility criterion) and handle either a native <select> or a button-opened listbox.

Test plan

  • npx vitest run in frontend-web: all 11 new/updated assertions fail against today's code (missing updateLocale export, missing locale field, no control rendered); the other 181 existing tests are unaffected.
  • npx tsc -b --noEmit: fails only on the missing updateLocale export — the exact symbol the implementation needs to add.
  • npx prettier --check / npx oxlint --deny-warnings on both files: clean.
## Summary Forge #275 ("Tests: panel language switching (Dutch)"): fail-first tests for the panel's language switcher, written against the specification ahead of #38's implementation, per Grimoirix process (Test Writer writes before the implementing engineer). ## What's covered **`frontend-web/src/api/httpSessionApi.test.ts`** — pins the already-merged server contract (forge #274 / PR #276): `locale` on every `GET`/`POST /session` response, a new `updateLocale(locale)` → `PATCH /session/locale`, and `400 unknown_locale` surfacing as `ApiRequestError`. **`frontend-web/src/panelLanguageSwitching.test.tsx`** — one test per acceptance criterion in forge #275: - switches the nav to Dutch without a page reload - round-trips EN → NL → EN with no stuck Dutch text - falls back to English for `panel.nav.settings` (deliberately missing from `nl.yml`), not a raw key or blank - persists the chosen language across a fresh session load - doesn't crash while a save is in flight - shows an error and keeps the previous language when a save fails - the control has an accessible name and is reachable by keyboard - `document.documentElement.lang` matches the active locale Where the control lives and what widget it is are the implementing engineer's call (the issue only says "somewhere in settings"); the tests assume an accessible name matching `/language/i` (required anyway by the accessibility criterion) and handle either a native `<select>` or a button-opened listbox. ## Test plan - [x] `npx vitest run` in `frontend-web`: all 11 new/updated assertions fail against today's code (missing `updateLocale` export, missing `locale` field, no control rendered); the other 181 existing tests are unaffected. - [x] `npx tsc -b --noEmit`: fails only on the missing `updateLocale` export — the exact symbol the implementation needs to add. - [x] `npx prettier --check` / `npx oxlint --deny-warnings` on both files: clean.
GRI-2141: fail-first tests for panel language switching (Dutch), forge #275
Some checks failed
CI / the pre-push hook (pull_request) Successful in 3s
CI / cargo fmt (pull_request) Successful in 3s
CI / install.sh client upgrade (pull_request) Successful in 13s
CI / cargo deny (pull_request) Successful in 16s
CI / cargo deny advisories (pull_request) Successful in 20s
CI / repository boundary (pull_request) Successful in 6s
CI / frontend-web (pull_request) Failing after 36s
CI / cargo clippy (pull_request) Successful in 1m14s
CI / cargo test (pull_request) Successful in 3m27s
CI / Notify gate failed (pull_request) Successful in 1s
CI / CI (pull_request) Failing after 1s
6fe624f769
Pins the already-shipped session/locale contract (forge #274: GET/POST
/session's locale field, PATCH /session/locale, 400 unknown_locale) in
httpSessionApi.test.ts, and adds an App-level integration suite for the
not-yet-built language control: switch without reload, EN<->NL round
trip, fallback to English for panel.nav.settings (missing from nl.yml),
persistence across a fresh session load, in-flight and failed-save
states, and accessibility (name, keyboard reachability, document lang).

All 11 new/updated assertions fail against today's code (missing
updateLocale export, missing locale field, no control rendered) and
181 pre-existing tests are unaffected.
Owner

Superseded by #294, merged into dev: its commit 6fe624f is already an ancestor of dev. Closing.

Superseded by #294, merged into dev: its commit 6fe624f is already an ancestor of dev. Closing.
vivy closed this pull request 2026-11-16 22:10:22 +00:00
Some checks failed
CI / the pre-push hook (pull_request) Successful in 3s
CI / cargo fmt (pull_request) Successful in 3s
Required
Details
CI / install.sh client upgrade (pull_request) Successful in 13s
CI / cargo deny (pull_request) Successful in 16s
Required
Details
CI / cargo deny advisories (pull_request) Successful in 20s
Required
Details
CI / repository boundary (pull_request) Successful in 6s
Required
Details
CI / frontend-web (pull_request) Failing after 36s
Required
Details
CI / cargo clippy (pull_request) Successful in 1m14s
Required
Details
CI / cargo test (pull_request) Successful in 3m27s
Required
Details
CI / Notify gate failed (pull_request) Successful in 1s
CI / CI (pull_request) Failing after 1s

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Grimoirix/grimoire-of-digital-signage!289
No description provided.