test: cover project milestone and task modal editors

This commit is contained in:
zhi
2026-03-16 18:13:54 +00:00
parent f50a2efdbf
commit 82e9dc2c86
3 changed files with 55 additions and 27 deletions

View File

@@ -52,10 +52,10 @@ test.describe('Task & Comment Flow', () => {
await page.waitForSelector('button:has-text("+ New")', { timeout: 10000 });
await page.click('button:has-text("+ New")');
await page.waitForSelector('input[placeholder="Project name"]', { timeout: 10000 });
await page.fill('input[placeholder="Project name"]', projectName);
await page.fill('input[placeholder="Description (optional)"]', 'Project for task & comment testing');
await page.click('button:has-text("Create")');
await page.waitForSelector('.modal', { timeout: 10000 });
await page.getByTestId('project-name-input').fill(projectName);
await page.getByTestId('project-description-input').fill('Project for task & comment testing');
await page.click('.modal button.btn-primary:has-text("Create")');
await page.waitForTimeout(2000);
await page.waitForSelector(`.project-card:has-text("${projectName}")`, { timeout: 10000 });
@@ -117,6 +117,19 @@ test.describe('Task & Comment Flow', () => {
await expect(taskRow).toBeVisible({ timeout: 10000 });
console.log('✅ Task created and verified');
// Edit the created task via task detail modal
console.log('✏️ Editing created task...');
await taskRow.click();
await page.waitForURL(/\/tasks\/\d+$/, { timeout: 10000 });
await page.click('button:has-text("Edit Task")');
await page.waitForSelector('.modal.task-create-modal', { timeout: 10000 });
const updatedTaskTitle = `${taskTitle} Updated`;
await page.getByTestId('task-title-input').fill(updatedTaskTitle);
await page.getByTestId('create-task-button').click();
await page.waitForSelector('.modal.task-create-modal', { state: 'detached', timeout: 10000 });
await expect(page.locator(`h2:has-text("${updatedTaskTitle}")`)).toBeVisible({ timeout: 10000 });
console.log('✅ Task edited and verified');
// ── Step 5: Create a Task item (for comment testing) ───────────────
// Milestone tasks don't have a detail page with comments, so we create
// a Task item from the shared Tasks-page modal to test the comment flow.