test: cover shared task creation modal flow
This commit is contained in:
@@ -98,17 +98,17 @@ test.describe('Task & Comment Flow', () => {
|
|||||||
|
|
||||||
// Click "+ Create Task"
|
// Click "+ Create Task"
|
||||||
await page.click('button:has-text("+ Create Task")');
|
await page.click('button:has-text("+ Create Task")');
|
||||||
await page.waitForTimeout(500);
|
await page.waitForSelector('.modal.task-create-modal', { timeout: 10000 });
|
||||||
|
|
||||||
const taskTitle = `Test Task ${TS}`;
|
const taskTitle = `Test Task ${TS}`;
|
||||||
console.log(`Task title: ${taskTitle}`);
|
console.log(`Task title: ${taskTitle}`);
|
||||||
await page.fill('input[placeholder="Title"]', taskTitle);
|
await page.getByTestId('task-title-input').fill(taskTitle);
|
||||||
await page.fill('textarea[placeholder="Description (optional)"]', 'Task created by automated test');
|
await page.getByTestId('task-description-input').fill('Task created by automated test');
|
||||||
await page.waitForTimeout(300);
|
await page.waitForTimeout(300);
|
||||||
|
|
||||||
// Click Create button in the card form
|
await page.getByTestId('create-task-button').click();
|
||||||
await page.click('.card button.btn-primary');
|
await page.waitForSelector('.modal.task-create-modal', { state: 'detached', timeout: 10000 });
|
||||||
await page.waitForTimeout(2000);
|
await page.waitForTimeout(1500);
|
||||||
|
|
||||||
// Verify task appears in the Tasks tab
|
// Verify task appears in the Tasks tab
|
||||||
await page.click('.tab:has-text("Tasks")');
|
await page.click('.tab:has-text("Tasks")');
|
||||||
@@ -119,10 +119,12 @@ test.describe('Task & Comment Flow', () => {
|
|||||||
|
|
||||||
// ── Step 5: Create a Task item (for comment testing) ───────────────
|
// ── Step 5: Create a Task item (for comment testing) ───────────────
|
||||||
// Milestone tasks don't have a detail page with comments, so we create
|
// Milestone tasks don't have a detail page with comments, so we create
|
||||||
// a Task item via the /tasks/new form to test the comment flow.
|
// a Task item from the shared Tasks-page modal to test the comment flow.
|
||||||
console.log('📋 Creating task item for comment testing...');
|
console.log('📋 Creating task item for comment testing...');
|
||||||
await page.goto(`${BASE_URL}/tasks/new`);
|
await page.goto(`${BASE_URL}/tasks`);
|
||||||
await page.waitForLoadState('networkidle');
|
await page.waitForLoadState('networkidle');
|
||||||
|
await page.click('button:has-text("+ Create Task")');
|
||||||
|
await page.waitForSelector('.modal.task-create-modal', { timeout: 10000 });
|
||||||
|
|
||||||
const taskItemTitle = `Test Task for Comment ${TS}`;
|
const taskItemTitle = `Test Task for Comment ${TS}`;
|
||||||
await page.getByTestId('task-title-input').fill(taskItemTitle);
|
await page.getByTestId('task-title-input').fill(taskItemTitle);
|
||||||
@@ -157,11 +159,14 @@ test.describe('Task & Comment Flow', () => {
|
|||||||
|
|
||||||
await page.waitForURL(`${BASE_URL}/tasks`, { timeout: 10000 });
|
await page.waitForURL(`${BASE_URL}/tasks`, { timeout: 10000 });
|
||||||
await page.waitForLoadState('networkidle');
|
await page.waitForLoadState('networkidle');
|
||||||
console.log('✅ Task item created');
|
await expect(page.locator('.tasks-table')).toBeVisible({ timeout: 10000 });
|
||||||
|
await expect(page.locator(`.tasks-table tr:has-text("${taskItemTitle}")`)).toBeVisible({ timeout: 10000 });
|
||||||
|
console.log('✅ Task item created and visible in list');
|
||||||
|
|
||||||
// ── Step 6: Open Task → Add Comment ────────────────────────────────
|
// ── Step 6: Open Task → Add Comment ────────────────────────────────
|
||||||
console.log('💬 Opening task to add comment...');
|
console.log('💬 Opening task to add comment...');
|
||||||
await page.goto(`${BASE_URL}/tasks/${createdTask.id}`);
|
await page.click(`.tasks-table tr:has-text("${taskItemTitle}")`);
|
||||||
|
await page.waitForURL(`${BASE_URL}/tasks/${createdTask.id}`, { timeout: 10000 });
|
||||||
await page.waitForLoadState('networkidle');
|
await page.waitForLoadState('networkidle');
|
||||||
await page.waitForTimeout(1000);
|
await page.waitForTimeout(1000);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user