50 lines
1.9 KiB
TypeScript
50 lines
1.9 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
import { completeOnboarding, routePatchRpc, rpc, signup } from "./helpers";
|
|
|
|
test("empty project space offers Start before the main conversation exists", async ({ page }) => {
|
|
const stamp = Date.now();
|
|
await signup(page, `empty-project-${stamp}@rakazo.test`, "password12", "Empty Project");
|
|
await completeOnboarding(page);
|
|
|
|
const side = await rpc<{ id: string }>(page, "spaces/create", { name: "Empty project" });
|
|
|
|
// spaces/create provisions a main conversation server-side; strip it from bootstrap so the
|
|
// shell shows the pre-start empty project UI.
|
|
await routePatchRpc(page, "bootstrap", (json) => {
|
|
const groups = (json.groups as Array<{ spaceId: string }>).filter(
|
|
(group) => group.spaceId !== side.id,
|
|
);
|
|
const bots = (json.bots as Array<{ spaceId: string }>).filter(
|
|
(bot) => bot.spaceId !== side.id,
|
|
);
|
|
const spaces = (
|
|
json.spaces as Array<{
|
|
id: string;
|
|
bots: unknown[];
|
|
groups: unknown[];
|
|
hasContent: boolean;
|
|
}>
|
|
).map((space) =>
|
|
space.id === side.id ? { ...space, bots: [], groups: [], hasContent: false } : space,
|
|
);
|
|
return { ...json, groups, bots, spaces };
|
|
});
|
|
|
|
await page.evaluate((spaceId) => {
|
|
window.localStorage.setItem("rakazo:space-id", spaceId);
|
|
}, side.id);
|
|
await page.goto("/app", { waitUntil: "domcontentloaded" });
|
|
await expect(page.getByTestId("shell-root")).toHaveAttribute("data-ready", "true", {
|
|
timeout: 60_000,
|
|
});
|
|
|
|
const mainStart = page.getByTestId("project-start-main");
|
|
await expect(mainStart).toBeVisible({ timeout: 30_000 });
|
|
await expect(mainStart).toContainText(/Start|Starten/i);
|
|
|
|
const projekte = page.locator(".sidebar-projekte");
|
|
const sidebarStart = projekte.getByTestId(`project-start-${side.id}`);
|
|
await expect(sidebarStart).toBeVisible({ timeout: 30_000 });
|
|
await expect(sidebarStart).toContainText(/Start|Starten/i);
|
|
});
|