test: cover project milestone and task modal editors
This commit is contained in:
@@ -6,7 +6,7 @@ const ADMIN_USERNAME = 'admin';
|
||||
const ADMIN_PASSWORD = 'admin123';
|
||||
|
||||
test.describe('Milestone Editor', () => {
|
||||
test('login -> create project -> create milestone through frontend form', async ({ page }) => {
|
||||
test('login -> create project -> create and edit milestone through modal', async ({ page }) => {
|
||||
// Step 1: Login (with retry — backend may still be warming up)
|
||||
console.log('🔐 Logging in...');
|
||||
|
||||
@@ -66,14 +66,14 @@ test.describe('Milestone Editor', () => {
|
||||
|
||||
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.waitForSelector('.modal', { timeout: 10000 });
|
||||
|
||||
const projectName = 'Milestone Test Project ' + Date.now();
|
||||
console.log('Creating project with name:', projectName);
|
||||
await page.fill('input[placeholder="Project name"]', projectName);
|
||||
await page.fill('input[placeholder="Description (optional)"]', 'Project for milestone testing');
|
||||
await page.getByTestId('project-name-input').fill(projectName);
|
||||
await page.getByTestId('project-description-input').fill('Project for milestone testing');
|
||||
|
||||
await page.click('button:has-text("Create")');
|
||||
await page.click('.modal button.btn-primary:has-text("Create")');
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
// Wait for our specific project card to appear
|
||||
@@ -122,20 +122,27 @@ test.describe('Milestone Editor', () => {
|
||||
|
||||
// Step 5: Verify milestone was created
|
||||
console.log('🔍 Verifying milestone...');
|
||||
|
||||
// Get the heading text
|
||||
const headingText = await page.locator('h3').filter({ hasText: /Milestones/i }).textContent();
|
||||
console.log('Heading text:', headingText);
|
||||
|
||||
// Check if milestone count > 0
|
||||
const hasMilestone = headingText && /\(1?\d+\)/.test(headingText) && !headingText.includes('(0)');
|
||||
console.log('Has milestone:', hasMilestone);
|
||||
|
||||
// Verify milestone exists in UI
|
||||
expect(hasMilestone).toBe(true);
|
||||
console.log('✅ Milestone verified in UI');
|
||||
|
||||
// Note: intentionally NOT deleting the project/milestone — leave for inspection
|
||||
// Step 6: Open milestone and edit it via modal
|
||||
console.log('✏️ Editing milestone...');
|
||||
await page.click(`.milestone-item:has-text("${milestoneName}")`);
|
||||
await page.waitForLoadState('networkidle');
|
||||
await page.click('button:has-text("Edit Milestone")');
|
||||
await page.waitForSelector('.modal', { timeout: 10000 });
|
||||
|
||||
const updatedMilestoneName = `${milestoneName} Updated`;
|
||||
await page.getByTestId('milestone-title-input').fill(updatedMilestoneName);
|
||||
await page.click('.modal button.btn-primary:has-text("Save")');
|
||||
await page.waitForSelector('.modal', { state: 'detached', timeout: 10000 });
|
||||
await expect(page.locator(`h2:has-text("${updatedMilestoneName}")`)).toBeVisible({ timeout: 10000 });
|
||||
console.log('✅ Milestone edited');
|
||||
|
||||
console.log('🎉 All milestone tests passed!');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user