Files
PaperClipAI/tests/release-smoke/docker-auth-onboarding.spec.ts
Devin Foley 14867bd186 test(release-smoke): follow the mission-less onboarding reorder (#12135)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - The nightly release lane publishes only after the release smoke
suite passes against the newest canary
> - Onboarding was reordered: step 1 now creates the company and routes
straight to the agent step, and the mission step is gone (collected
later in the tenant app, deliberately writing no goal)
> - The smoke spec still walked the removed mission step, so the
scheduled nightly has been red since the reorder shipped
> - This pull request updates the spec to the current flow and asserts
the deliberate empty goal list
> - The benefit is a green nightly lane and an unblocked beta promotion
from current master

## Linked Issues or Issue Description

**What happened?**

The scheduled `Release` nightly run fails in `smoke_nightly / smoke`
since 2026-08-23 (runs 32630184811, 32710905212):
`docker-auth-onboarding.spec.ts` waits for the `Define your mission`
heading after step 1, but the wizard now routes 1 → 3 with no mission
step (the step buttons literally skip from 1 to 3). The retry then fails
on step 1 because the first attempt's company persists.

**Expected behavior**

The smoke passes against canaries carrying the reordered wizard, and the
nightly lane publishes again.

**Steps to reproduce**

Run `scripts/docker-onboard-smoke.sh` with
`PAPERCLIPAI_VERSION=2026.824.0-canary.7` and `pnpm run
test:release-smoke` against it.

**Paperclip version or commit**

`2026.824.0-canary.7`

Related (not duplicates): #11565 updated this same spec for the
chat-first rewrite; this is the follow-up for the mission-less reorder.

## What Changed

- Remove the mission-step interaction; step 1's "Next" now creates the
company and the spec goes straight to the agent step.
- Replace the mission-goal API assertion with the truthful one:
onboarding deliberately writes no goal, so a fresh company's goal list
is empty.
- Update step comments to match the shipped flow.

## Verification

- Local run of the exact CI harness against
`paperclipai@2026.824.0-canary.7`: 1 passed (6.8s), exit 0.
- The suite's remaining API assertions (company, CEO agent, seeded task
assignment, landed issue URL, assignment-sourced heartbeat run) pass
unchanged.

## Risks

- Low risk: test-only. The spec remains copy-coupled to the wizard —
this is the third drift in two weeks; stable `data-testid` hooks in the
wizard remain the durable fix and can follow separately.

## Model Used

Claude Fable 5 (Claude Code)

## Pre-submission checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
2026-08-24 21:08:22 -07:00

167 lines
6.3 KiB
TypeScript

import { expect, test, type Page } from "@playwright/test";
const ADMIN_EMAIL =
process.env.PAPERCLIP_RELEASE_SMOKE_EMAIL ??
process.env.SMOKE_ADMIN_EMAIL ??
"smoke-admin@paperclip.local";
const ADMIN_PASSWORD =
process.env.PAPERCLIP_RELEASE_SMOKE_PASSWORD ??
process.env.SMOKE_ADMIN_PASSWORD ??
"paperclip-smoke-password";
const COMPANY_NAME = `Release-Smoke-${Date.now()}`;
const AGENT_NAME = "CEO";
// Seeded by the wizard's launch step (DEFAULT_TASK_TITLE in
// ui/src/components/OnboardingWizard.tsx).
const FIRST_TASK_TITLE = "Paperclip onboarding";
async function signIn(page: Page) {
await page.goto("/");
await expect(page).toHaveURL(/\/auth/);
await page.locator('input[type="email"]').fill(ADMIN_EMAIL);
await page.locator('input[type="password"]').fill(ADMIN_PASSWORD);
await page.getByRole("button", { name: "Sign In" }).click();
await expect(page).not.toHaveURL(/\/auth/, { timeout: 20_000 });
}
async function openOnboarding(page: Page) {
const wizardHeading = page.locator("h3", { hasText: "Name your organization" });
const startButton = page.getByRole("button", { name: "Start Onboarding" });
await expect(wizardHeading.or(startButton)).toBeVisible({ timeout: 20_000 });
if (await startButton.isVisible()) {
await startButton.click();
}
await expect(wizardHeading).toBeVisible({ timeout: 10_000 });
}
test.describe("Docker authenticated onboarding smoke", () => {
test("logs in, completes onboarding, and hires the lead agent", async ({
page,
}) => {
await signIn(page);
await openOnboarding(page);
// Step 1: name the company. "Next" creates the company itself and routes
// straight to the agent step — onboarding no longer asks for the mission
// (it is collected later, in the tenant app), so there is no step 2.
await page.locator('input[placeholder="Acme Corp"]').fill(COMPANY_NAME);
await page.getByRole("button", { name: "Next" }).click();
// Step 3: give the team lead a role, then a name. The role gates "Next".
const roleSelect = page.locator("#onboarding-agent-role");
await expect(roleSelect).toBeVisible({ timeout: 20_000 });
await roleSelect.click();
await page.getByRole("option", { name: "CEO", exact: true }).click();
await page.locator("#onboarding-agent-name").fill(AGENT_NAME);
await page.getByRole("button", { name: "Next" }).click();
// Step 4: keep the default adapter and connect (hire) the lead. The
// adapter environment check runs inside the smoke container, where no
// agent CLIs are installed; an unhealthy report is expected and must not
// block the hire. Allow generous time for the env probe + hire +
// auto-approval.
const connectButton = page.getByRole("button", { name: "Connect" });
await expect(connectButton).toBeVisible({ timeout: 10_000 });
await expect(connectButton).toBeEnabled({ timeout: 30_000 });
await connectButton.click();
// Step 5: review, then launch. "Get started" provisions the onboarding
// goal/project/first task and, only on success, drops the user into the
// seeded first task's thread (not the dashboard).
const getStartedButton = page.getByRole("button", { name: "Get started" });
await expect(getStartedButton).toBeVisible({ timeout: 60_000 });
await expect(getStartedButton).toBeEnabled({ timeout: 10_000 });
await getStartedButton.click();
await expect(page).toHaveURL(/\/issues\//, { timeout: 30_000 });
const baseUrl = new URL(page.url()).origin;
const companiesRes = await page.request.get(`${baseUrl}/api/companies`);
expect(companiesRes.ok()).toBe(true);
const companies = (await companiesRes.json()) as Array<{ id: string; name: string }>;
const company = companies.find((entry) => entry.name === COMPANY_NAME);
expect(company).toBeTruthy();
const agentsRes = await page.request.get(
`${baseUrl}/api/companies/${company!.id}/agents`
);
expect(agentsRes.ok()).toBe(true);
const agents = (await agentsRes.json()) as Array<{
id: string;
name: string;
role: string;
adapterType: string;
}>;
const ceoAgent = agents.find((entry) => entry.name === AGENT_NAME);
expect(ceoAgent).toBeTruthy();
expect(ceoAgent!.role).toBe("ceo");
expect(ceoAgent!.adapterType).not.toBe("process");
// Onboarding deliberately writes no goal: the mission is collected later
// in the tenant app, so a fresh company must come out of the wizard with
// an empty goal list rather than an unchosen one.
const goalsRes = await page.request.get(
`${baseUrl}/api/companies/${company!.id}/goals`
);
expect(goalsRes.ok()).toBe(true);
const goals = (await goalsRes.json()) as Array<{ id: string }>;
expect(goals).toEqual([]);
const issuesRes = await page.request.get(
`${baseUrl}/api/companies/${company!.id}/issues`
);
expect(issuesRes.ok()).toBe(true);
const issues = (await issuesRes.json()) as Array<{
id: string;
identifier: string | null;
title: string;
assigneeAgentId: string | null;
}>;
const seededIssue = issues.find((entry) => entry.title === FIRST_TASK_TITLE);
expect(seededIssue).toBeTruthy();
expect(seededIssue!.assigneeAgentId).toBe(ceoAgent!.id);
// The launch must have landed on the seeded task itself, not merely on
// some issue route.
const seededRef = seededIssue!.identifier ?? seededIssue!.id;
expect(new URL(page.url()).pathname.endsWith(`/issues/${seededRef}`)).toBe(
true
);
await expect.poll(
async () => {
const runsRes = await page.request.get(
`${baseUrl}/api/companies/${company!.id}/heartbeat-runs?agentId=${ceoAgent!.id}`
);
expect(runsRes.ok()).toBe(true);
const runs = (await runsRes.json()) as Array<{
agentId: string;
invocationSource: string;
status: string;
}>;
const latestRun = runs.find((entry) => entry.agentId === ceoAgent!.id);
return latestRun
? {
invocationSource: latestRun.invocationSource,
status: latestRun.status,
}
: null;
},
{
timeout: 30_000,
intervals: [1_000, 2_000, 5_000],
}
).toEqual(
expect.objectContaining({
invocationSource: "assignment",
status: expect.stringMatching(/^(queued|running|succeeded|failed)$/),
})
);
});
});