diff --git a/tests/task.spec.ts b/tests/task.spec.ts index ca5fa97..466a0d6 100644 --- a/tests/task.spec.ts +++ b/tests/task.spec.ts @@ -6,7 +6,7 @@ const ADMIN_USERNAME = 'admin'; const ADMIN_PASSWORD = 'admin123'; test.describe('Task & Comment Flow', () => { - test('login -> create project -> create milestone -> create task -> create issue -> comment -> logout', async ({ page }) => { + test('login -> create project -> create milestone -> create task -> create task item -> comment -> logout', async ({ page }) => { const TS = Date.now(); // ── Step 1: Login ────────────────────────────────────────────────── @@ -113,20 +113,20 @@ test.describe('Task & Comment Flow', () => { // Verify task appears in the Tasks tab await page.click('.tab:has-text("Tasks")'); await page.waitForTimeout(1000); - const taskRow = page.locator(`td.issue-title:has-text("${taskTitle}")`); + const taskRow = page.locator(`td.task-title:has-text("${taskTitle}")`); await expect(taskRow).toBeVisible({ timeout: 10000 }); console.log('✅ Task created and verified'); - // ── Step 5: Create Issue (for comment testing) ───────────────────── - // Tasks don't have a detail page with comments, so we create an Issue - // of type "task" to test the comment flow. - console.log('📋 Creating issue for comment testing...'); - await page.goto(`${BASE_URL}/issues/new`); + // ── 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 via the /tasks/new form to test the comment flow. + console.log('📋 Creating task item for comment testing...'); + await page.goto(`${BASE_URL}/tasks/new`); await page.waitForLoadState('networkidle'); - const issueTitle = `Test Issue for Comment ${TS}`; - await page.fill('label:has-text("Title") input', issueTitle); - await page.fill('label:has-text("Description") textarea', 'Issue created for comment testing'); + const taskItemTitle = `Test Task for Comment ${TS}`; + await page.fill('label:has-text("Title") input', taskItemTitle); + await page.fill('label:has-text("Description") textarea', 'Task created for comment testing'); // Select our project await page.selectOption('label:has-text("Projects") select', { label: projectName }); @@ -135,18 +135,18 @@ test.describe('Task & Comment Flow', () => { await page.waitForTimeout(300); await page.click('button.btn-primary:has-text("Create")'); - await page.waitForURL(`${BASE_URL}/issues`, { timeout: 10000 }); + await page.waitForURL(`${BASE_URL}/tasks`, { timeout: 10000 }); await page.waitForLoadState('networkidle'); - console.log('✅ Issue created'); + console.log('✅ Task item created'); - // ── Step 6: Open Issue → Add Comment ─────────────────────────────── - console.log('💬 Opening issue to add comment...'); - await page.click(`text=${issueTitle}`); + // ── Step 6: Open Task → Add Comment ──────────────────────────────── + console.log('💬 Opening task to add comment...'); + await page.click(`text=${taskItemTitle}`); await page.waitForLoadState('networkidle'); await page.waitForTimeout(1000); - // Verify we're on issue detail - await page.waitForSelector(`h2:has-text("${issueTitle}")`, { timeout: 10000 }); + // Verify we're on task detail + await page.waitForSelector(`h2:has-text("${taskItemTitle}")`, { timeout: 10000 }); const commentText = `Automated test comment ${TS}`; console.log(`Comment: ${commentText}`);