- Implemented tests for editing penalty points and reward costs in `penalty-edit-points.spec.ts` and `reward-edit-cost.spec.ts`. - Created detailed plans for task activation and assignment scenarios in `task-activated.plan.md` and `task-assignment.plan.md`. - Added comprehensive test cases for modifying tasks, including editing points for chores, kindness acts, penalties, and rewards in `task-modified.plan.md`. - Ensured all tests are isolated and run in serial mode to maintain state integrity.
6.1 KiB
Parent Assign Chores, Kindness Acts, Penalties, and Rewards to a Child
Application Overview
Tests for the parent-mode flows where a parent assigns task items (chores, kindness acts, penalties) and rewards to a specific child. Each suite navigates from the child's ParentView (/parent/:id) to the relevant assign view and verifies that selections are saved and reflected back in the ParentView.
The parent is authenticated via stored auth state (e2e/.auth/user.json). Each spec creates its own test child and items via the API so it is fully isolated from parallel test projects that mutate seed data. All created resources are deleted in afterAll. Tests run in serial mode within each suite to preserve assignment state across the sequence.
Playwright Project
Project name: chromium-task-assignment
Config: playwright.config.ts
testMatch: /mode_parent/task-assignment/.+\.spec\.ts/
Dependencies: setup
Excluded from: chromium-tasks-rewards (via testIgnore)
Test Scenarios
1. Chore Assignment ✅ IMPLEMENTED
File: e2e/mode_parent/task-assignment/chore-assignment.spec.ts
Seed: Creates child AssignChoreChild and tasks AssignTestChore1/2/3 (type chore) via API in beforeAll. Deletes all in afterAll.
1.1. "Assign Chores" button navigates to the chore assign view ✅
- Click
Assign Choresfrom the child's ParentView - expect: navigates to
/parent/:id/assign-choreswith the heading and test chores listed; nothing pre-checked on a fresh child
1.2. Select chores and submit — items appear in ParentView ✅
- Select
AssignTestChore1andAssignTestChore2, clickSubmit - expect: returns to ParentView; both chores are visible
1.3. Re-opening assign view shows assigned items as pre-checked ✅
- Navigate back to the assign-chores view
- expect:
AssignTestChore1andAssignTestChore2are pre-checked;AssignTestChore3is not
1.4. Uncheck all chores and submit — items are removed from ParentView ✅
- Uncheck both assigned chores, click
Submit - expect: returns to ParentView; neither chore is visible
1.5. Cancel does not persist selection changes ✅
- Check
AssignTestChore3, clickCancel, then navigate back to the view - expect:
AssignTestChore3is still unchecked
2. Kindness Act Assignment ✅ IMPLEMENTED
File: e2e/mode_parent/task-assignment/kindness-assignment.spec.ts
Seed: Creates child AssignKindnessChild and task AssignTestKindness1 (type kindness) via API in beforeAll. Deletes all in afterAll.
2.1. "Assign Kindness Acts" button navigates to the kindness assign view ✅
- Click
Assign Kindness Actsfrom the child's ParentView - expect: navigates to
/parent/:id/assign-kindnesswith the heading andAssignTestKindness1listed and unchecked
2.2. Select a kindness act and submit — item appears in ParentView ✅
- Select
AssignTestKindness1, clickSubmit - expect: returns to ParentView; item is visible
2.3. Re-opening assign view shows the assigned item as pre-checked ✅
- Navigate back to the assign-kindness view
- expect:
AssignTestKindness1is pre-checked
2.4. Uncheck the kindness act and submit — item is removed from ParentView ✅
- Uncheck
AssignTestKindness1, clickSubmit - expect: returns to ParentView; item is no longer visible
2.5. Cancel does not persist selection changes ✅
- Check
AssignTestKindness1, clickCancel, then navigate back to the view - expect:
AssignTestKindness1is still unchecked
3. Penalty Assignment ✅ IMPLEMENTED
File: e2e/mode_parent/task-assignment/penalty-assignment.spec.ts
Seed: Creates child AssignPenaltyChild and tasks AssignTestPenalty1/2/3 (type penalty) via API in beforeAll. Deletes all in afterAll.
3.1. "Assign Penalties" button navigates to the penalty assign view ✅
- Click
Assign Penaltiesfrom the child's ParentView - expect: navigates to
/parent/:id/assign-penaltieswith the heading and test penalties listed and unchecked
3.2. Select penalties and submit — items appear in ParentView ✅
- Select
AssignTestPenalty1andAssignTestPenalty2, clickSubmit - expect: returns to ParentView; both penalties are visible
3.3. Re-opening assign view shows assigned penalties as pre-checked ✅
- Navigate back to the assign-penalties view
- expect:
AssignTestPenalty1andAssignTestPenalty2are pre-checked;AssignTestPenalty3is not
3.4. Uncheck all penalties and submit — items are removed from ParentView ✅
- Uncheck both assigned penalties, click
Submit - expect: returns to ParentView; neither penalty is visible
3.5. Cancel does not persist selection changes ✅
- Check
AssignTestPenalty3, clickCancel, then navigate back to the view - expect:
AssignTestPenalty3is still unchecked
4. Reward Assignment ✅ IMPLEMENTED
File: e2e/mode_parent/task-assignment/reward-assignment.spec.ts
Seed: Creates child AssignRewardChild and rewards AssignTestReward1/2/3 (cost 10) via API in beforeAll. Deletes all in afterAll.
4.1. "Assign Rewards" button navigates to the reward assign view ✅
- Click
Assign Rewardsfrom the child's ParentView - expect: navigates to
/parent/:id/assign-rewardswith the heading and test rewards listed and unchecked
4.2. Select rewards and submit — items appear in ParentView ✅
- Select
AssignTestReward1andAssignTestReward2, clickSubmit - expect: returns to ParentView; both rewards are visible
4.3. Re-opening assign view shows assigned rewards as pre-checked ✅
- Navigate back to the assign-rewards view
- expect:
AssignTestReward1andAssignTestReward2are pre-checked;AssignTestReward3is not
4.4. Uncheck all rewards and submit — items are removed from ParentView ✅
- Uncheck both assigned rewards, click
Submit - expect: returns to ParentView; neither reward is visible
4.5. Cancel does not persist selection changes ✅
- Check
AssignTestReward3, clickCancel, then navigate back to the view - expect:
AssignTestReward3is still unchecked