- Add backend routines management with add, get, update, delete, and list functionalities. - Create models for Routine, RoutineItem, RoutineSchedule, and RoutineExtension. - Develop event types for routine confirmation and modification. - Implement frontend components for routine assignment, confirmation dialog, and routine management views. - Add unit tests for routine API and integration tests for routine CRUD flow. - Create end-to-end test plan for routines feature covering parent and child interactions.
4.9 KiB
Routines Feature E2E Plan
Application Overview
The routines feature adds a new parent-defined checklist entity that sits between chores and rewards in child mode. A routine is confirmed as a whole (not per-item), then approved or rejected by the parent. Routine visibility and state are schedule-aware, include deadline extension support, and support per-child point overrides.
This plan is intentionally implementation-driven so we can incrementally add tests as each phase ships.
Coverage Areas
1. Parent Routine Library Management
File target: e2e/mode_parent/routines/routine-library.spec.ts
- Parent can create a routine with name, points, image.
- Parent can add multiple routine items and persist item order.
- Parent can edit routine metadata and item metadata.
- Parent can delete a routine item.
- Parent can delete a routine and it disappears from routine library list.
2. Parent Child Assignment and Management
File target: e2e/mode_parent/routines/routine-assignment.spec.ts
- Parent can assign routine to a child from assignable list.
- Parent can remove routine assignment from child.
- Parent can set/replace full routine assignment list for a child.
- Parent can set routine point override and child-facing value reflects override.
- Parent can set routine schedule and update it later.
- Parent can extend routine deadline for today.
3. Child Routine Rendering and Navigation
File target: e2e/mode_child/routines/routine-visibility.spec.ts
- Routines list renders between chores and rewards.
- Clicking a routine opens routine detail route (/child/:id/routine/:routineId).
- Detail view shows routine image, title, points, and non-interactive item list.
- Back navigation returns to child main view.
4. Child Routine Confirmation Flow
File target: e2e/mode_child/routines/routine-confirmation.spec.ts
- Child can mark routine Done; routine becomes pending.
- Child can cancel a pending routine confirmation.
- Child cannot submit duplicate pending confirmations.
- Approved-today routine shows completed state on child UI.
- Rejected routine returns to available state.
5. Parent Pending Confirmation Flow
File target: e2e/mode_parent/routines/routine-approval.spec.ts
- Routine confirmation appears in parent notification/pending list.
- Parent can approve routine; child points increase by default routine points.
- Parent can reject routine; child points do not change.
- Parent can reset approved/rejected routine to clear completion state.
- If routine override exists, approval uses override points instead of base points.
6. Routine Scheduling and Deadline Behavior
File target: e2e/mode_child/routines/routine-schedule.spec.ts
- Day-based schedules only show routines on scheduled days.
- Interval schedules show/hide routines on expected interval dates.
- Routine with deadline in the past displays TOO LATE and blocks Done.
- Extending deadline removes TOO LATE state for that day.
- Changing schedule resets stale pending status.
7. Cascade and Data Integrity
File target: e2e/mode_parent/routines/routine-cascade.spec.ts
- Deleting routine removes it from all assigned children.
- Deleting routine removes routine items.
- Deleting routine removes routine schedules and extensions.
- Deleting routine removes routine point overrides.
- Deleting child removes child routine schedules/extensions/overrides.
8. SSE Reactivity
File target: e2e/multi-session/routines/routine-sse.spec.ts
- Parent routine add/edit/delete updates child assignment views without refresh.
- Child routine pending/approved/rejected/reset updates parent notification UI without refresh.
- Schedule/extension changes update child routine card state without refresh.
- Override changes update points display without refresh.
Test Data and Execution Notes
- Use API seeding in beforeAll and cleanup in afterAll per spec file.
- Use stable role/label-based locators only.
- Avoid /auth/login navigation in tests; rely on global storageState.
- For time-sensitive schedule tests, set deterministic times (or use clock controls where practical).
Unit Test Expansion Checklist
Backend unit tests to add during implementation
- Routine CRUD API validation and ownership checks.
- Routine item CRUD and ordering behavior.
- Child routine assignment list and assignable-list filtering.
- Routine confirmation approve/reject/reset state transitions.
- Routine schedule and extension endpoints (including duplicate extension conflict).
- Routine deletion cascades (items/schedules/extensions/overrides/child assignments).
Frontend unit tests to add during implementation
- API helper coverage for routine endpoints.
- ScheduleModal entityType routing behavior for task vs routine.
- Child routine list sorting/filtering utility behavior.
- Routine detail confirmation UI state transitions.
- Parent pending confirmation card rendering for entity_type='routine'.