evOo-local/apps/web/e2e/onboarding-model-required.spec.ts
Cursor Agent 95c5544786 fix(e2e): migrate rpc/me intercept anti-pattern across specs
Extend helpers with fulfillFetchedRpc for multi-procedure or in-place
patches. Move onboarding, mobile, host-computer, and group-chats specs
off route.fulfill({ response, json }) after response.json().

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>
2026-09-24 05:41:56 +00:00

51 lines
2.0 KiB
TypeScript

import { expect, type Page, test } from "@playwright/test";
import { routePatchRpc, signup } from "./helpers";
async function forceNeedsModel(page: Page) {
await routePatchRpc(page, "me", (json) => ({ ...json, needsModel: true }));
}
test("onboarding shows the look picker when a model is still required", async ({ page }) => {
await forceNeedsModel(page);
const stamp = Date.now();
await signup(
page,
`model-required-${stamp}@rakazo.test`,
"password12",
`Model required ${stamp}`,
);
await page.waitForURL(/\/onboarding/, { timeout: 20_000 });
await expect(page.locator('[data-rakazo-surface="onboarding"]')).toHaveAttribute(
"data-onboarding-step",
/^(emoji|preferences|language|voice|integrations)$/,
{ timeout: 30_000 },
);
await expect(page.getByRole("heading", { name: /Design your Oo/i })).toBeVisible({
timeout: 20_000,
});
await expect(page.getByRole("heading", { name: "Connect a model" })).toHaveCount(0);
await expect(page.getByRole("combobox", { name: "Message" })).toHaveCount(0);
});
for (const unavailable of ["empty", "failed"] as const) {
test(`onboarding still opens when the model catalog is ${unavailable}`, async ({ page }) => {
await forceNeedsModel(page);
await page.route("**/rpc/models/list", (route) =>
unavailable === "failed" ? route.abort() : route.fulfill({ json: { json: [] } }),
);
const stamp = Date.now();
await signup(page, `catalog-${unavailable}-${stamp}@rakazo.test`, "password12", "Model setup");
await page.waitForURL(/\/onboarding/, { timeout: 20_000 });
await expect(page.locator('[data-rakazo-surface="onboarding"]')).toHaveAttribute(
"data-onboarding-step",
/^(emoji|preferences|language|voice|integrations)$/,
{ timeout: 30_000 },
);
await expect(page.getByRole("heading", { name: /Design your Oo/i })).toBeVisible({
timeout: 20_000,
});
await expect(page.getByRole("heading", { name: "Connect a model" })).toHaveCount(0);
await expect(page.getByRole("combobox", { name: "Message" })).toHaveCount(0);
});
}