Files
ui/_docs/02_tasks/done/AZ-477_test_settings_resilience.md
T
Oleksandr Bezdieniezhnykh bd2b718ddf [AZ-463] [AZ-469] [AZ-476] [AZ-477] Batch 6 - flight/responsive/upload/settings tests
- AZ-463 flight selection persistence (FT-P-16) + rehydration
  on boot (FT-P-17) PASS at the wire; 100-cycle leak guard
  (NFT-RES-LIM-07) and 1h SSE soak (NFT-RES-LIM-06)
  scaffolded as RUN_LONG_RUNNING-gated e2e companions.
- AZ-469 browser-support smoke (FT-P-34) runs in both
  Chromium and Firefox via the existing playwright config;
  responsive variants (FT-P-35 480px / FT-P-36 1024px) PASS
  in fast (Tailwind class shape) and e2e (visibility).
- AZ-476 upload 501 MB -> 413: AC-1 user-visible error is
  drift today (uploadFiles silently falls through to local
  mode); it.fails() + control + e2e test.fail. AC-2 no-alert
  PASS via dialog spy.
- AZ-477 settings save 500 / network drop: AC-1+AC-2+AC-3
  all drift today (no try/finally, no error region, deadline
  unmeasurable); 4 it.fails() + control pinning the stuck-
  disabled drift; e2e companions test.fail mirror it.
- LESSONS.md seeded: vi.stubGlobal('URL', {...URL,...})
  destroys the URL constructor and breaks new URL(...) in
  MSW; patch the methods directly instead.

Code review: PASS (0 findings). Fast: 22/22 files, 120
passed / 13 skipped. Static: 24/24 PASS.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-11 05:19:35 +03:00

2.6 KiB

Test — Settings Save Resilience & 2 s Error Budget

Task: AZ-477_test_settings_resilience Name: Settings save 500 + network drop — saving flag reset + error surfaces ≤ 2 s Description: Implement the 5 blackbox tests covering Settings save resilience: upstream 500, network drop, the 2-second error-surface deadline, and the try/finally state reset that prevents a stuck "saving…" indicator. Complexity: 3 points Dependencies: AZ-456_test_infrastructure Component: 09_settings (Blackbox Tests) Tracker: AZ-477 Epic: AZ-455

Problem

Settings save has been observed to leave the saving flag set after an upstream failure (annotated in src__features__settings__SettingsPage.md). The user sees a forever-spinning button and the page becomes unusable. The contract: on ANY failure (HTTP error or network error), state resets within 2 s AND a user-visible error appears.

Outcome

  • 5 scenarios pass.

Scope

Included

Scenario Profile Source file
FT-N-13 — Settings save with 500 response — saving flag reset; error surfaced fast blackbox-tests.md
FT-N-14 — Settings save with network failure — try/finally state reset fast blackbox-tests.md
NFT-PERF-09 — Settings save error surfaces within 2 s fast performance-tests.md
NFT-RES-05 — Settings save with upstream 500 — UI state recovers fast resilience-tests.md
NFT-RES-06 — Settings save with network drop — try/finally state reset fast resilience-tests.md

Excluded

  • Settings happy path (covered by per-feature tests in Phase B).
  • Settings RBAC redirect (covered in 12_test_protected_route_rbac).

Acceptance Criteria

AC-1: 500 recovery FT-N-13 / NFT-RES-05 — MSW returns 500 on settings PUT; assert: (a) saving flag is off (Save button no longer disabled / spinner not shown) within 2 s, (b) an error region is present in DOM.

AC-2: Network drop FT-N-14 / NFT-RES-06 — MSW returns a network error; assert the same two conditions as AC-1.

AC-3: Deadline NFT-PERF-09 — measure wall-clock from response receipt (or network failure) to DOM error visibility; assert ≤ 2 s.

System Under Test Boundary

  • System under test: <SettingsPage> + its save handler + src/api/client.ts.
  • Allowed stubs: MSW for the settings PUT endpoint (returns 500 / network error per scenario).
  • Disallowed: reading React state — test asserts DOM affordances (disabled button, error region).
  • Expected observables per results_report.md rows 68-70 + the rows for NFT-RES-05/06.