feat: add enable/disable toggle for chore scheduling in ScheduleModal
All checks were successful
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 2m39s
All checks were successful
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 2m39s
- Introduced a toggle button to enable or disable chores in the scheduler. - The toggle will be available in both types of schedulers. - Added UI design proposal and considerations for mobile dimensions. - Included E2E tests to ensure toggle state persistence and correct behavior in child view.
This commit is contained in:
@@ -2,32 +2,33 @@
|
||||
// Merged from penalty-convert-default.spec.ts and penalty-delete-default.spec.ts.
|
||||
// Both tests touch "Fighting" so they MUST run serially.
|
||||
|
||||
import { test, expect } from '@playwright/test'
|
||||
import { test, expect, type APIRequestContext } from '@playwright/test'
|
||||
|
||||
const BACKEND = 'http://localhost:5000'
|
||||
|
||||
async function cleanupFightingTasks(request: APIRequestContext): Promise<void> {
|
||||
const res = await request.get(`${BACKEND}/task/list`)
|
||||
if (!res.ok()) return
|
||||
const { tasks }: { tasks: Array<{ id: string; name: string; user_id: string | null }> } =
|
||||
await res.json()
|
||||
for (const task of tasks) {
|
||||
if (task.user_id !== null && (task.name === 'Fighting (custom)' || task.name === 'Fighting')) {
|
||||
await request.delete(`${BACKEND}/task/${task.id}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
test.describe('Default penalty management', () => {
|
||||
test.describe.configure({ mode: 'serial' })
|
||||
|
||||
test.beforeEach(async ({ request }) => {
|
||||
await cleanupFightingTasks(request)
|
||||
})
|
||||
|
||||
test('Convert a default penalty to a user item by editing', async ({ page }) => {
|
||||
await page.goto('/parent/tasks/chores')
|
||||
await page.click('text=Penalties')
|
||||
|
||||
// Cleanup: delete any leftover 'Fighting (custom)' from a prior run
|
||||
while (
|
||||
(await page
|
||||
.getByText('Fighting (custom)', { exact: true })
|
||||
.locator('..')
|
||||
.locator('button[aria-label="Delete item"]')
|
||||
.count()) > 0
|
||||
) {
|
||||
await page
|
||||
.getByText('Fighting (custom)', { exact: true })
|
||||
.locator('..')
|
||||
.locator('button[aria-label="Delete item"]')
|
||||
.first()
|
||||
.click()
|
||||
await page.getByRole('button', { name: 'Delete', exact: true }).click()
|
||||
}
|
||||
|
||||
// locate default penalty
|
||||
await expect(page.getByText('Fighting', { exact: true })).toBeVisible()
|
||||
await expect(
|
||||
@@ -67,23 +68,6 @@ test.describe('Default penalty management', () => {
|
||||
await page.goto('/parent/tasks/chores')
|
||||
await page.getByText('Penalties').click()
|
||||
|
||||
// Cleanup: if a previous run left a modified 'Fighting' (with delete icon), remove it first
|
||||
while (
|
||||
(await page
|
||||
.getByText('Fighting', { exact: true })
|
||||
.locator('..')
|
||||
.locator('button[aria-label="Delete item"]')
|
||||
.count()) > 0
|
||||
) {
|
||||
await page
|
||||
.getByText('Fighting', { exact: true })
|
||||
.locator('..')
|
||||
.locator('button[aria-label="Delete item"]')
|
||||
.first()
|
||||
.click()
|
||||
await page.getByRole('button', { name: 'Delete', exact: true }).click()
|
||||
}
|
||||
|
||||
// 1. Verify 'Fighting' is the system default (visible, no delete icon)
|
||||
await expect(page.getByText('Fighting', { exact: true })).toBeVisible()
|
||||
await expect(
|
||||
|
||||
Reference in New Issue
Block a user