From db9fadd13d1b1fee03d2c5a46967235d439d0ef0 Mon Sep 17 00:00:00 2001 From: Zhi Date: Sat, 14 Mar 2026 07:48:01 +0000 Subject: [PATCH] Add debug output --- tests/wizard.spec.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/wizard.spec.ts b/tests/wizard.spec.ts index 78ac3aa..5079d02 100644 --- a/tests/wizard.spec.ts +++ b/tests/wizard.spec.ts @@ -4,27 +4,19 @@ 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 + // Navigate to frontend await page.goto(FRONTEND_URL); await page.waitForLoadState('networkidle'); - // Step 0: Welcome - should see wizard page + // Step 0: Welcome 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 }); - - // Fill database form - inputs are inside labels - const dbInputs = page.locator('.setup-form label').first().locator('input'); - const labels = page.locator('.setup-form label'); - - // Fill by label text 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'); @@ -34,20 +26,28 @@ test.describe('Setup Wizard', () => { // Wait for step 2: Admin await page.waitForSelector('h2:has-text("Admin account")', { timeout: 10000 }); + + // Debug: print page content before filling + 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")'); // 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.locator('label:has-text("Backend Base URL") input').fill('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 + // Wizard was already configured await expect(page.locator('h1')).toContainText('HarborForge'); } });