Refactored frontend directory
Some checks failed
Chore App Build, Test, and Push Docker Images / build-and-push (push) Failing after 2m46s

This commit is contained in:
2026-04-25 00:40:15 -04:00
parent db846f4e31
commit 127378797c
263 changed files with 88 additions and 79 deletions

View File

@@ -0,0 +1,40 @@
import { test, expect } from '@playwright/test'
async function createTestChild(request: any, name: string, age = 8): Promise<string> {
await request.put('/api/child/add', { data: { name, age } })
const listRes = await request.get('/api/child/list')
const data = await listRes.json()
const child = (data.children ?? []).find((c: any) => c.name === name)
return child?.id ?? ''
}
test.describe('Child kebab menu Edit Child', () => {
const CHILD_NAME = 'KebabEdit'
let childId = ''
test.beforeEach(async ({ request }) => {
childId = await createTestChild(request, CHILD_NAME)
})
test.afterEach(async ({ request }) => {
if (childId) await request.delete(`/api/child/${childId}`)
childId = ''
})
test('Edit Child menu item navigates to the child editor', async ({ page }) => {
await page.goto('/parent')
await expect(page.getByRole('heading', { name: CHILD_NAME })).toBeVisible()
const card = page.locator('.card').filter({ hasText: CHILD_NAME })
await card.getByRole('button', { name: 'Options' }).click()
await expect(card.getByRole('button', { name: 'Options' })).toHaveAttribute(
'aria-expanded',
'true',
)
await card.getByRole('button', { name: 'Edit Child' }).click()
await expect(page).toHaveURL(/\/parent\/[^/]+\/edit/)
await expect(page.getByRole('heading', { name: 'Edit Child' })).toBeVisible()
})
})