From c93f644363696682075ba1edd79c490f031c0367 Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 21 Apr 2026 11:39:29 +0200 Subject: [PATCH] test(e2e): cover recurrence preset buttons --- frontend/tests/e2e/task/recurrence.spec.ts | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 frontend/tests/e2e/task/recurrence.spec.ts diff --git a/frontend/tests/e2e/task/recurrence.spec.ts b/frontend/tests/e2e/task/recurrence.spec.ts new file mode 100644 index 000000000..27161df3e --- /dev/null +++ b/frontend/tests/e2e/task/recurrence.spec.ts @@ -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) + }) +})