# 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 Chores` from the child's ParentView
- expect: navigates to `/parent/:id/assign-chores` with the heading and test chores listed; nothing pre-checked on a fresh child

#### 1.2. Select chores and submit — items appear in ParentView ✅

- Select `AssignTestChore1` and `AssignTestChore2`, click `Submit`
- 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: `AssignTestChore1` and `AssignTestChore2` are pre-checked; `AssignTestChore3` is 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`, click `Cancel`, then navigate back to the view
- expect: `AssignTestChore3` is 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 Acts` from the child's ParentView
- expect: navigates to `/parent/:id/assign-kindness` with the heading and `AssignTestKindness1` listed and unchecked

#### 2.2. Select a kindness act and submit — item appears in ParentView ✅

- Select `AssignTestKindness1`, click `Submit`
- 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: `AssignTestKindness1` is pre-checked

#### 2.4. Uncheck the kindness act and submit — item is removed from ParentView ✅

- Uncheck `AssignTestKindness1`, click `Submit`
- expect: returns to ParentView; item is no longer visible

#### 2.5. Cancel does not persist selection changes ✅

- Check `AssignTestKindness1`, click `Cancel`, then navigate back to the view
- expect: `AssignTestKindness1` is 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 Penalties` from the child's ParentView
- expect: navigates to `/parent/:id/assign-penalties` with the heading and test penalties listed and unchecked

#### 3.2. Select penalties and submit — items appear in ParentView ✅

- Select `AssignTestPenalty1` and `AssignTestPenalty2`, click `Submit`
- 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: `AssignTestPenalty1` and `AssignTestPenalty2` are pre-checked; `AssignTestPenalty3` is 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`, click `Cancel`, then navigate back to the view
- expect: `AssignTestPenalty3` is 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 Rewards` from the child's ParentView
- expect: navigates to `/parent/:id/assign-rewards` with the heading and test rewards listed and unchecked

#### 4.2. Select rewards and submit — items appear in ParentView ✅

- Select `AssignTestReward1` and `AssignTestReward2`, click `Submit`
- 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: `AssignTestReward1` and `AssignTestReward2` are pre-checked; `AssignTestReward3` is 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`, click `Cancel`, then navigate back to the view
- expect: `AssignTestReward3` is still unchecked
