Add end-to-end tests for parent item management
All checks were successful
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 3m31s

- Implement tests for creating, editing, and deleting chores, kindness acts, and penalties.
- Add tests to verify conversion of default items to user items and restoration of system defaults upon deletion.
- Ensure proper cancellation of creation and editing actions.
- Create a comprehensive plan document outlining the test scenarios and expected behaviors.
This commit is contained in:
2026-03-12 12:22:37 -04:00
parent accf596bd7
commit f250c42e5e
32 changed files with 1995 additions and 197 deletions

View File

@@ -0,0 +1,63 @@
// spec: frontend/vue-app/e2e/plans/parent-item-management.plan.md
// seed: e2e/seed.spec.ts
import { test, expect } from '@playwright/test'
test.describe('Kindness act cancellation', () => {
test.beforeEach(async ({ page }, testInfo) => {
test.skip(testInfo.project.name === 'chromium-no-pin', 'Requires parent-authenticated mode')
})
test('Cancel kindness act creation', async ({ page }) => {
await page.goto('/parent/tasks/chores')
await page.click('text=Kindness Acts')
await page.getByRole('button', { name: 'Create Kindness Act' }).click()
await page.evaluate(() => {
const setVal = (sel, val) => {
const el = document.querySelector(sel)
if (el) {
el.value = val
el.dispatchEvent(new Event('input', { bubbles: true }))
el.dispatchEvent(new Event('change', { bubbles: true }))
}
}
setVal('#name', 'Test')
setVal('#points', '5')
})
await page.getByRole('button', { name: 'Cancel' }).click()
await expect(page.locator('text=Should not save')).toHaveCount(0)
})
test('Cancel kindness act edit', async ({ page }) => {
await page.goto('/parent/tasks/chores')
await page.click('text=Kindness Acts')
if (!(await page.getByText('Share toys', { exact: true }).count())) {
await page.getByRole('button', { name: 'Create Kindness Act' }).click()
await page.evaluate(() => {
const setVal = (sel, val) => {
const el = document.querySelector(sel)
if (el) {
el.value = val
el.dispatchEvent(new Event('input', { bubbles: true }))
el.dispatchEvent(new Event('change', { bubbles: true }))
}
}
setVal('#name', 'Share toys')
setVal('#points', '5')
})
await page.getByRole('button', { name: 'Create' }).click()
}
// open edit by clicking row
await page.getByText('Share toys', { exact: true }).click()
await page.evaluate(() => {
const el = document.querySelector('#name')
if (el) {
el.value = 'Never saved'
el.dispatchEvent(new Event('input', { bubbles: true }))
el.dispatchEvent(new Event('change', { bubbles: true }))
}
})
await page.getByRole('button', { name: 'Cancel' }).click()
await expect(page.getByText('Share toys', { exact: true })).toBeVisible()
})
})