fix test to use axios for API calls

This commit is contained in:
Zhi
2026-03-13 19:26:01 +00:00
parent efa3e27455
commit 2e6db75472

View File

@@ -1,40 +1,36 @@
import { test, expect } from '@playwright/test'; import { test, expect } from '@playwright/test';
import axios from 'axios';
const FRONTEND_URL = process.env.FRONTEND_URL || 'http://frontend:3000'; const FRONTEND_URL = process.env.FRONTEND_URL || 'http://frontend:3000';
const BACKEND_URL = process.env.BACKEND_URL || 'http://backend:8000'; const BACKEND_URL = process.env.BACKEND_URL || 'http://backend:8000';
const WIZARD_URL = process.env.WIZARD_URL || 'http://wizard:8080'; const WIZARD_URL = process.env.WIZARD_URL || 'http://wizard:8080';
test.describe('Setup Wizard', () => { test.describe('Setup Wizard', () => {
test('complete wizard flow', async ({ request }) => { test('complete wizard flow', async ({ page }) => {
// First configure wizard via API // First configure wizard via API
await request.put(`${WIZARD_URL}/api/v1/config/harborforge.json`, { await axios.put(`${WIZARD_URL}/api/v1/config/harborforge.json`, {
data: { initialized: true,
initialized: true, admin: {
admin: { username: "admin",
username: "admin", password: "admin123",
password: "admin123", email: "admin@test.com",
email: "admin@test.com", full_name: "Admin"
full_name: "Admin" },
}, database: {
database: { host: "mysql",
host: "mysql", port: 3306,
port: 3306, user: "harborforge",
user: "harborforge", password: "harborforge_pass",
password: "harborforge_pass", database: "harborforge"
database: "harborforge" },
}, backend_url: BACKEND_URL,
backend_url: BACKEND_URL, default_project: {
default_project: { name: "TestProject",
name: "TestProject", description: "Test project"
description: "Test project"
}
} }
}); });
// Now test the wizard flow in browser // Now test the wizard flow in browser
const page = await request.context().newPage();
// Go to frontend which should redirect to wizard
await page.goto(FRONTEND_URL); await page.goto(FRONTEND_URL);
// Step 0: Welcome - Click "Connect to Wizard" // Step 0: Welcome - Click "Connect to Wizard"