Compare commits

...

3 Commits

View File

@@ -1,6 +1,6 @@
import { test, expect } from '@playwright/test';
const BASE_URL = process.env.BASE_URL || 'http://frontend:3000';
const BASE_URL = process.env.BASE_URL || process.env.FRONTEND_URL || 'http://frontend:3000';
// Test credentials from globalSetup
const ADMIN_USERNAME = 'admin';
@@ -15,10 +15,10 @@ test.describe('Full Workflow', () => {
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")');
await page.click('button[type="submit"], button:has-text("Sign in")');
// Wait for redirect after login
await page.waitForURL(`${BASE_URL}/**`, { timeout: 10000 }).catch(() => {});
// Wait for navigation
await page.waitForURL(`${BASE_URL}/**`, { timeout: 10000 });
await page.waitForLoadState('networkidle');
console.log('✅ Logged in');
@@ -26,19 +26,21 @@ test.describe('Full Workflow', () => {
console.log('📁 Creating project...');
await page.goto(`${BASE_URL}/projects`);
await page.waitForLoadState('networkidle');
// 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 = 'Test Project ' + Date.now();
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(`.project-card h3:has-text("${projectName}")`, { timeout: 10000 });
console.log('✅ Project created');
// Step 3: Create Milestone
@@ -49,22 +51,28 @@ test.describe('Full Workflow', () => {
// 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 = 'Test Milestone ' + Date.now();
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(`.milestone-card h3:has-text("${milestoneTitle}")`, { 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.waitForLoadState('networkidle');
@@ -81,7 +89,7 @@ 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.waitForLoadState('networkidle');
@@ -98,7 +106,7 @@ 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.waitForLoadState('networkidle');
@@ -120,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(`${BASE_URL}/login`, { timeout: 10000 });
console.log('✅ Logged out');
// Verify we're on login page