After onboarding the user ended up in a 1:1 chat with "Chief", and the
"Hauptthread" was a group the web client created and found by name. The
main bot had no conversation it actually led, and addressing another bot
there did nothing unless the user had added it as a member first.
Now the main conversation is a real place:
- bots.ensureMain creates or returns the main bot. Bootstrap and space
navigation return `main` ({ botId, groupId, spaceId }) once the main
bot exists; reading navigation never creates a bot.
- The main bot leads the main conversation and answers when nobody is
addressed: message routing, follow-ups, reactions and clearing the
thread fall back to the group's lead instead of its first member.
- Addressing a same-space bot that is not a member yet, by @Name or a
mention chip, makes it join before the message is routed, so it
answers in the conversation. Specialists from other spaces do not join.
- The main bot cannot be archived or deleted, the main conversation
cannot be archived or deleted or have its members edited, and child
bots never dissolve it. Renaming the main bot renames the conversation.
- Web: onboarding uses bots.ensureMain and finishes in the main
conversation. The main conversation is the first sidebar entry in every
space, shown with the main bot's avatar and name; from another space it
switches back to the home space. The main bot is not listed again among
the bots, its 1:1 thread stays reachable by URL. The client no longer
creates or detects the "Hauptthread" by name, refetches a group when it
changes, and shows the speaker of any of the user's bots in a group.
- Onboarding no longer resets the step when its bootstrap resolves after
the user has already moved on, and new spaces open in the app instead
of walking onboarding again.
Tests: group mention routing with a default responder, lead follow-ups,
child-bot guards, a journey for the main conversation (lead answers,
addressed bot joins, guards, rename), authorization for bots.ensureMain,
and an E2E spec that lands in the main conversation, gets an answer from
the lead, sees an addressed bot join, and reaches the conversation from
another space. Existing E2E specs start in the main bot's thread through
a helper or use the main conversation where that is what they test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MRtGG9ARfqqhma3t85Ro2u
99 lines
4.4 KiB
TypeScript
99 lines
4.4 KiB
TypeScript
import { expect, type Locator, test } from "@playwright/test";
|
|
import { completeOnboarding, rpc, signup, unterhaltungenOnly } from "./helpers";
|
|
|
|
async function selectProjectSpace(projekte: Locator, name: string) {
|
|
const row = projekte.locator('[data-sidebar-group^="project-space:"]').filter({ hasText: name });
|
|
await row.getByRole("button", { name: `Select ${name}` }).click();
|
|
}
|
|
|
|
async function projectSidebarStart(projekte: Locator, name: string) {
|
|
const row = projekte.locator('[data-sidebar-group^="project-space:"]').filter({ hasText: name });
|
|
const groupAttr = await row.getAttribute("data-sidebar-group");
|
|
const spaceId = groupAttr?.match(/^project-space:([^:]+)/)?.[1];
|
|
if (!spaceId) throw new Error(`missing project space id for ${name}`);
|
|
return projekte.getByTestId(`project-start-${spaceId}`);
|
|
}
|
|
|
|
test("empty project shows Starten instead of a fallback bot", async ({ page }) => {
|
|
const stamp = Date.now();
|
|
await signup(page, `empty-project-${stamp}@rakazo.test`, "password12", "Empty Project");
|
|
await completeOnboarding(page);
|
|
await page.goto("/app");
|
|
await page.waitForURL(/\/app\/[^/]+$/);
|
|
|
|
const projekte = page.locator(".sidebar-projekte");
|
|
await projekte.getByTestId("create-project-trigger").click();
|
|
const dialog = page.getByRole("dialog", { name: "New project" });
|
|
await dialog.getByLabel("Name").fill("Launch");
|
|
await dialog.getByRole("button", { name: "Create project", exact: true }).click();
|
|
await page.waitForURL(/\/app(?:\/)?$/);
|
|
|
|
await expect(projekte.getByRole("button", { name: /^Chief/ })).toHaveCount(0);
|
|
await expect(projekte.getByRole("button", { name: "Starten", exact: true })).toBeVisible();
|
|
await expect(page.getByTestId("project-start-main")).toBeVisible();
|
|
|
|
await page.getByTestId("project-start-main").click();
|
|
await expect(page.getByTestId("side-panel")).toHaveAttribute("data-panel", "create");
|
|
});
|
|
|
|
test("Starten in an onboarded project opens the group create flow", async ({ page }) => {
|
|
const stamp = Date.now();
|
|
await signup(page, `project-start-${stamp}@rakazo.test`, "password12", "Project Start");
|
|
await completeOnboarding(page);
|
|
|
|
const projekte = page.locator(".sidebar-projekte");
|
|
await projekte.getByTestId("create-project-trigger").click();
|
|
const dialog = page.getByRole("dialog", { name: "New project" });
|
|
await dialog.getByLabel("Name").fill("Website");
|
|
await dialog.getByRole("button", { name: "Create project", exact: true }).click();
|
|
await page.waitForURL(/\/app(?:\/)?$/);
|
|
await selectProjectSpace(projekte, "Website");
|
|
await page.waitForURL(/\/app(?:\/)?$/);
|
|
|
|
await expect(page.getByTestId("shell-root")).toHaveAttribute("data-ready", "true", {
|
|
timeout: 60_000,
|
|
});
|
|
await selectProjectSpace(projekte, "Website");
|
|
await page.waitForURL(/\/app(?:\/)?$/);
|
|
await expect(unterhaltungenOnly(page).getByRole("button", { name: /^Chief/ })).toHaveCount(1);
|
|
await expect(projekte.getByRole("button", { name: /^Chief/ })).toHaveCount(0);
|
|
const sidebarStart = await projectSidebarStart(projekte, "Website");
|
|
await expect(sidebarStart).toBeVisible({ timeout: 30_000 });
|
|
|
|
await sidebarStart.click();
|
|
await expect(page.getByTestId("side-panel")).toHaveAttribute("data-panel", "create-group", {
|
|
timeout: 30_000,
|
|
});
|
|
await expect(page.getByText("New group", { exact: true })).toBeVisible();
|
|
await expect(
|
|
page.getByTestId("side-panel").getByRole("button", { name: /^Chief/ }),
|
|
).toBeVisible();
|
|
});
|
|
|
|
test("archiving the only bot keeps Starten visible in the project sidebar", async ({ page }) => {
|
|
const stamp = Date.now();
|
|
await signup(page, `project-archive-${stamp}@rakazo.test`, "password12", "Project Archive");
|
|
await completeOnboarding(page);
|
|
|
|
const projekte = page.locator(".sidebar-projekte");
|
|
await projekte.getByTestId("create-project-trigger").click();
|
|
const dialog = page.getByRole("dialog", { name: "New project" });
|
|
await dialog.getByLabel("Name").fill("Side");
|
|
await dialog.getByRole("button", { name: "Create project", exact: true }).click();
|
|
await page.waitForURL(/\/app(?:\/)?$/);
|
|
|
|
const sideBot = await rpc<{ id: string }>(page, "bots/create", {
|
|
name: "Side bot",
|
|
title: "",
|
|
description: "",
|
|
notifyOnFinish: true,
|
|
computerMode: "team",
|
|
});
|
|
await rpc(page, "bots/archive", { botId: sideBot.id });
|
|
|
|
await page.goto("/app");
|
|
await page.waitForURL(/\/app(?:\/)?$/);
|
|
await expect(projekte.getByRole("button", { name: "Starten", exact: true })).toBeVisible();
|
|
await expect(page.getByTestId("project-start-main")).toBeVisible();
|
|
});
|