/** * E2E: a new account reaches onboarding and, without a model, sees how to connect one. */ import { expect, test } from "@playwright/test"; import { captureScreenshot, completeOnboarding, routePatchRpc, signup } from "./helpers"; test("a signed-out visit to onboarding returns there after sign-in", async ({ page }) => { const email = `return-onboarding-${Date.now()}@rakazo.test`; await signup(page, email, "password12", "Return"); await page.waitForURL(/\/onboarding$/, { timeout: 20_000 }); await page.context().clearCookies(); await page.goto("/onboarding", { waitUntil: "domcontentloaded" }); await page.waitForURL((url) => url.pathname === "/sign-in"); expect(new URL(page.url()).searchParams.get("next")).toBe("/onboarding"); await page.getByPlaceholder("Your email address").fill(email); await page.getByPlaceholder("Password").fill("password12"); await page.getByRole("button", { name: "Continue with email" }).click(); await page.waitForURL(/\/onboarding$/, { timeout: 20_000 }); await expect(page.locator('[data-rakazo-surface="onboarding"]')).toBeVisible(); }); test("without a model the composer offers to connect one", async ({ page }) => { const testInfo = test.info(); await signup(page, `model-needed-${Date.now()}@rakazo.test`, "password12", "Model needed"); await completeOnboarding(page, undefined, { mainConversation: true }); await routePatchRpc(page, "bootstrap", (json) => ({ ...json, me: { ...(json.me as Record), needsModel: true }, })); await page.reload({ waitUntil: "domcontentloaded" }); const notice = page.getByTestId("composer-model-needed"); await expect(notice).toContainText("Connect a model so your Oo can reply."); await captureScreenshot(page, testInfo, "first-conversation-model-needed"); await notice.getByRole("button", { name: "Connect model" }).click(); await expect(page.getByTestId("model-settings")).toBeVisible(); });