Add end-to-end tests for task assignment, modification, sorting, and child view updates
All checks were successful
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 3m57s

- Implement tests to verify that assigned titles display the correct child name in various chore and reward views.
- Create tests to ensure that child updates via SSE reflect correctly in the UI for task modifications, including point overrides and pending status resets.
- Add tests to validate the sorting order of tasks and rewards in both child and parent views, ensuring proper prioritization of pending, completed, and scheduled tasks.
- Introduce tests for scrolling behavior to ensure edited tasks are brought into view after modifications.
This commit is contained in:
2026-03-26 12:30:48 -04:00
parent 16701278ed
commit 028f99b5c3
14 changed files with 1468 additions and 17 deletions

View File

@@ -0,0 +1,55 @@
// spec: e2e/plans/bugs-1.0.6-set01.plan.md §1
import { test, expect, type APIRequestContext } from '@playwright/test'
const CHILD_NAME = 'AssignTitleChild'
async function createTestChild(request: APIRequestContext, name: string): Promise<string> {
const pre = await request.get('/api/child/list')
for (const c of (await pre.json()).children ?? []) {
if (c.name === name) await request.delete(`/api/child/${c.id}`)
}
await request.put('/api/child/add', { data: { name, age: 8 } })
const list = await request.get('/api/child/list')
return (await list.json()).children?.find((c: any) => c.name === name)?.id ?? ''
}
test.describe('Assign view heading shows child name', () => {
let childId = ''
test.beforeAll(async ({ request }) => {
childId = await createTestChild(request, CHILD_NAME)
})
test.afterAll(async ({ request }) => {
if (childId) await request.delete(`/api/child/${childId}`)
})
test('"Assign Chores" heading contains child name', async ({ page }) => {
await page.goto(`/parent/${childId}/assign-chores?name=${CHILD_NAME}`)
await expect(
page.getByRole('heading', { name: new RegExp(`Assign Chores.*${CHILD_NAME}`) }),
).toBeVisible()
})
test('"Assign Rewards" heading contains child name', async ({ page }) => {
await page.goto(`/parent/${childId}/assign-rewards?name=${CHILD_NAME}`)
await expect(
page.getByRole('heading', { name: new RegExp(`Assign Rewards.*${CHILD_NAME}`) }),
).toBeVisible()
})
test('"Assign Kindness Acts" heading contains child name', async ({ page }) => {
await page.goto(`/parent/${childId}/assign-kindness?name=${CHILD_NAME}`)
await expect(
page.getByRole('heading', { name: new RegExp(`Assign Kindness Acts.*${CHILD_NAME}`) }),
).toBeVisible()
})
test('"Assign Penalties" heading contains child name', async ({ page }) => {
await page.goto(`/parent/${childId}/assign-penalties?name=${CHILD_NAME}`)
await expect(
page.getByRole('heading', { name: new RegExp(`Assign Penalties.*${CHILD_NAME}`) }),
).toBeVisible()
})
})