Compare commits
5 Commits
a23e425e35
...
e727933e21
| Author | SHA1 | Date | |
|---|---|---|---|
| e727933e21 | |||
| c340239003 | |||
| d389a9eafc | |||
| 9b6377c787 | |||
| a15de04895 |
@@ -1,9 +1,10 @@
|
||||
FROM node:20-bookworm-slim
|
||||
|
||||
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
|
||||
ENV CHROME_DEBUGGING_PORT=9222
|
||||
|
||||
WORKDIR /app
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
RUN npm install && npm install -g playwright && playwright install chromium
|
||||
COPY . .
|
||||
CMD ["npx", "playwright", "test"]
|
||||
|
||||
@@ -2,6 +2,7 @@ import { defineConfig, devices } from '@playwright/test';
|
||||
|
||||
const baseURL = process.env.BASE_URL || 'http://127.0.0.1:3000';
|
||||
const webServerURL = process.env.WEB_SERVER_URL || baseURL;
|
||||
const chromeDebuggingPort = process.env.CHROME_DEBUGGING_PORT || '9222';
|
||||
|
||||
export default defineConfig({
|
||||
testDir: './tests',
|
||||
@@ -13,11 +14,17 @@ export default defineConfig({
|
||||
use: {
|
||||
baseURL,
|
||||
trace: 'on-first-retry',
|
||||
launchOptions: {
|
||||
args: [`--remote-debugging-port=${chromeDebuggingPort}`],
|
||||
},
|
||||
},
|
||||
projects: [
|
||||
{
|
||||
name: 'chromium',
|
||||
use: { ...devices['Desktop Chrome'] },
|
||||
use: {
|
||||
...devices['Desktop Chrome'],
|
||||
channel: 'chrome',
|
||||
},
|
||||
},
|
||||
],
|
||||
webServer: {
|
||||
|
||||
45
tests/wizard.spec.ts
Normal file
45
tests/wizard.spec.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
const WIZARD_URL = process.env.WIZARD_URL || 'http://127.0.0.1:18080';
|
||||
const BACKEND_URL = process.env.BACKEND_URL || 'http://127.0.0.1:8000';
|
||||
|
||||
test.describe('Setup Wizard', () => {
|
||||
test('complete wizard flow', async ({ page }) => {
|
||||
// Go to frontend which should redirect to wizard
|
||||
await page.goto('/');
|
||||
|
||||
// Step 0: Welcome - Click "Connect to Wizard"
|
||||
await expect(page.locator('h1')).toContainText('HarborForge Setup Wizard');
|
||||
await page.click('button:has-text("Connect to Wizard")');
|
||||
|
||||
// Wait for wizard health check - should proceed to step 1
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Step 1: Database - Click Next with defaults
|
||||
if (await page.locator('h2:has-text("Database configuration")').isVisible()) {
|
||||
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[type="email"]', 'admin@test.com');
|
||||
await page.fill('input[value="Admin"]', 'Test Admin');
|
||||
await page.click('button:has-text("Next")');
|
||||
|
||||
// Step 3: Project - Configure backend and project
|
||||
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 project"]', 'Test Project Description');
|
||||
await page.click('button:has-text("Finish setup")');
|
||||
|
||||
// Step 4: Complete
|
||||
await expect(page.locator('h2')).toContainText('Setup complete!');
|
||||
await expect(page.locator('code')).toContainText('docker compose restart');
|
||||
});
|
||||
|
||||
test('wizard health check', async ({ request }) => {
|
||||
const response = await request.get(`${WIZARD_URL}/health`);
|
||||
// Wizard might return 200 or 404 if not initialized
|
||||
expect([200, 404]).toContain(response.status());
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user