test(e2e): cover recurrence preset buttons

This commit is contained in:
kolaente 2026-04-21 11:39:29 +02:00 committed by kolaente
parent f2eee5d8a1
commit c93f644363
1 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,29 @@
import {test, expect} from '../../support/fixtures'
import {ProjectFactory} from '../../factories/project'
import {TaskFactory} from '../../factories/task'
test.describe('Task recurrence', () => {
test.beforeEach(async ({authenticatedPage}) => {
await ProjectFactory.create(1, {id: 1})
})
test('sets repeat-every-day via preset button', async ({authenticatedPage: page}) => {
const [task] = await TaskFactory.create(1, {
id: 1,
project_id: 1,
due_date: new Date(Date.now() + 86_400_000).toISOString(),
}, false)
await page.goto(`/tasks/${task.id}`)
// Reveal the RepeatAfter component (hidden until the user activates it)
await page.getByRole('button', {name: 'Set Repeating Interval'}).click()
const save = page.waitForResponse(r =>
r.url().includes(`/tasks/${task.id}`) && r.request().method() === 'POST',
)
await page.getByRole('button', {name: 'Every Day'}).click()
const r = await save
const body = r.request().postDataJSON()
expect(body.repeat_after).toBe(86400)
})
})