evOo-local/apps/web/e2e/onboarding-model-required.spec.ts
cynarAI a974f09520 fix(e2e): restore computer-update progress chip after reload (#93)
* fix(e2e): restore computer-update progress chip after reload

Harden the computer maintenance Playwright flow so mocked update state
survives a full page reload: stable background-chip test id, explicit
aria-label, wait for shell readiness and the updates RPC, and explicit
JSON route fulfillment.

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* fix(ci): bump Expo SDK 57 patches and harden flaky web e2e

Sync mobile Expo packages for frozen-lockfile typecheck and read RPC
fetch metadata before response bodies in Playwright route helpers.
Stabilize empty-project Starten, onboarding model catalog, and secret-card reload specs.

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* fix(e2e): stabilize RPC intercepts and project Starten flow

Fulfill patched RPC routes with string bodies, ignore benign route races,
target project Starten by test id, and wait for thread hydration after reload.

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* fix(e2e): drop threads/get wait after secret-card reload

Reload does not always refetch threads/get; poll the saved ask card instead.

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* fix(e2e): reserve unreachable setup port per desktop smoke run

Avoid CI races where a port reserved in beforeAll is rebound before the
unreachable-address check runs.

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* ci: retry product checks after runner OOM on web e2e

Previous Web E2E job exited 137 during the Playwright suite; no failing spec was reported.

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* fix(e2e): wait for shell before opening user settings

After reload, the user menu is not interactive until bootstrap finishes.

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>
2026-10-02 12:09:05 +02:00

69 lines
2.5 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 }));
}
async function stubModelCatalog(page: Page, unavailable: "empty" | "failed") {
await page.route("**/rpc/models/list", async (route) => {
try {
if (unavailable === "failed") {
await route.abort();
return;
}
await route.fulfill({
contentType: "application/json",
body: JSON.stringify({ json: [] }),
});
} catch (error) {
if (/disposed|already handled|Target closed|Request context disposed/i.test(String(error))) {
return;
}
throw error;
}
});
}
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 stubModelCatalog(page, unavailable);
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);
});
}