- AZ-461 sync image detect URL canary (FT-P-11) PASS;
async-video QUARANTINE (FT-P-12) + X-Refresh-Token drift
(FT-P-13) recorded as it.fails() with controls.
- AZ-464 bulk-validate URL + UI sync (≤2 s) PASS;
body shape drift {annotationIds,status} vs contract
{ids,targetStatus:30} captured as it.fails().
- AZ-470 panel-width debounce + rehydration: entire task
is Phase-B target (useResizablePanel has no PUT writer
/ no rehydration); 3 ACs as it.fails() with controls.
- AZ-472 DetectionClasses load + click + fallback PASS;
hotkey arithmetic P=0 PASS, P=20/P=40 it.fails() for
classes[idx+P]-against-dense-array drift.
Code review: PASS (0 findings). Fast: 18/18 files,
102 passed / 13 skipped. Static: 21/21 PASS.
Co-authored-by: Cursor <cursoragent@cursor.com>
2.6 KiB
Test — DetectionClasses (Load, Hotkeys, Click, Fallback)
Task: AZ-472_test_detection_classes
Name: DetectionClasses load + 1-9 hotkeys + click path + empty/5xx fallback
Description: Implement the 4 blackbox tests pinning <DetectionClasses> behavior: load from /api/annotations/classes, hotkey 1-9 → classes[(key-1) + P] (P = current PhotoMode offset), click-to-select path, and the fallback list when the API is empty or 5xx.
Complexity: 3 points
Dependencies: AZ-456_test_infrastructure
Component: 06_annotations (DetectionClasses) + 11_class-colors (Blackbox Tests)
Tracker: AZ-472
Epic: AZ-455
Problem
<DetectionClasses> is keyboard-driven during annotation; the hotkey-to-class mapping changes with PhotoMode (offset P). Wrong P leaks the wrong class number on save — a quality regression hard to spot without explicit hotkey tests.
Outcome
- 4 scenarios pass — load contract, hotkey arithmetic, click selection, fallback robustness.
Scope
Included
| Scenario | Profile | Source file |
|---|---|---|
FT-P-44 — DetectionClasses loads from /api/annotations/classes |
fast + e2e | blackbox-tests.md |
FT-P-45 — class hotkey 1–9 selects classes[(key-1) + P] |
fast | blackbox-tests.md |
| FT-P-46 — class click path | fast | blackbox-tests.md |
| FT-P-47 — fallback class list on API empty/5xx | fast | blackbox-tests.md |
Excluded
- PhotoMode switching itself (covered in 18_test_photo_mode).
- Class CRUD via Admin (out of scope; per-feature task in Phase B).
Acceptance Criteria
AC-1: Load contract
FT-P-44 — outbound URL is /api/annotations/classes; response shape matches seed_classes (per the contract).
AC-2: Hotkey arithmetic FT-P-45 — for each PhotoMode P ∈ {0, 20, 40}, pressing keys 1..9 selects the corresponding class from the appropriate window of 9.
AC-3: Click FT-P-46 — clicking a class entry selects that class; outbound annotation save (if any) carries the right classId.
AC-4: Fallback
FT-P-47 — when /api/annotations/classes returns 200 with [] or any 5xx, the fallback class list is rendered; tests assert the fallback length and a marker indicating fallback mode.
System Under Test Boundary
- System under test:
<DetectionClasses>+<PhotoModeContext>(read-only here). - Allowed stubs: MSW for
/api/annotations/classes. - Disallowed: stubbing
<DetectionClasses>or reading its React state. - Expected observables per
results_report.mdrows 73-77 (Group 16).
Constraints
seed_classesMUST satisfy N≥9 (per test-data.md) so all hotkeys 1..9 are hot in P=0.