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
This commit is contained in:
parent
9146b502d9
commit
0d33aa615e
1 changed files with 37 additions and 114 deletions
|
|
@ -1,142 +1,65 @@
|
|||
import { test, expect } from "@playwright/test";
|
||||
|
||||
/**
|
||||
* E2E: Onboarding wizard flow (skip_llm mode).
|
||||
* E2E: Nexus onboarding wizard — single-step root directory flow.
|
||||
*
|
||||
* Walks through the 4-step OnboardingWizard:
|
||||
* Step 1 — Name your company
|
||||
* Step 2 — Create your first agent (adapter selection + config)
|
||||
* Step 3 — Give it something to do (task creation)
|
||||
* Step 4 — Ready to launch (summary + open issue)
|
||||
*
|
||||
* By default this runs in skip_llm mode: we do NOT assert that an LLM
|
||||
* heartbeat fires. Set PAPERCLIP_E2E_SKIP_LLM=false to enable LLM-dependent
|
||||
* assertions (requires a valid ANTHROPIC_API_KEY).
|
||||
* 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
|
||||
*/
|
||||
|
||||
const SKIP_LLM = process.env.PAPERCLIP_E2E_SKIP_LLM !== "false";
|
||||
|
||||
const COMPANY_NAME = `E2E-Test-${Date.now()}`;
|
||||
const AGENT_NAME = "CEO";
|
||||
const TASK_TITLE = "E2E test task";
|
||||
|
||||
test.describe("Onboarding wizard", () => {
|
||||
test("completes full wizard flow", async ({ page }) => {
|
||||
test.describe("Nexus onboarding wizard", () => {
|
||||
test("single-step flow: root dir input, no corporate strings, lands on dashboard", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
|
||||
const wizardHeading = page.locator("h3", { hasText: "Name your company" });
|
||||
const newCompanyBtn = page.getByRole("button", { name: "New Company" });
|
||||
// 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 });
|
||||
|
||||
await expect(
|
||||
wizardHeading.or(newCompanyBtn)
|
||||
).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);
|
||||
|
||||
if (await newCompanyBtn.isVisible()) {
|
||||
await newCompanyBtn.click();
|
||||
}
|
||||
// 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);
|
||||
|
||||
await expect(wizardHeading).toBeVisible({ timeout: 5_000 });
|
||||
// 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");
|
||||
|
||||
const companyNameInput = page.locator('input[placeholder="Acme Corp"]');
|
||||
await companyNameInput.fill(COMPANY_NAME);
|
||||
await page.getByRole("button", { name: "Get Started" }).click();
|
||||
|
||||
const nextButton = page.getByRole("button", { name: "Next" });
|
||||
await nextButton.click();
|
||||
|
||||
await expect(
|
||||
page.locator("h3", { hasText: "Create your first agent" })
|
||||
).toBeVisible({ timeout: 10_000 });
|
||||
|
||||
const agentNameInput = page.locator('input[placeholder="CEO"]');
|
||||
await expect(agentNameInput).toHaveValue(AGENT_NAME);
|
||||
|
||||
await expect(
|
||||
page.locator("button", { hasText: "Claude Code" }).locator("..")
|
||||
).toBeVisible();
|
||||
|
||||
await page.getByRole("button", { name: "More Agent Adapter Types" }).click();
|
||||
await expect(page.getByRole("button", { name: "Process" })).toHaveCount(0);
|
||||
|
||||
await page.getByRole("button", { name: "Next" }).click();
|
||||
|
||||
await expect(
|
||||
page.locator("h3", { hasText: "Give it something to do" })
|
||||
).toBeVisible({ timeout: 10_000 });
|
||||
|
||||
const taskTitleInput = page.locator(
|
||||
'input[placeholder="e.g. Research competitor pricing"]'
|
||||
);
|
||||
await taskTitleInput.clear();
|
||||
await taskTitleInput.fill(TASK_TITLE);
|
||||
|
||||
await page.getByRole("button", { name: "Next" }).click();
|
||||
|
||||
await expect(
|
||||
page.locator("h3", { hasText: "Ready to launch" })
|
||||
).toBeVisible({ timeout: 10_000 });
|
||||
|
||||
await expect(page.locator("text=" + COMPANY_NAME)).toBeVisible();
|
||||
await expect(page.locator("text=" + AGENT_NAME)).toBeVisible();
|
||||
await expect(page.locator("text=" + TASK_TITLE)).toBeVisible();
|
||||
|
||||
await page.getByRole("button", { name: "Create & Open Issue" }).click();
|
||||
|
||||
await expect(page).toHaveURL(/\/issues\//, { timeout: 10_000 });
|
||||
// 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();
|
||||
const company = companies.find(
|
||||
(c: { name: string }) => c.name === COMPANY_NAME
|
||||
);
|
||||
expect(company).toBeTruthy();
|
||||
expect(companies.length).toBeGreaterThan(0);
|
||||
|
||||
const companyId = companies[0].id;
|
||||
const agentsRes = await page.request.get(
|
||||
`${baseUrl}/api/companies/${company.id}/agents`
|
||||
`${baseUrl}/api/companies/${companyId}/agents`
|
||||
);
|
||||
expect(agentsRes.ok()).toBe(true);
|
||||
const agents = await agentsRes.json();
|
||||
const ceoAgent = agents.find(
|
||||
(a: { name: string }) => a.name === AGENT_NAME
|
||||
);
|
||||
expect(ceoAgent).toBeTruthy();
|
||||
expect(ceoAgent.role).toBe("ceo");
|
||||
expect(ceoAgent.adapterType).not.toBe("process");
|
||||
|
||||
const instructionsBundleRes = await page.request.get(
|
||||
`${baseUrl}/api/agents/${ceoAgent.id}/instructions-bundle?companyId=${company.id}`
|
||||
);
|
||||
expect(instructionsBundleRes.ok()).toBe(true);
|
||||
const instructionsBundle = await instructionsBundleRes.json();
|
||||
// PM agent (role: ceo, name: "Project Manager") and Engineer created
|
||||
expect(
|
||||
instructionsBundle.files.map((file: { path: string }) => file.path).sort()
|
||||
).toEqual(["AGENTS.md", "HEARTBEAT.md", "SOUL.md", "TOOLS.md"]);
|
||||
|
||||
const issuesRes = await page.request.get(
|
||||
`${baseUrl}/api/companies/${company.id}/issues`
|
||||
);
|
||||
expect(issuesRes.ok()).toBe(true);
|
||||
const issues = await issuesRes.json();
|
||||
const task = issues.find(
|
||||
(i: { title: string }) => i.title === TASK_TITLE
|
||||
);
|
||||
expect(task).toBeTruthy();
|
||||
expect(task.assigneeAgentId).toBe(ceoAgent.id);
|
||||
expect(task.description).toContain(
|
||||
"You are the CEO. You set the direction for the company."
|
||||
);
|
||||
expect(task.description).not.toContain("github.com/paperclipai/companies");
|
||||
|
||||
if (!SKIP_LLM) {
|
||||
await expect(async () => {
|
||||
const res = await page.request.get(
|
||||
`${baseUrl}/api/issues/${task.id}`
|
||||
);
|
||||
const issue = await res.json();
|
||||
expect(["in_progress", "done"]).toContain(issue.status);
|
||||
}).toPass({ timeout: 120_000, intervals: [5_000] });
|
||||
}
|
||||
agents.some((a: { name: string }) => a.name === "Project Manager")
|
||||
).toBe(true);
|
||||
expect(
|
||||
agents.some((a: { name: string }) => a.name === "Engineer")
|
||||
).toBe(true);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue