Files
chore/frontend/vue-app/e2e/mode_parent/rewards/reward-convert-default.spec.ts
Ryan Kegel db6e0a7ce8
All checks were successful
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 2m38s
feat: Implement user profile and parent profile button tests
- Added tests for user profile editing, including name changes, image uploads, and password changes.
- Implemented tests for changing the parent PIN with verification code handling.
- Created tests for account deletion with confirmation dialog and email validation.
- Introduced parent profile button tests for both temporary and permanent modes, verifying badge visibility and menu options.
- Updated Playwright configuration to include new test buckets for user profile and parent profile button scenarios.
- Added e2e plans documentation for user profile and parent profile button tests.
2026-03-18 17:20:31 -04:00

51 lines
2.0 KiB
TypeScript

// spec: frontend/vue-app/e2e/plans/parent-rewards-management.plan.md
// seed: e2e/seed.spec.ts
import { test, expect } from '@playwright/test'
test.describe('Convert default reward', () => {
test.beforeEach(async ({ page }, testInfo) => {
test.skip(testInfo.project.name === 'chromium-no-pin', 'Requires parent-authenticated mode')
})
test.describe.configure({ mode: 'serial' })
test('Convert a default reward to a user item', async ({ page }) => {
await page.goto('/parent/rewards')
// remove any row that has a delete button (covers custom copies and renamed originals)
const allRows = page.locator('text=Choose meal')
const total = await allRows.count()
for (let i = 0; i < total; i++) {
const r = allRows.nth(i)
const delBtn = r.locator('..').getByRole('button', { name: 'Delete' })
if ((await delBtn.count()) > 0) {
await delBtn.click()
await expect(page.locator('text=Are you sure you want to delete')).toBeVisible()
await page.locator('button.btn-danger:has-text("Delete")').click()
}
}
// locate the remaining default reward (exact text)
const row = page.getByText('Choose meal', { exact: true }).first()
await expect(row).toBeVisible()
// delete button should not exist initially on default
await expect(row.locator('..').getByRole('button', { name: 'Delete' })).toHaveCount(0)
// open edit form
await row.click()
await expect(page.locator('input#name')).toHaveValue('Choose meal')
// change fields
await page.locator('#name').fill('Choose meal (custom)')
await page.locator('#cost').fill('35')
await expect(page.getByRole('button', { name: 'Save' })).toBeEnabled()
await page.getByRole('button', { name: 'Save' }).click()
// after save, ensure row now has delete control
const updated = page.getByText('Choose meal (custom)', { exact: true }).first()
await expect(updated).toBeVisible()
await expect(updated.locator('..').getByRole('button', { name: 'Delete' })).toBeVisible()
})
})