test(gantt): add e2e test for date range preservation after task modal close

Verifies that opening and closing a task modal on the Gantt view
does not lose the date range query parameters.
This commit is contained in:
kolaente 2026-04-03 21:17:21 +02:00 committed by kolaente
parent d152fa8475
commit 642134d16f
1 changed files with 25 additions and 0 deletions

View File

@ -132,4 +132,29 @@ test.describe('Project View Gantt', () => {
await expect(page).toHaveURL(new RegExp(`/tasks/${tasks[0].id}`))
})
test('Should preserve date range query parameters after opening and closing a task modal', async ({authenticatedPage: page}) => {
await ProjectFactory.create(1)
await ProjectViewFactory.create(1, {id: 2, project_id: 1, view_kind: 1})
await TaskFactory.create(1, {
start_date: new Date(2022, 9, 1).toISOString(),
end_date: new Date(2022, 9, 5).toISOString(),
})
await page.goto('/projects/1/2?dateFrom=2022-09-25&dateTo=2022-11-05')
// Verify the date range is shown
await expect(page).toHaveURL(/dateFrom=2022-09-25/)
await expect(page).toHaveURL(/dateTo=2022-11-05/)
// Double-click the task to open the modal
await page.locator('.gantt-container .gantt-row-bars .gantt-bar').dblclick()
await expect(page).toHaveURL(/\/tasks\//)
// Close the modal
await page.locator('dialog[open] .modal-container > .close').click()
// Verify the date range query parameters are preserved
await expect(page).toHaveURL(/dateFrom=2022-09-25/)
await expect(page).toHaveURL(/dateTo=2022-11-05/)
})
})