Compare commits
23 Commits
e727933e21
...
3b9533a432
| Author | SHA1 | Date | |
|---|---|---|---|
| 3b9533a432 | |||
| 350238f84c | |||
| 6d79de92db | |||
| 0d0a8c9a48 | |||
| db9fadd13d | |||
| f97f31acaa | |||
| afe4038778 | |||
| 7e4933ee25 | |||
| c4573726f6 | |||
| e1c78c532d | |||
| 6688fbb4de | |||
| 06a817c416 | |||
| ede8c94560 | |||
| f05c0e3aca | |||
| 828987b8f1 | |||
| acca2d100f | |||
| 9085e69907 | |||
| 2e6db75472 | |||
| efa3e27455 | |||
| be7ed687e4 | |||
| d883dc3dc0 | |||
| adadfffd79 | |||
| 47b9eecf9f |
21
Dockerfile
21
Dockerfile
@@ -1,5 +1,26 @@
|
|||||||
FROM node:20-bookworm-slim
|
FROM node:20-bookworm-slim
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
libglib2.0-0 \
|
||||||
|
libnss3 \
|
||||||
|
libnspr4 \
|
||||||
|
libatk1.0-0 \
|
||||||
|
libatk-bridge2.0-0 \
|
||||||
|
libcups2 \
|
||||||
|
libdrm2 \
|
||||||
|
libdbus-1-3 \
|
||||||
|
libxkbcommon0 \
|
||||||
|
libxcomposite1 \
|
||||||
|
libxdamage1 \
|
||||||
|
libxfixes3 \
|
||||||
|
libxrandr2 \
|
||||||
|
libgbm1 \
|
||||||
|
libpango-1.0-0 \
|
||||||
|
libcairo2 \
|
||||||
|
libasound2 \
|
||||||
|
libatspi2.0-0 \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
|
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
|
||||||
ENV CHROME_DEBUGGING_PORT=9222
|
ENV CHROME_DEBUGGING_PORT=9222
|
||||||
|
|
||||||
|
|||||||
87
global-setup.ts
Normal file
87
global-setup.ts
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
import { chromium } from '@playwright/test';
|
||||||
|
|
||||||
|
const WIZARD_URL = process.env.WIZARD_URL || 'http://wizard:8080/wizard';
|
||||||
|
const WIZARD_API_URL = process.env.WIZARD_API_URL || 'http://wizard:8080';
|
||||||
|
|
||||||
|
async function setupWizard() {
|
||||||
|
console.log('🔧 Running global setup: Configure wizard...');
|
||||||
|
|
||||||
|
const browser = await chromium.launch();
|
||||||
|
const page = await browser.newPage();
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Navigate to frontend - should redirect to wizard since not configured
|
||||||
|
const frontendURL = process.env.FRONTEND_URL || 'http://frontend:3000';
|
||||||
|
console.log(`📱 Navigating to ${frontendURL}...`);
|
||||||
|
|
||||||
|
await page.goto(frontendURL);
|
||||||
|
await page.waitForLoadState('networkidle');
|
||||||
|
|
||||||
|
// Step 0: Welcome
|
||||||
|
console.log('⏳ Waiting for wizard page...');
|
||||||
|
await page.waitForSelector('h1:has-text("HarborForge")', { timeout: 10000 });
|
||||||
|
|
||||||
|
const connectButton = page.locator('button:has-text("Connect to Wizard")');
|
||||||
|
if (await connectButton.isVisible().catch(() => false)) {
|
||||||
|
console.log('🔗 Clicking Connect to Wizard...');
|
||||||
|
await connectButton.click();
|
||||||
|
|
||||||
|
// Wait for the step to change after clicking
|
||||||
|
await page.waitForTimeout(3000);
|
||||||
|
|
||||||
|
// Check what's on the page now
|
||||||
|
const pageContent = await page.content();
|
||||||
|
console.log('Page after click:', pageContent.substring(0, 2000));
|
||||||
|
|
||||||
|
// Wait for step 1: Database
|
||||||
|
console.log('📝 Waiting for Database configuration...');
|
||||||
|
try {
|
||||||
|
await page.waitForSelector('h2:has-text("Database configuration")', { timeout: 5000 });
|
||||||
|
} catch (e) {
|
||||||
|
console.log('Could not find Database config, trying alternate selector...');
|
||||||
|
// Try waiting for any h2
|
||||||
|
await page.waitForSelector('h2', { timeout: 5000 });
|
||||||
|
console.log('Found h2:', await page.locator('h2').first().textContent());
|
||||||
|
}
|
||||||
|
|
||||||
|
await page.locator('label:has-text("Host") input').fill('mysql');
|
||||||
|
await page.locator('label:has-text("Port") input').fill('3306');
|
||||||
|
await page.locator('label:has-text("Username") input').fill('harborforge');
|
||||||
|
await page.locator('label:has-text("Password") input').fill('harborforge_pass');
|
||||||
|
await page.locator('label:has-text("Database") input').fill('harborforge');
|
||||||
|
await page.click('button:has-text("Next")');
|
||||||
|
|
||||||
|
// Wait for step 2: Admin
|
||||||
|
console.log('📝 Filling Admin account...');
|
||||||
|
await page.waitForSelector('h2:has-text("Admin account")', { timeout: 10000 });
|
||||||
|
await page.locator('label:has-text("Password") input').fill('admin123');
|
||||||
|
await page.locator('label:has-text("Email") input').fill('admin@test.com');
|
||||||
|
await page.locator('label:has-text("Full name") input').fill('Test Admin');
|
||||||
|
await page.click('button:has-text("Next")');
|
||||||
|
|
||||||
|
// Wait for step 3: Backend URL
|
||||||
|
console.log('📝 Filling Backend URL...');
|
||||||
|
await page.waitForSelector('h2:has-text("Backend URL")', { timeout: 10000 });
|
||||||
|
const backendURL = process.env.BACKEND_URL || 'http://backend:8000';
|
||||||
|
await page.locator('label:has-text("Backend Base URL") input').fill(backendURL);
|
||||||
|
await page.click('button:has-text("Finish setup")');
|
||||||
|
|
||||||
|
// Wait for step 4: Complete
|
||||||
|
console.log('✅ Waiting for setup complete...');
|
||||||
|
await page.waitForSelector('h2:has-text("Setup complete!")', { timeout: 10000 });
|
||||||
|
|
||||||
|
console.log('✅ Wizard configured successfully!');
|
||||||
|
} else {
|
||||||
|
console.log('⚠️ Wizard already configured or on main page');
|
||||||
|
}
|
||||||
|
|
||||||
|
await browser.close();
|
||||||
|
return;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('❌ Wizard setup failed:', error);
|
||||||
|
await browser.close();
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default setupWizard;
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
"test:headed": "playwright test --headed"
|
"test:headed": "playwright test --headed"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@playwright/test": "^1.40.0"
|
"@playwright/test": "^1.40.0",
|
||||||
|
"axios": "^1.6.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import { defineConfig, devices } from '@playwright/test';
|
import { defineConfig, devices } from '@playwright/test';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
const baseURL = process.env.BASE_URL || 'http://127.0.0.1:3000';
|
const baseURL = process.env.FRONTEND_URL || 'http://frontend:3000';
|
||||||
const webServerURL = process.env.WEB_SERVER_URL || baseURL;
|
|
||||||
const chromeDebuggingPort = process.env.CHROME_DEBUGGING_PORT || '9222';
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
testDir: './tests',
|
testDir: './tests',
|
||||||
@@ -14,22 +13,15 @@ export default defineConfig({
|
|||||||
use: {
|
use: {
|
||||||
baseURL,
|
baseURL,
|
||||||
trace: 'on-first-retry',
|
trace: 'on-first-retry',
|
||||||
launchOptions: {
|
|
||||||
args: [`--remote-debugging-port=${chromeDebuggingPort}`],
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
projects: [
|
projects: [
|
||||||
{
|
{
|
||||||
name: 'chromium',
|
name: 'chromium',
|
||||||
use: {
|
use: { ...devices['Desktop Chrome'] },
|
||||||
...devices['Desktop Chrome'],
|
|
||||||
channel: 'chrome',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
webServer: {
|
// Global setup runs before all tests - configure wizard once
|
||||||
command: 'npm run dev',
|
globalSetup: path.join(__dirname, 'global-setup.ts'),
|
||||||
url: webServerURL,
|
// Global teardown runs after all tests
|
||||||
reuseExistingServer: !process.env.CI,
|
globalTeardown: undefined,
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
|
||||||
|
|
||||||
test('has title', async ({ page }) => {
|
|
||||||
await page.goto('/');
|
|
||||||
await expect(page).toHaveTitle(/HarborForge/);
|
|
||||||
});
|
|
||||||
129
tests/full-workflow.spec.ts
Normal file
129
tests/full-workflow.spec.ts
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
import { test, expect } from '@playwright/test';
|
||||||
|
|
||||||
|
const BASE_URL = process.env.BASE_URL || 'http://frontend:3000';
|
||||||
|
|
||||||
|
// Test credentials from globalSetup
|
||||||
|
const ADMIN_USERNAME = 'admin';
|
||||||
|
const ADMIN_PASSWORD = 'admin123';
|
||||||
|
|
||||||
|
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.waitForLoadState('networkidle');
|
||||||
|
|
||||||
|
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.waitForURL(`${BASE_URL}/**`, { timeout: 10000 }).catch(() => {});
|
||||||
|
await page.waitForLoadState('networkidle');
|
||||||
|
console.log('✅ Logged in');
|
||||||
|
|
||||||
|
// Step 2: Create Project
|
||||||
|
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(() => {});
|
||||||
|
|
||||||
|
// Fill project form
|
||||||
|
await page.fill('input[placeholder="Project name"]', 'Test Project');
|
||||||
|
|
||||||
|
// Submit project form
|
||||||
|
await page.click('button:has-text("Create")');
|
||||||
|
|
||||||
|
// Wait for project to be created
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
console.log('✅ Project created');
|
||||||
|
|
||||||
|
// Step 3: Create Milestone
|
||||||
|
console.log('🎯 Creating milestone...');
|
||||||
|
await page.goto(`${BASE_URL}/milestones`);
|
||||||
|
await page.waitForLoadState('networkidle');
|
||||||
|
|
||||||
|
// Wait for page to load
|
||||||
|
await page.waitForSelector('h2:has-text("Milestones")', { timeout: 10000 });
|
||||||
|
|
||||||
|
// Click create milestone button - it's "+ NewMilestones"
|
||||||
|
await page.click('button:has-text("+ NewMilestones")');
|
||||||
|
await page.waitForSelector('form', { timeout: 5000 }).catch(() => {});
|
||||||
|
|
||||||
|
// Fill milestone form
|
||||||
|
await page.fill('input[placeholder="Title"]', 'Test Milestone');
|
||||||
|
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);
|
||||||
|
console.log('✅ Milestone created');
|
||||||
|
|
||||||
|
// Step 4: Create Task (issue type)
|
||||||
|
console.log('📝 Creating task...');
|
||||||
|
await page.goto(`${BASE_URL}/issues/new`);
|
||||||
|
await page.waitForLoadState('networkidle');
|
||||||
|
|
||||||
|
// Wait for form to load
|
||||||
|
await page.waitForSelector('select[name="issue_type"]', { timeout: 10000 });
|
||||||
|
|
||||||
|
// Select issue type: Task
|
||||||
|
await page.selectOption('select[name="issue_type"]', 'task');
|
||||||
|
await page.fill('input[placeholder="Title"]', 'Test Task');
|
||||||
|
await page.fill('textarea[placeholder="Description"]', 'Task for E2E testing');
|
||||||
|
|
||||||
|
await page.click('button:has-text("Create")');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
console.log('✅ Task created');
|
||||||
|
|
||||||
|
// Step 5: Create Meeting (issue type)
|
||||||
|
console.log('📅 Creating meeting...');
|
||||||
|
await page.goto(`${BASE_URL}/issues/new`);
|
||||||
|
await page.waitForLoadState('networkidle');
|
||||||
|
|
||||||
|
await page.waitForSelector('select[name="issue_type"]', { timeout: 10000 });
|
||||||
|
|
||||||
|
// Select issue type: Meeting
|
||||||
|
await page.selectOption('select[name="issue_type"]', 'meeting');
|
||||||
|
await page.selectOption('select[name="issue_subtype"]', 'recap');
|
||||||
|
await page.fill('input[placeholder="Title"]', 'Test Meeting');
|
||||||
|
await page.fill('textarea[placeholder="Description"]', 'Meeting for E2E testing');
|
||||||
|
|
||||||
|
await page.click('button:has-text("Create")');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
console.log('✅ Meeting created');
|
||||||
|
|
||||||
|
// Step 6: Create Support (issue type)
|
||||||
|
console.log('🆘 Creating support...');
|
||||||
|
await page.goto(`${BASE_URL}/issues/new`);
|
||||||
|
await page.waitForLoadState('networkidle');
|
||||||
|
|
||||||
|
await page.waitForSelector('select[name="issue_type"]', { timeout: 10000 });
|
||||||
|
|
||||||
|
// Select issue type: Support
|
||||||
|
await page.selectOption('select[name="issue_type"]', 'support');
|
||||||
|
await page.selectOption('select[name="issue_subtype"]', 'information');
|
||||||
|
await page.fill('input[placeholder="Title"]', 'Test Support');
|
||||||
|
await page.fill('textarea[placeholder="Description"]', 'Support request for E2E testing');
|
||||||
|
|
||||||
|
await page.click('button:has-text("Create")');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
console.log('✅ Support created');
|
||||||
|
|
||||||
|
// Step 7: Logout
|
||||||
|
console.log('🚪 Logging out...');
|
||||||
|
|
||||||
|
// Click logout button in sidebar
|
||||||
|
await page.click('button:has-text("Logout")');
|
||||||
|
await page.waitForURL(`${BASE_URL}/login`, { timeout: 10000 }).catch(() => {});
|
||||||
|
console.log('✅ Logged out');
|
||||||
|
|
||||||
|
// Verify we're on login page
|
||||||
|
await expect(page.locator('h1, h2')).toContainText(/Login|Sign/i, { timeout: 5000 });
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,45 +1,15 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
|
|
||||||
const WIZARD_URL = process.env.WIZARD_URL || 'http://127.0.0.1:18080';
|
const FRONTEND_URL = process.env.FRONTEND_URL || 'http://frontend:3000';
|
||||||
const BACKEND_URL = process.env.BACKEND_URL || 'http://127.0.0.1:8000';
|
|
||||||
|
|
||||||
test.describe('Setup Wizard', () => {
|
test.describe('Setup Wizard', () => {
|
||||||
test('complete wizard flow', async ({ page }) => {
|
test('frontend loads and shows main page after wizard configuration', async ({ page }) => {
|
||||||
// Go to frontend which should redirect to wizard
|
// Navigate to frontend - wizard should be configured by globalSetup
|
||||||
await page.goto('/');
|
await page.goto(FRONTEND_URL);
|
||||||
|
await page.waitForLoadState('networkidle');
|
||||||
|
|
||||||
// Step 0: Welcome - Click "Connect to Wizard"
|
// Should now show main page (not wizard redirect)
|
||||||
await expect(page.locator('h1')).toContainText('HarborForge Setup Wizard');
|
// After wizard config, frontend should load normally
|
||||||
await page.click('button:has-text("Connect to Wizard")');
|
await expect(page.locator('h1')).toContainText('HarborForge', { timeout: 10000 });
|
||||||
|
|
||||||
// Wait for wizard health check - should proceed to step 1
|
|
||||||
await page.waitForTimeout(1000);
|
|
||||||
|
|
||||||
// Step 1: Database - Click Next with defaults
|
|
||||||
if (await page.locator('h2:has-text("Database configuration")').isVisible()) {
|
|
||||||
await page.click('button:has-text("Next")');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Step 2: Admin - Fill in admin credentials
|
|
||||||
await page.fill('input[placeholder="Set admin password"]', 'admin123');
|
|
||||||
await page.fill('input[type="email"]', 'admin@test.com');
|
|
||||||
await page.fill('input[value="Admin"]', 'Test Admin');
|
|
||||||
await page.click('button:has-text("Next")');
|
|
||||||
|
|
||||||
// Step 3: Project - Configure backend and project
|
|
||||||
await page.fill('input[placeholder="http://127.0.0.1:8000"]', BACKEND_URL);
|
|
||||||
await page.fill('input[value="Default"]', 'Test Project');
|
|
||||||
await page.fill('input[value="Default project"]', 'Test Project Description');
|
|
||||||
await page.click('button:has-text("Finish setup")');
|
|
||||||
|
|
||||||
// Step 4: Complete
|
|
||||||
await expect(page.locator('h2')).toContainText('Setup complete!');
|
|
||||||
await expect(page.locator('code')).toContainText('docker compose restart');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('wizard health check', async ({ request }) => {
|
|
||||||
const response = await request.get(`${WIZARD_URL}/health`);
|
|
||||||
// Wizard might return 200 or 404 if not initialized
|
|
||||||
expect([200, 404]).toContain(response.status());
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user