1.5 KiB
type, status, category, isAgentGenerated
| type | status | category | isAgentGenerated |
|---|---|---|---|
| Task | AI Gen TODO | QA | true |
Test: Storage Persistence Across Page Reloads
Description
Verify that the Build Calculator correctly persists and restores user settings (selected faction, immortal, build input delays, attack/travel times) across page reloads using localStorage.
Rationale
The app relies on Blazored.LocalStorage via IStorageService to persist settings. No existing test covers the round-trip: set a value, reload the page, and assert the value survived. This is a common source of regressions when storage keys, serialization, or service initialization changes.
Playwright Feature
This test uses page.evaluate() to directly inspect localStorage and page.goto() with a fresh navigation to verify persistence across a full Blazor WASM lifecycle (including hydration and service re-initialization).
Unlike existing tests that set values and immediately assert in-memory Blazor state, this test:
- Sets a filter value via the UI (select option).
- Reads the raw
localStoragekey to confirm Blazor wrote it. - Reloads the page (
page.reload()or a freshpage.goto). - Asserts the UI reflects the restored value without user re-selection.
Example Assertions
localStorage.getItem('SelectedFaction')equalsDataType.FACTION_QRathGUID after selecting Q'Rath.- After reload, the faction
<select>element shows Q'Rath selected without anyselectOptioncall. - After reload, the hotkey viewer shows Q→Acropolis (proving the filter was restored end-to-end).