AstrBot-Desktop/tests/e2e/bootstrap.spec.ts

25 行
868 B
TypeScript

import { expect, test } from "@playwright/test";
test("renders the bootstrap shell and safe browser fallback", async ({
page,
}) => {
await page.goto("/");
await expect(
page.getByText("AstrBot Desktop", { exact: true }).first(),
).toBeVisible();
feat(chat): give the conversation the height the header was using The chat panel opened with three stacked blocks above the messages: a title and subtitle naming the panel, a strip repeating the profile id, session id and connection state, and the session pills. Only the last carried anything the reader needed. Move the slot tabs into the window title bar and delete the rest. The tabs go there through a portal rather than by lifting state into the shell, which keeps the slot selection and its status polling in the panel that owns them; the quick chat and bubble windows have no title bar, and they are slot-fixed already, so the tabs simply do not render there. The connection actions move onto the session row, which costs no height because that row already exists. 刷新 is dropped: the status refreshes on a 500ms poll, so the button did nothing the panel was not already doing. 重连, 断开 and 新对话 stay, since losing them would leave no way to recover a dropped connection or start a conversation. The panel now puts 82px above the messages instead of three blocks. The title-bar rules carry [role="tab"] on purpose — the panel's own .chat-slot[role=tab] rule sets a 2.75rem minimum and sits later in the sheet, so an unqualified selector loses to it and the tabs overflow a 44px bar. Verified against the real stylesheet: tabs 33px inside a 44px bar, vertically centred, clear of both the title text and the window controls; the removed blocks are absent from the DOM. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 03:59:29 +08:00
// The chat panel's own heading is gone; the slot tabs it portals into the
// title bar are what proves the panel rendered and that the portal found its
// mount point.
await expect(page.getByRole("tab", { name: /陪伴/ })).toBeVisible();
await expect(page.getByRole("tab", { name: /运维/ })).toBeVisible();
await expect(
page.getByText("IPC 暂不可用:", { exact: false }),
).toBeVisible();
await page.getByRole("button", { name: "◎ 连接 实例与槽位管理" }).click();
await expect(
page.getByRole("heading", { name: "连接 Profile" }),
).toBeVisible();
});