nexus/tests/e2e/onboarding.spec.ts
Mikkel Georgsen 02282ae926 test(05-01): rewrite onboarding E2E for Nexus single-step wizard
- Replace 4-step upstream flow test with single-step Nexus wizard test
- Assert h1 'Welcome to Nexus' is visible (ONBD-10/ONBD-11)
- Assert no 'Next' button, no 4-step h3 headings (ONBD-11)
- Assert 'Acme Corp', 'Company name', corporate strings absent (ONBD-12)
- Fill root dir input, click 'Get Started', expect /dashboard/ URL
- Verify 'Project Manager' and 'Engineer' agents created via API
2026-03-31 12:58:36 +02:00

65 lines
2.7 KiB
TypeScript

import { test, expect } from "@playwright/test";
/**
* E2E: Nexus onboarding wizard — single-step root directory flow.
*
* Verifies:
* ONBD-10 — Vite alias intercepts, NexusOnboardingWizard renders
* ONBD-11 — Single root-directory input only, no multi-step flow
* ONBD-12 — No corporate placeholder text visible
*/
test.describe("Nexus onboarding wizard", () => {
test("single-step flow: root dir input, no corporate strings, lands on dashboard", async ({ page }) => {
await page.goto("/");
// ONBD-10 + ONBD-11: Nexus wizard renders with single-step heading
const heading = page.locator("h1", { hasText: "Welcome to Nexus" });
await expect(heading).toBeVisible({ timeout: 15_000 });
// ONBD-11: Only a root directory input — no multi-step navigation
await expect(page.getByRole("button", { name: "Next" })).toHaveCount(0);
await expect(page.locator("h3", { hasText: "Name your company" })).toHaveCount(0);
await expect(page.locator("h3", { hasText: "Create your first agent" })).toHaveCount(0);
await expect(page.locator("h3", { hasText: "Give it something to do" })).toHaveCount(0);
await expect(page.locator("h3", { hasText: "Ready to launch" })).toHaveCount(0);
// ONBD-12: No corporate placeholder text
await expect(page.getByText("Acme Corp")).toHaveCount(0);
await expect(page.getByText("Company name")).toHaveCount(0);
await expect(page.getByText("What is this company trying to achieve?")).toHaveCount(0);
// Fill root directory and submit
const rootDirInput = page.locator('input[placeholder="~/projects/my-project"]');
await expect(rootDirInput).toBeVisible();
await rootDirInput.fill("/tmp/nexus-e2e-test");
await page.getByRole("button", { name: "Get Started" }).click();
// Should navigate to dashboard
await expect(page).toHaveURL(/\/dashboard/, { timeout: 30_000 });
// Verify workspace and agents created via API
const baseUrl = page.url().split("/").slice(0, 3).join("/");
const companiesRes = await page.request.get(`${baseUrl}/api/companies`);
expect(companiesRes.ok()).toBe(true);
const companies = await companiesRes.json();
expect(companies.length).toBeGreaterThan(0);
const companyId = companies[0].id;
const agentsRes = await page.request.get(
`${baseUrl}/api/companies/${companyId}/agents`
);
expect(agentsRes.ok()).toBe(true);
const agents = await agentsRes.json();
// PM agent (role: ceo, name: "Project Manager") and Engineer created
expect(
agents.some((a: { name: string }) => a.name === "Project Manager")
).toBe(true);
expect(
agents.some((a: { name: string }) => a.name === "Engineer")
).toBe(true);
});
});