Compare commits

..

21 Commits

Author SHA1 Message Date
Zhi
7e4933ee25 Update test for backend URL step 2026-03-14 07:33:49 +00:00
Zhi
c4573726f6 Test wizard flow without pre-configuring via API 2026-03-13 19:48:25 +00:00
Zhi
e1c78c532d Add debugging to test 2026-03-13 19:42:02 +00:00
Zhi
6688fbb4de Navigate to frontend instead of wizard 2026-03-13 19:39:55 +00:00
Zhi
06a817c416 Debug WIZARD_URL and use separate API URL 2026-03-13 19:38:39 +00:00
Zhi
ede8c94560 Adjust WIZARD_URL and navigate directly in test 2026-03-13 19:36:51 +00:00
Zhi
f05c0e3aca simplify test to just test wizard UI flow 2026-03-13 19:31:07 +00:00
Zhi
828987b8f1 improve test with explicit waits 2026-03-13 19:30:05 +00:00
Zhi
acca2d100f add axios dependency 2026-03-13 19:27:48 +00:00
Zhi
9085e69907 use axios for wizard API config 2026-03-13 19:27:16 +00:00
Zhi
2e6db75472 fix test to use axios for API calls 2026-03-13 19:26:01 +00:00
Zhi
efa3e27455 configure wizard via API before testing 2026-03-13 19:15:10 +00:00
Zhi
be7ed687e4 install chromium deps in dockerfile 2026-03-13 18:59:23 +00:00
Zhi
d883dc3dc0 use correct playwright image tag 2026-03-13 18:58:58 +00:00
Zhi
adadfffd79 use playwright image with deps, remove wizard health check 2026-03-13 18:58:34 +00:00
Zhi
47b9eecf9f fix playwright config: use chromium, remove remote debugging 2026-03-13 18:57:44 +00:00
Zhi
e727933e21 add wizard flow test case 2026-03-13 11:37:01 +00:00
Zhi
c340239003 configure playwright to use remote chrome debugging 2026-03-13 11:01:32 +00:00
Zhi
d389a9eafc skip browser download during playwright install 2026-03-13 10:59:15 +00:00
Zhi
9b6377c787 install playwright and chromium in image 2026-03-13 10:56:54 +00:00
Zhi
a15de04895 use mcr.microsoft.com/playwright image 2026-03-13 10:51:58 +00:00
5 changed files with 76 additions and 11 deletions

View File

@@ -1,9 +1,31 @@
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
WORKDIR /app WORKDIR /app
COPY package*.json ./ COPY package*.json ./
RUN npm install RUN npm install && npm install -g playwright && playwright install chromium
COPY . . COPY . .
CMD ["npx", "playwright", "test"] CMD ["npx", "playwright", "test"]

View File

@@ -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"
} }
} }

View File

@@ -1,7 +1,7 @@
import { defineConfig, devices } from '@playwright/test'; import { defineConfig, devices } from '@playwright/test';
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 backendURL = process.env.BACKEND_URL || 'http://backend:8000';
export default defineConfig({ export default defineConfig({
testDir: './tests', testDir: './tests',
@@ -22,7 +22,7 @@ export default defineConfig({
], ],
webServer: { webServer: {
command: 'npm run dev', command: 'npm run dev',
url: webServerURL, url: baseURL,
reuseExistingServer: !process.env.CI, reuseExistingServer: !process.env.CI,
}, },
}); });

View File

@@ -1,6 +0,0 @@
import { test, expect } from '@playwright/test';
test('has title', async ({ page }) => {
await page.goto('/');
await expect(page).toHaveTitle(/HarborForge/);
});

48
tests/wizard.spec.ts Normal file
View File

@@ -0,0 +1,48 @@
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');
}
});
});