From 1ac401908fad6bdf9d469a9d797e78b06be00134 Mon Sep 17 00:00:00 2001 From: Zhi Date: Sat, 14 Mar 2026 08:53:32 +0000 Subject: [PATCH] Fix full workflow test: select project filter for milestone --- tests/full-workflow.spec.ts | 58 ++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/tests/full-workflow.spec.ts b/tests/full-workflow.spec.ts index f7c112a..0f649ba 100644 --- a/tests/full-workflow.spec.ts +++ b/tests/full-workflow.spec.ts @@ -10,73 +10,71 @@ test.describe('Full Workflow', () => { test('login -> create project -> create milestone -> create task/meeting/support -> logout', async ({ page }) => { // Step 1: Login console.log('🔐 Logging in...'); - await page.goto(`${BASE_URL}/login`); + await page.goto(); await page.waitForLoadState('networkidle'); - console.log('Page at login:', await page.url()); - console.log('Login page content:', await page.content()); - await page.fill('input[type="text"], input[name="username"]', ADMIN_USERNAME); await page.fill('input[type="password"], input[name="password"]', ADMIN_PASSWORD); - await page.click('button[type="submit"], button:has-text("Login")'); - - // Wait for redirect after login - await page.waitForTimeout(3000); - console.log('Page after login:', await page.url()); - console.log('Page content after login:', await page.content().then(c => c.substring(0, 2000))); + await page.click('button[type="submit"], button:has-text("Sign in")'); // Wait for navigation + await page.waitForURL(, { timeout: 10000 }); await page.waitForLoadState('networkidle'); console.log('✅ Logged in'); // Step 2: Create Project console.log('📁 Creating project...'); - await page.goto(`${BASE_URL}/projects`); + await page.goto(); await page.waitForLoadState('networkidle'); - - console.log('Projects page:', await page.url()); - console.log('Projects page content:', await page.content().then(c => c.substring(0, 2000))); - + // Click create project button - it's "+ New" await page.click('button:has-text("+ New")'); - await page.waitForSelector('form.inline-form', { timeout: 5000 }).catch(() => {}); + await page.waitForSelector('form.inline-form', { timeout: 5000 }); // Fill project form - await page.fill('input[placeholder="Project name"]', 'Test Project'); + const projectName = ; + await page.fill('input[placeholder="Project name"]', projectName); + await page.fill('textarea[placeholder="Description"]', 'Project for E2E testing'); // Submit project form await page.click('button:has-text("Create")'); - // Wait for project to be created - await page.waitForTimeout(2000); + // Wait for project to be created (and appear in the grid) + await page.waitForSelector(, { timeout: 10000 }); console.log('✅ Project created'); // Step 3: Create Milestone console.log('🎯 Creating milestone...'); - await page.goto(`${BASE_URL}/milestones`); + await page.goto(); await page.waitForLoadState('networkidle'); // Wait for page to load await page.waitForSelector('h2:has-text("Milestones")', { timeout: 10000 }); + // Select the newly created project in the filter + await page.selectOption('select[aria-label="Project filter"]', { label: projectName }); + await page.waitForLoadState('networkidle'); + await page.waitForTimeout(1000); // Give it a moment to update + // Click create milestone button - it's "+ NewMilestones" await page.click('button:has-text("+ NewMilestones")'); - await page.waitForSelector('form', { timeout: 5000 }).catch(() => {}); + await page.waitForSelector('form', { timeout: 5000 }); // Fill milestone form - await page.fill('input[placeholder="Title"]', 'Test Milestone'); + const milestoneTitle = ; + await page.fill('input[placeholder="Title"]', milestoneTitle); await page.fill('textarea[placeholder="Description"]', 'Milestone for E2E testing'); // Submit milestone form await page.click('button:has-text("Create")'); // Wait for milestone to be created - await page.waitForTimeout(2000); + await page.waitForSelector(, { timeout: 10000 }); console.log('✅ Milestone created'); - // Step 4: Create Task (issue type) + // Step 4: Create Task (under milestone) console.log('📝 Creating task...'); - await page.goto(`${BASE_URL}/issues/new`); + await page.goto(); await page.waitForLoadState('networkidle'); // Wait for form to load @@ -91,9 +89,9 @@ test.describe('Full Workflow', () => { await page.waitForTimeout(2000); console.log('✅ Task created'); - // Step 5: Create Meeting (issue type) + // Step 5: Create Meeting (under milestone) console.log('📅 Creating meeting...'); - await page.goto(`${BASE_URL}/issues/new`); + await page.goto(); await page.waitForLoadState('networkidle'); await page.waitForSelector('select[name="issue_type"]', { timeout: 10000 }); @@ -108,9 +106,9 @@ test.describe('Full Workflow', () => { await page.waitForTimeout(2000); console.log('✅ Meeting created'); - // Step 6: Create Support (issue type) + // Step 6: Create Support (under milestone) console.log('🆘 Creating support...'); - await page.goto(`${BASE_URL}/issues/new`); + await page.goto(); await page.waitForLoadState('networkidle'); await page.waitForSelector('select[name="issue_type"]', { timeout: 10000 }); @@ -130,7 +128,7 @@ test.describe('Full Workflow', () => { // Click logout button in sidebar await page.click('button:has-text("Logout")'); - await page.waitForURL(`${BASE_URL}/login`, { timeout: 10000 }).catch(() => {}); + await page.waitForURL(, { timeout: 10000 }); console.log('✅ Logged out'); // Verify we're on login page