fix(web): empty project E2E simulates pre-start bootstrap; relax module recovery wait
Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>
This commit is contained in:
parent
2e4d7d3835
commit
8c948050b9
@ -1,5 +1,5 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
import { completeOnboarding, rpc, signup } from "./helpers";
|
||||
import { completeOnboarding, routePatchRpc, rpc, signup } from "./helpers";
|
||||
|
||||
test("empty project space offers Start before the main conversation exists", async ({ page }) => {
|
||||
const stamp = Date.now();
|
||||
@ -7,15 +7,42 @@ test("empty project space offers Start before the main conversation exists", asy
|
||||
await completeOnboarding(page);
|
||||
|
||||
const side = await rpc<{ id: string }>(page, "spaces/create", { name: "Empty project" });
|
||||
await page.reload({ waitUntil: "domcontentloaded" });
|
||||
|
||||
// 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");
|
||||
await expect(projekte.getByText("Empty project", { exact: true })).toBeVisible({
|
||||
timeout: 30_000,
|
||||
});
|
||||
const sidebarStart = projekte.getByTestId(`project-start-${side.id}`);
|
||||
await expect(sidebarStart).toBeVisible({ timeout: 30_000 });
|
||||
await expect(sidebarStart).toContainText(/Start|Starten/i);
|
||||
|
||||
@ -20,7 +20,9 @@ test("the app reloads itself once when a module request aborts while booting", a
|
||||
|
||||
await page.goto("/sign-in", { waitUntil: "commit" });
|
||||
|
||||
await expect(page.getByRole("heading", { name: "Sign in to evOo" })).toBeVisible();
|
||||
await expect(page.getByRole("heading", { name: "Sign in to evOo" })).toBeVisible({
|
||||
timeout: 60_000,
|
||||
});
|
||||
expect(counter.aborted).toBe(1);
|
||||
expect(await page.evaluate(() => sessionStorage.getItem("rakazo:boot-reload"))).toBeNull();
|
||||
});
|
||||
@ -30,7 +32,9 @@ test("a lazy route recovers when its module request aborts", async ({ page }) =>
|
||||
|
||||
await page.goto("/sign-in");
|
||||
|
||||
await expect(page.getByRole("heading", { name: "Sign in to evOo" })).toBeVisible();
|
||||
await expect(page.getByRole("heading", { name: "Sign in to evOo" })).toBeVisible({
|
||||
timeout: 60_000,
|
||||
});
|
||||
expect(counter.aborted).toBe(1);
|
||||
expect(
|
||||
await page.evaluate(() => sessionStorage.getItem("rakazo:module-reload:pages/Auth")),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user