Refactor Playwright tests and update configurations
Some checks failed
Chore App Build, Test, and Push Docker Images / build-and-push (push) Has been cancelled
Some checks failed
Chore App Build, Test, and Push Docker Images / build-and-push (push) Has been cancelled
- Consolidated kindness and penalty tests into single files to ensure serial execution and prevent conflicts. - Updated Playwright configuration to define separate test buckets for child options and create child tests, ensuring proper execution order. - Added new tests for child kebab menu options including editing, deleting points, and confirming child deletion. - Removed obsolete tests for kindness and penalty default management. - Updated authentication tokens in user.json for improved security. - Enhanced test reliability by implementing retry logic for UI interactions in the create-child happy path test.
This commit is contained in:
@@ -26,6 +26,10 @@ async function deleteAllChildren(request: any) {
|
||||
}
|
||||
|
||||
test.describe('Create Child', () => {
|
||||
// Serial mode: the 'empty state' test calls deleteAllChildren() which would
|
||||
// race against sibling tests creating children if they ran in parallel.
|
||||
test.describe.configure({ mode: 'serial' })
|
||||
|
||||
test.beforeEach(async ({ page }, testInfo) => {
|
||||
test.skip(testInfo.project.name === 'chromium-no-pin', 'Requires parent-authenticated mode')
|
||||
})
|
||||
@@ -74,18 +78,20 @@ test.describe('Create Child', () => {
|
||||
})
|
||||
|
||||
test('Create a child via the inline Create button in empty state', async ({ page, request }) => {
|
||||
await deleteAllChildren(request)
|
||||
// 1. Navigate to empty state and click inline Create.
|
||||
// Retry-loop handles SSE-triggered re-renders: a parallel test may add a child
|
||||
// between deleteAllChildren() and the click, detaching the empty-state button.
|
||||
await expect(async () => {
|
||||
await deleteAllChildren(request)
|
||||
await page.goto('/')
|
||||
await expect(page.getByText('No children')).toBeVisible({ timeout: 5000 })
|
||||
await page.getByRole('button', { name: 'Create' }).click({ timeout: 5000 })
|
||||
await expect(page.getByRole('heading', { name: 'Create Child' })).toBeVisible({
|
||||
timeout: 5000,
|
||||
})
|
||||
}).toPass({ timeout: 30000 })
|
||||
|
||||
// 1. Navigate to app root - router redirects to /parent (children list)
|
||||
await page.goto('/')
|
||||
await expect(page.getByText('No children')).toBeVisible()
|
||||
await expect(page.getByRole('button', { name: 'Create' })).toBeVisible()
|
||||
|
||||
// 2. Click the inline 'Create' button
|
||||
await page.getByRole('button', { name: 'Create' }).click()
|
||||
await expect(page.getByRole('heading', { name: 'Create Child' })).toBeVisible()
|
||||
|
||||
// 3. Enter 'Bob' and '10', then submit
|
||||
// 2. Enter 'Bob' and '10', then submit
|
||||
const nameInput = page.getByLabel('Name')
|
||||
const ageInput = page.getByLabel('Age')
|
||||
const createButton = page.getByRole('button', { name: 'Create' })
|
||||
|
||||
Reference in New Issue
Block a user