Files
2026-05-31 14:33:58 -04:00

34 lines
1.5 KiB
Markdown

---
type: Task
status: AI Gen TODO
category: QA
isAgentGenerated: "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:
1. Sets a filter value via the UI (select option).
2. Reads the raw `localStorage` key to confirm Blazor wrote it.
3. Reloads the page (`page.reload()` or a fresh `page.goto`).
4. Asserts the UI reflects the restored value **without** user re-selection.
### Example Assertions
- `localStorage.getItem('SelectedFaction')` equals `DataType.FACTION_QRath` GUID after selecting Q'Rath.
- After reload, the faction `<select>` element shows Q'Rath selected without any `selectOption` call.
- After reload, the hotkey viewer shows Q→Acropolis (proving the filter was restored end-to-end).