Compare commits

...

3 Commits

Author SHA1 Message Date
Zhi
db9fadd13d Add debug output 2026-03-14 07:48:01 +00:00
Zhi
f97f31acaa Fix test selectors to use label text 2026-03-14 07:46:38 +00:00
Zhi
afe4038778 Remove webServer config - services started via docker-compose 2026-03-14 07:41:45 +00:00
2 changed files with 23 additions and 22 deletions

View File

@@ -1,7 +1,6 @@
import { defineConfig, devices } from '@playwright/test'; import { defineConfig, devices } from '@playwright/test';
const baseURL = process.env.FRONTEND_URL || 'http://frontend:3000'; const baseURL = process.env.FRONTEND_URL || 'http://frontend:3000';
const backendURL = process.env.BACKEND_URL || 'http://backend:8000';
export default defineConfig({ export default defineConfig({
testDir: './tests', testDir: './tests',
@@ -20,9 +19,5 @@ export default defineConfig({
use: { ...devices['Desktop Chrome'] }, use: { ...devices['Desktop Chrome'] },
}, },
], ],
webServer: { // Don't start webServer - services are started via docker-compose
command: 'npm run dev',
url: baseURL,
reuseExistingServer: !process.env.CI,
},
}); });

View File

@@ -4,44 +4,50 @@ const FRONTEND_URL = process.env.FRONTEND_URL || 'http://frontend:3000';
test.describe('Setup Wizard', () => { test.describe('Setup Wizard', () => {
test('complete wizard flow through frontend', async ({ page }) => { test('complete wizard flow through frontend', async ({ page }) => {
// Navigate to frontend - should redirect to wizard since not configured // Navigate to frontend
await page.goto(FRONTEND_URL); await page.goto(FRONTEND_URL);
await page.waitForLoadState('networkidle'); await page.waitForLoadState('networkidle');
// Step 0: Welcome - should see wizard page // Step 0: Welcome
await expect(page.locator('h1')).toContainText('HarborForge', { timeout: 10000 }); await expect(page.locator('h1')).toContainText('HarborForge', { timeout: 10000 });
// Check if we're on wizard page (look for Connect to Wizard button)
const connectButton = page.locator('button:has-text("Connect to Wizard")'); const connectButton = page.locator('button:has-text("Connect to Wizard")');
if (await connectButton.isVisible().catch(() => false)) { if (await connectButton.isVisible().catch(() => false)) {
// We're on wizard page, proceed with wizard flow
await connectButton.click(); await connectButton.click();
// Wait for step 1: Database // Wait for step 1: Database
await page.waitForSelector('h2:has-text("Database configuration")', { timeout: 10000 }); await page.waitForSelector('h2:has-text("Database configuration")', { timeout: 10000 });
await page.fill('input[name="host"]', 'mysql'); await page.locator('label:has-text("Host") input').fill('mysql');
await page.fill('input[name="port"]', '3306'); await page.locator('label:has-text("Port") input').fill('3306');
await page.fill('input[name="user"]', 'harborforge'); await page.locator('label:has-text("Username") input').fill('harborforge');
await page.fill('input[name="password"]', 'harborforge_pass'); await page.locator('label:has-text("Password") input').fill('harborforge_pass');
await page.fill('input[name="database"]', 'harborforge'); await page.locator('label:has-text("Database") input').fill('harborforge');
await page.click('button:has-text("Next")'); await page.click('button:has-text("Next")');
// Wait for step 2: Admin // Wait for step 2: Admin
await page.waitForSelector('h2:has-text("Admin account")', { timeout: 10000 }); await page.waitForSelector('h2:has-text("Admin account")', { timeout: 10000 });
await page.fill('input[name="password"]', 'admin123');
await page.fill('input[name="email"]', 'admin@test.com'); // Debug: print page content before filling
await page.fill('input[name="full_name"]', 'Test Admin'); console.log('Page URL at Admin step:', page.url());
console.log('Page content:', await page.content());
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');
// Click Next - might fail if password is empty (validation)
await page.click('button:has-text("Next")'); await page.click('button:has-text("Next")');
// Wait for step 3: Backend URL (no project step) // Wait for step 3: Backend URL
await page.waitForSelector('h2:has-text("Backend URL")', { timeout: 10000 }); await page.waitForSelector('h2:has-text("Backend URL")', { timeout: 15000 });
await page.fill('input[name="backend_base_url"]', 'http://backend:8000');
await page.locator('label:has-text("Backend Base URL") input').fill('http://backend:8000');
await page.click('button:has-text("Finish setup")'); await page.click('button:has-text("Finish setup")');
// Wait for step 4: Complete // Wait for step 4: Complete
await expect(page.locator('h2')).toContainText('Setup complete!', { timeout: 10000 }); await expect(page.locator('h2')).toContainText('Setup complete!', { timeout: 10000 });
} else { } else {
// Wizard was already configured, verify we're on main page // Wizard was already configured
await expect(page.locator('h1')).toContainText('HarborForge'); await expect(page.locator('h1')).toContainText('HarborForge');
} }
}); });