improve test with explicit waits
This commit is contained in:
@@ -7,7 +7,7 @@ const WIZARD_URL = process.env.WIZARD_URL || 'http://wizard:8080';
|
|||||||
|
|
||||||
test.describe('Setup Wizard', () => {
|
test.describe('Setup Wizard', () => {
|
||||||
test('complete wizard flow', async ({ page }) => {
|
test('complete wizard flow', async ({ page }) => {
|
||||||
// First configure wizard via API
|
// Configure wizard via API first
|
||||||
await axios.put(`${WIZARD_URL}/api/v1/config/harborforge.json`, {
|
await axios.put(`${WIZARD_URL}/api/v1/config/harborforge.json`, {
|
||||||
initialized: true,
|
initialized: true,
|
||||||
admin: {
|
admin: {
|
||||||
@@ -30,35 +30,35 @@ test.describe('Setup Wizard', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Now test the wizard flow in browser
|
// Now test wizard in browser
|
||||||
await page.goto(FRONTEND_URL);
|
await page.goto(FRONTEND_URL);
|
||||||
|
|
||||||
|
// Wait for page to load
|
||||||
|
await page.waitForLoadState('networkidle');
|
||||||
|
|
||||||
// Step 0: Welcome - Click "Connect to Wizard"
|
// Step 0: Welcome - Click "Connect to Wizard"
|
||||||
await expect(page.locator('h1')).toContainText('HarborForge Setup Wizard');
|
await expect(page.locator('h1')).toContainText('HarborForge Setup Wizard', { timeout: 10000 });
|
||||||
await page.click('button:has-text("Connect to Wizard")');
|
await page.click('button:has-text("Connect to Wizard")');
|
||||||
|
|
||||||
// Wait for wizard health check - should proceed to step 1
|
// Wait for step 1: Database
|
||||||
await page.waitForTimeout(1000);
|
await page.waitForSelector('h2:has-text("Database configuration")', { timeout: 10000 });
|
||||||
|
await page.click('button:has-text("Next")');
|
||||||
|
|
||||||
// Step 1: Database - Click Next with defaults
|
// Wait for step 2: Admin
|
||||||
if (await page.locator('h2:has-text("Database configuration")').isVisible()) {
|
await page.waitForSelector('input[placeholder="Set admin password"]', { timeout: 10000 });
|
||||||
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[placeholder="Set admin password"]', 'admin123');
|
||||||
await page.fill('input[type="email"]', 'admin@test.com');
|
await page.fill('input[type="email"]', 'admin@test.com');
|
||||||
await page.fill('input[value="Admin"]', 'Test Admin');
|
await page.fill('input[value="Admin"]', 'Test Admin');
|
||||||
await page.click('button:has-text("Next")');
|
await page.click('button:has-text("Next")');
|
||||||
|
|
||||||
// Step 3: Project - Configure backend and project
|
// Wait for step 3: Project
|
||||||
|
await page.waitForSelector('h2:has-text("Default project")', { timeout: 10000 });
|
||||||
await page.fill('input[placeholder="http://127.0.0.1:8000"]', BACKEND_URL);
|
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"]', 'Test Project');
|
||||||
await page.fill('input[value="Default project"]', 'Test Project Description');
|
await page.fill('input[value="Default project"]', 'Test Project Description');
|
||||||
await page.click('button:has-text("Finish setup")');
|
await page.click('button:has-text("Finish setup")');
|
||||||
|
|
||||||
// Step 4: Complete
|
// Wait for step 4: Complete
|
||||||
await expect(page.locator('h2')).toContainText('Setup complete!');
|
await expect(page.locator('h2')).toContainText('Setup complete!', { timeout: 10000 });
|
||||||
await expect(page.locator('code')).toContainText('docker compose restart');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user