import { test, expect } from '@playwright/test'; const FRONTEND_URL = process.env.FRONTEND_URL || 'http://frontend:3000'; test.describe('Setup Wizard', () => { test('complete wizard flow through frontend', async ({ page }) => { // Navigate to frontend - should redirect to wizard since not configured await page.goto(FRONTEND_URL); await page.waitForLoadState('networkidle'); // Step 0: Welcome - should see wizard page 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")'); if (await connectButton.isVisible().catch(() => false)) { // We're on wizard page, proceed with wizard flow await connectButton.click(); // Wait for step 1: Database await page.waitForSelector('h2:has-text("Database configuration")', { timeout: 10000 }); await page.fill('input[name="host"]', 'mysql'); await page.fill('input[name="port"]', '3306'); await page.fill('input[name="user"]', 'harborforge'); await page.fill('input[name="password"]', 'harborforge_pass'); await page.fill('input[name="database"]', 'harborforge'); await page.click('button:has-text("Next")'); // Wait for step 2: Admin 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'); await page.fill('input[name="full_name"]', 'Test Admin'); await page.click('button:has-text("Next")'); // Wait for step 3: Backend URL (no project step) await page.waitForSelector('h2:has-text("Backend URL")', { timeout: 10000 }); await page.fill('input[name="backend_base_url"]', 'http://backend:8000'); await page.click('button:has-text("Finish setup")'); // Wait for step 4: Complete await expect(page.locator('h2')).toContainText('Setup complete!', { timeout: 10000 }); } else { // Wizard was already configured, verify we're on main page await expect(page.locator('h1')).toContainText('HarborForge'); } }); });