test: add e2e tests for bucket selector with multiple kanban views

Verify that the bucket selector in the task detail view correctly
handles projects with multiple kanban views: hidden from list view,
and showing the right buckets for each kanban view.
This commit is contained in:
kolaente 2026-04-02 10:52:48 +02:00
parent 2da4f97bf1
commit 433c68a756
1 changed files with 94 additions and 0 deletions

View File

@ -80,6 +80,100 @@ test.describe('Task Bucket Select', () => {
await expect(page.locator('.task-view .subtitle .bucket-name')).not.toBeVisible()
})
test.describe('Multiple kanban views', () => {
async function createTaskWithMultipleKanbanViews() {
const projects = await ProjectFactory.create(1)
const listView = (await ProjectViewFactory.create(1, {
id: 1,
project_id: projects[0].id,
view_kind: 0,
}))[0]
const kanbanView1 = (await ProjectViewFactory.create(1, {
id: 2,
project_id: projects[0].id,
view_kind: 3,
bucket_configuration_mode: 1,
}, false))[0]
const kanbanView2 = (await ProjectViewFactory.create(1, {
id: 3,
project_id: projects[0].id,
view_kind: 3,
bucket_configuration_mode: 1,
}, false))[0]
const bucketsView1 = await BucketFactory.create(2, {
project_view_id: kanbanView1.id,
})
const bucketsView2 = await BucketFactory.create(2, {
id: (i: number) => i + 2,
project_view_id: kanbanView2.id,
}, false)
const tasks = await TaskFactory.create(1, {
project_id: projects[0].id,
})
await TaskBucketFactory.create(1, {
task_id: tasks[0].id,
bucket_id: bucketsView1[0].id,
project_view_id: kanbanView1.id,
})
await TaskBucketFactory.create(1, {
task_id: tasks[0].id,
bucket_id: bucketsView2[0].id,
project_view_id: kanbanView2.id,
}, false)
return {
project: projects[0],
listView,
kanbanView1,
kanbanView2,
bucketsView1,
bucketsView2,
task: tasks[0],
}
}
test('Does not show the bucket selector when opening a task from the list view', async ({authenticatedPage: page}) => {
const {project, listView, task} = await createTaskWithMultipleKanbanViews()
await page.goto(`/projects/${project.id}/${listView.id}`)
await page.locator('.tasks .task').filter({hasText: task.title}).click()
await expect(page).toHaveURL(new RegExp(`/tasks/${task.id}`))
await expect(page.locator('.task-view .subtitle .bucket-name')).not.toBeVisible()
})
test('Shows the correct buckets when opening a task from the first kanban view', async ({authenticatedPage: page}) => {
const {project, kanbanView1, bucketsView1, task} = await createTaskWithMultipleKanbanViews()
await page.goto(`/projects/${project.id}/${kanbanView1.id}`)
await expect(page.locator('.kanban .bucket .tasks .task').filter({hasText: task.title})).toBeVisible()
await page.locator('.kanban .bucket .tasks .task').filter({hasText: task.title}).click()
await expect(page).toHaveURL(new RegExp(`/tasks/${task.id}`))
await expect(page.locator('.task-view .subtitle')).toContainText(bucketsView1[0].title)
await page.locator('.task-view .subtitle .bucket-name').click()
await expect(page.locator('.task-view .subtitle .dropdown-item')).toHaveCount(bucketsView1.length)
for (const bucket of bucketsView1) {
await expect(page.locator('.task-view .subtitle .dropdown-item').filter({hasText: bucket.title})).toBeVisible()
}
})
test('Shows the correct buckets when opening a task from the second kanban view', async ({authenticatedPage: page}) => {
const {project, kanbanView2, bucketsView2, task} = await createTaskWithMultipleKanbanViews()
await page.goto(`/projects/${project.id}/${kanbanView2.id}`)
await expect(page.locator('.kanban .bucket .tasks .task').filter({hasText: task.title})).toBeVisible()
await page.locator('.kanban .bucket .tasks .task').filter({hasText: task.title}).click()
await expect(page).toHaveURL(new RegExp(`/tasks/${task.id}`))
await expect(page.locator('.task-view .subtitle')).toContainText(bucketsView2[0].title)
await page.locator('.task-view .subtitle .bucket-name').click()
await expect(page.locator('.task-view .subtitle .dropdown-item')).toHaveCount(bucketsView2.length)
for (const bucket of bucketsView2) {
await expect(page.locator('.task-view .subtitle .dropdown-item').filter({hasText: bucket.title})).toBeVisible()
}
})
})
test('Keeps action buttons visible after changing the bucket', async ({authenticatedPage: page}) => {
const {project, view, buckets, task} = await createKanbanTaskInBucket()