test: stabilize task and role editor flows

This commit is contained in:
zhi
2026-03-16 13:22:24 +00:00
parent 53c974eb25
commit 67aa98da4f
2 changed files with 49 additions and 15 deletions

View File

@@ -125,23 +125,43 @@ test.describe('Task & Comment Flow', () => {
await page.waitForLoadState('networkidle');
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');
await page.getByTestId('task-title-input').fill(taskItemTitle);
await page.getByTestId('task-description-input').fill('Task created for comment testing');
// Select our project
await page.selectOption('label:has-text("Projects") select', { label: projectName });
// Select type "Task"
await page.selectOption('label:has-text("Type") select', 'task');
// Select our project and wait for milestones to load
await page.getByTestId('project-select').selectOption({ label: projectName });
await page.waitForLoadState('networkidle');
await page.waitForTimeout(1000);
const milestoneSelect = page.getByTestId('milestone-select');
await expect.poll(async () => {
const options = await milestoneSelect.locator('option').allTextContents();
return options.includes(milestoneName);
}, { timeout: 10000 }).toBeTruthy();
const msOptions = await milestoneSelect.locator('option').allTextContents();
console.log('Milestone options:', msOptions);
await milestoneSelect.selectOption({ label: milestoneName });
await page.getByTestId('task-type-select').selectOption('task');
await page.waitForTimeout(300);
await page.click('button.btn-primary:has-text("Create")');
const createTaskResponsePromise = page.waitForResponse((response) => {
return response.request().method() === 'POST' && /\/tasks(?:\?|$)/.test(response.url());
});
await page.getByTestId('create-task-button').click();
const createTaskResponse = await createTaskResponsePromise;
expect(createTaskResponse.ok()).toBeTruthy();
const createdTask = await createTaskResponse.json();
console.log('Created task item response:', createdTask);
await page.waitForURL(`${BASE_URL}/tasks`, { timeout: 10000 });
await page.waitForLoadState('networkidle');
console.log('✅ Task item created');
// ── Step 6: Open Task → Add Comment ────────────────────────────────
console.log('💬 Opening task to add comment...');
await page.click(`text=${taskItemTitle}`);
await page.goto(`${BASE_URL}/tasks/${createdTask.id}`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(1000);