Some checks failed
Chore App Build, Test, and Push Docker Images / build-and-push (push) Failing after 1m44s
- Added E2E test setup in `auth_api.py` with `/e2e-seed` endpoint for database reset and test user creation. - Integrated Playwright for end-to-end testing in the frontend with necessary dependencies in `package.json` and `package-lock.json`. - Created Playwright configuration in `playwright.config.ts` to manage test execution and server setup. - Developed new skills for Playwright best practices, visual regression, smoke test generation, and self-healing tests. - Implemented new test cases for chore creation in `chores-create.smoke.spec.ts` and `chores-create.spec.ts`. - Added page object models for `ChildEditPage` and `LandingPage` to streamline test interactions. - Updated `.gitignore` to exclude Playwright reports and test results. - Enhanced documentation in `copilot-instructions.md` for testing and E2E setup.
41 lines
1.5 KiB
TypeScript
41 lines
1.5 KiB
TypeScript
import { test, expect } from '@playwright/test'
|
|
|
|
// Test: Create a Chore
|
|
|
|
test.describe('Chores Tab - Create Chore', () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
// Log in and navigate to Chores tab
|
|
await page.goto('/')
|
|
// Assume login is handled by globalSetup and storageState
|
|
await page.click('button:has-text("Chores")')
|
|
await expect(page).toHaveURL(/chores/)
|
|
})
|
|
|
|
test('should open create chore form and validate fields', async ({ page }) => {
|
|
await page.click('button:has-text("Add Chore")')
|
|
await expect(page.locator('form')).toBeVisible()
|
|
|
|
// Try submitting empty form
|
|
await page.click('button:has-text("Create")')
|
|
await expect(page.locator('.error')).toBeVisible()
|
|
|
|
// Fill valid fields
|
|
await page.fill('input[name="name"]', 'Take out trash')
|
|
await page.fill('textarea[name="description"]', 'Take out trash before dinner')
|
|
await page.fill('input[name="due_date"]', '2099-12-31')
|
|
await page.selectOption('select[name="assigned_child"]', { index: 0 })
|
|
await page.selectOption('select[name="reward"]', { index: 0 })
|
|
|
|
// Submit
|
|
await page.click('button:has-text("Create")')
|
|
await expect(page.locator('.success')).toBeVisible()
|
|
await expect(page.locator('.chore-list')).toContainText('Take out trash')
|
|
})
|
|
|
|
test('should cancel chore creation', async ({ page }) => {
|
|
await page.click('button:has-text("Add Chore")')
|
|
await page.click('button:has-text("Cancel")')
|
|
await expect(page.locator('form')).not.toBeVisible()
|
|
})
|
|
})
|