Skip to content

A local-first multi-agent app development platform, built on PenguinHarness

test(e2e): 浏览器 e2e 的 24 条红压到 10 条,夹具回到今天的中文与 data 属性

lmliheng33f6d35d2e8a
diff --git a/packages/web/e2e/chat-tweaks.spec.mjs b/packages/web/e2e/chat-tweaks.spec.mjs
index cb1ed7bb..00030e71 100644
--- a/packages/web/e2e/chat-tweaks.spec.mjs
+++ b/packages/web/e2e/chat-tweaks.spec.mjs
@@ -59,7 +59,8 @@ test("schedule form pickers and details Session-id copy", async ({ page }) => {
// --- Schedule form pickers ---
await page.goto(`${BASE}/agents/default_agent?tab=schedules`);
- await page.getByRole("button", { name: "新建定时任务" }).click();
+ // The tab head is the AI-or-manual pair: this spec drives the form.
+ await page.getByRole("button", { name: "手动创建", exact: true }).click();
await dlg().getByText("每次新建会话").first().waitFor();
// New-session mode: model + workspace are the form-style dropdowns (not native selects),
// matching the Project defaults dialog.
diff --git a/packages/web/e2e/chat.spec.mjs b/packages/web/e2e/chat.spec.mjs
index ee35703a..5db7425e 100644
--- a/packages/web/e2e/chat.spec.mjs
+++ b/packages/web/e2e/chat.spec.mjs
@@ -177,7 +177,7 @@ test("chat + tool approval + stats/cost/copy + traces + files", async ({ page })
const statsLine = copyBtn.locator("xpath=..");
// Cost chip (pricing set). visible-filtered: the chip renders a desktop value plus a
// display:none compact twin for phones, and both match the money pattern.
- await expect(statsLine.locator("text=/\\$0\\.\\d+/").filter({ visible: true })).toBeVisible();
+ await expect(statsLine.locator("text=/[¥$]0\\.\\d+/").filter({ visible: true })).toBeVisible();
// Hidden by default but SPACE-RESERVED (opacity-0, not hidden). Park the cursor first: after
// clicking 允许 ("Allow") the pointer sits where that button was and the re-render can drop a
@@ -249,7 +249,9 @@ test("chat + tool approval + stats/cost/copy + traces + files", async ({ page })
await expect(main.getByText("缩放", { exact: true })).toBeVisible();
await expect(main.getByRole("scrollbar").first()).toBeVisible();
await expect(main.getByText("1.00×")).toBeVisible();
- const timeline = main.locator(".no-scrollbar.overflow-x-auto").first();
+ // `.overflow-y-hidden` pins the node: the stats line below is also `no-scrollbar overflow-x-auto`,
+ // and a bare two-class match could land on it instead of the timeline's own scroller.
+ const timeline = main.locator(".no-scrollbar.overflow-x-auto.overflow-y-hidden").first();
// Wheel-to-zoom is deliberately NOT supported (#58): scrolling the page over the timeline must
// not change the zoom by accident — the ratio stays at 1.00×. Settle first, otherwise the
// assertion could pass on its first poll before a (regressed) wheel handler re-rendered.
@@ -335,12 +337,14 @@ test("chat + tool approval + stats/cost/copy + traces + files", async ({ page })
// lives on aria-label rather than a duplicate title tooltip) ---
await expect(sidebar.getByText("Configure Tailwind theme")).toBeVisible();
await sidebar.locator('button[aria-label="折叠"]').first().click();
- await expect(sidebar.getByText("Configure Tailwind theme")).toHaveCount(0);
+ // Folded rows stay mounted (the fold animates their height to zero and makes them inert),
+ // so the check is "not visible", not "gone from the DOM".
+ await expect(sidebar.getByText("Configure Tailwind theme")).not.toBeVisible();
// The collapse state persists across a reload (localStorage, keyed per Project): the group
// comes back rendered collapsed (an "展开" header), with its rows still hidden.
await page.reload();
await expect(sidebar.locator('button[aria-label="展开"]').first()).toBeVisible();
- await expect(sidebar.getByText("Configure Tailwind theme")).toHaveCount(0);
+ await expect(sidebar.getByText("Configure Tailwind theme")).not.toBeVisible();
await sidebar.locator('button[aria-label="展开"]').first().click();
await expect(sidebar.getByText("Configure Tailwind theme")).toBeVisible();
@@ -360,11 +364,11 @@ test("chat + tool approval + stats/cost/copy + traces + files", async ({ page })
await page.keyboard.press("Escape");
// --- session rename (manual title wins over the auto-generated one) ---
- // Row actions live in the per-row ellipsis menu ("对话选项"); its panel is body-portaled,
+ // Row actions live in the per-row ellipsis menu ("更多"); its panel is body-portaled,
// so the items are page-level, not inside the row locator.
const renameTarget = sidebar.locator("li", { hasText: "Configure Tailwind theme" }).first();
await renameTarget.hover();
- await renameTarget.getByRole("button", { name: "对话选项" }).click();
+ await renameTarget.getByRole("button", { name: "更多" }).click();
await page.getByRole("button", { name: "重命名对话" }).click();
await page.getByLabel("标题").fill("My renamed title");
await page.getByRole("button", { name: "保存" }).click();
@@ -381,7 +385,7 @@ test("chat + tool approval + stats/cost/copy + traces + files", async ({ page })
await expect(throwaway).toBeVisible();
// Archive via the row menu: moves it under the collapsed "已归档" group.
await throwaway.hover();
- await throwaway.getByRole("button", { name: "对话选项" }).click();
+ await throwaway.getByRole("button", { name: "更多" }).click();
await page.getByRole("button", { name: "归档", exact: true }).click();
await expect(sidebar.getByText(/已归档(\d+)/).first()).toBeVisible();
await sidebar
@@ -392,7 +396,7 @@ test("chat + tool approval + stats/cost/copy + traces + files", async ({ page })
await expect(archived).toBeVisible();
// Delete from the archived group (delete + archive share the same row menu).
await archived.hover();
- await archived.getByRole("button", { name: "对话选项" }).click();
+ await archived.getByRole("button", { name: "更多" }).click();
await page.getByRole("button", { name: "删除对话" }).click();
await page.getByRole("button", { name: "删除", exact: true }).click();
await expect(sidebar.getByText("新对话")).toHaveCount(0);
diff --git a/packages/web/e2e/compact-abort.spec.mjs b/packages/web/e2e/compact-abort.spec.mjs
index 086c4d5c..5a23103d 100644
--- a/packages/web/e2e/compact-abort.spec.mjs
+++ b/packages/web/e2e/compact-abort.spec.mjs
@@ -22,6 +22,10 @@ import { provisionAndLogin } from "./auth.mjs";
const BASE = process.env.BASE_URL;
const MOCK = process.env.MOCK_URL;
const U = "abortcompact";
+
+/** The conversation's compaction steps: one disclosure row per compaction, titled by its mode. */
+const compactionRows = (page) =>
+ page.locator("button[aria-expanded]").filter({ hasText: /压缩(中|完毕)|清空中|清空完毕/ });
const P = "password123";
test("aborting before any turn completes: /compact says so instead of doing nothing", async ({
@@ -86,10 +90,10 @@ test("aborting before any turn completes: /compact says so instead of doing noth
await ta.press("Enter");
// There must be feedback — silently doing nothing is exactly the bug being tested for.
- await expect(page.getByRole("button", { name: /nothing to compact/ })).toBeVisible();
+ await expect(page.getByRole("button", { name: /没有可压缩的内容/ })).toBeVisible();
expect(nativeDialogs, "feedback must be an in-app toast, not a native alert").toHaveLength(0);
- // And indeed no compaction was started (no banner).
- await expect(page.getByText(/\[压缩\]/)).toHaveCount(0);
+ // And indeed no compaction was started (no compaction row).
+ await expect(compactionRows(page)).toHaveCount(0);
});
test("compacting twice in a row: says the context was just compacted, not that nothing ever ran", async ({
@@ -133,24 +137,24 @@ test("compacting twice in a row: says the context was just compacted, not that n
void d.dismiss();
});
- // First /compact: compacts normally, shows the banner, no toast expected.
+ // First /compact: compacts normally, shows the row, no toast expected.
await ta.fill("/compact");
await ta.press("Enter");
- await expect(page.getByText(/\[压缩\]/)).toBeVisible();
- // No compact-unavailable toast (match the 409 reasons, not bare "compact" — usernames like
- // "dblcompact" would collide).
+ await expect(compactionRows(page)).toHaveCount(1);
+ // No compact-unavailable toast (match the 409 reasons' own wording, not bare "compact" —
+ // usernames like "dblcompact" would collide).
await expect(
- page.getByRole("button", { name: /compaction configured|nothing to compact|just compacted/ }),
+ page.getByRole("button", { name: /没有配置上下文压缩|没有可压缩的内容|刚刚压缩过/ }),
).toHaveCount(0);
// Second /compact: there's no conversation yet in the new context -> tell the user clearly, and the wording must match reality.
await ta.fill("/compact");
await ta.press("Enter");
- await expect(page.getByRole("button", { name: /just compacted/ })).toBeVisible();
+ await expect(page.getByRole("button", { name: /刚刚压缩过/ })).toBeVisible();
// Having just finished a full round, saying "no completed conversation round yet" would be absurd.
await expect(
- page.getByRole("button", { name: /no completed conversation turns yet/ }),
+ page.getByRole("button", { name: /尚未完成一轮对话/ }),
).toHaveCount(0);
expect(nativeDialogs, "feedback must be an in-app toast, not a native alert").toHaveLength(0);
- await expect(page.getByText(/\[压缩\]/)).toHaveCount(1); // no second compaction banner
+ await expect(compactionRows(page)).toHaveCount(1); // no second compaction row
});
diff --git a/packages/web/e2e/compaction.spec.mjs b/packages/web/e2e/compaction.spec.mjs
index a6c9575e..8496b3b3 100644
--- a/packages/web/e2e/compaction.spec.mjs
+++ b/packages/web/e2e/compaction.spec.mjs
@@ -102,8 +102,9 @@ test("compaction mid-turn: the reply's stats line is still reachable by hovering
// Compaction succeeded and no ordinary request has reported usage since, so the context ring must
// read UNKNOWN (`—`), not 0. Zero would claim the context is empty — but the summary itself costs
// tokens; we simply have not measured the new size yet.
- await expect(page.getByText(`—/${CONTEXT_WINDOW}`)).toBeVisible();
- await expect(page.getByText(`0/${CONTEXT_WINDOW}`)).toHaveCount(0);
+ // The gauge prints no figures while unknown: its accessible name says so instead.
+ await expect(page.getByLabel(/压缩后待下次请求回报/).first()).toBeVisible();
+ await expect(page.getByText(new RegExp(`0\\s*/\\s*${CONTEXT_WINDOW}`))).toHaveCount(0);
// —— The summary is collapsed by default, exactly like a thinking block ——
// The generated summary must not be on screen until the reader asks for it: the row starts
@@ -237,7 +238,8 @@ test("manual /compact between turns: reloading must not fold the compaction into
(await page.getByRole("button", { name: "复制回复" }).first().locator("xpath=..").innerText())
.replace(/\n/g, " ")
.trim();
- const costOf = (t) => t.match(/\$[\d.]+/)?.[0] ?? null;
+ // The chip speaks the display currency (CNY by default, USD when the reader picks it).
+ const costOf = (t) => t.match(/[¥$][\d.]+/)?.[0] ?? null;
const elapsedMsOf = (t) => {
const hit = [...t.matchAll(/(\d+(?:\.\d+)?)(ms|s)(?![\w/])/g)].at(-1);
return hit ? Number(hit[1]) * (hit[2] === "s" ? 1000 : 1) : null;
diff --git a/packages/web/e2e/company.spec.mjs b/packages/web/e2e/company.spec.mjs
index 09ba8b2d..0cef380f 100644
--- a/packages/web/e2e/company.spec.mjs
+++ b/packages/web/e2e/company.spec.mjs
@@ -90,7 +90,9 @@ test("company mode: create the organization, meet the CEO, see the board and the
await page.getByRole("textbox", { name: /^显示名/ }).fill("Plugin Marketplace");
await page.getByRole("textbox", { name: /^使命/ }).fill(MISSION);
// The CEO's budget is the whole company's, and the dialog offers the default it would send.
- await expect(page.getByRole("spinbutton", { name: /^CEO 预算/ })).toHaveValue("100");
+ // The server's default is 100 USD a month; the field speaks the display currency
+ // (CNY by default), and 100 USD × 7 = 700.
+ await expect(page.getByRole("spinbutton", { name: /^CEO 预算/ })).toHaveValue("700");
await page.getByRole("button", { name: "创建", exact: true }).click();
// Creation opens the CEO's desk conversation: an ordinary chat page that renders while the
@@ -223,7 +225,7 @@ test("company mode: create the organization, meet the CEO, see the board and the
await card(title).click();
const dialog = page.getByRole("dialog", { name: title });
await dialog.getByRole("button", { name: /^关联工单会话/ }).click();
- await dialog.locator('button[title="打开会话"]').first().click();
+ await dialog.locator('button[data-tooltip="打开会话"]').first().click();
await expect(page).toHaveURL(new RegExp(`/chat/${sessionId}$`));
await expect(page.getByPlaceholder(/输入消息/)).toBeVisible();
expect(new URL(page.url()).pathname).toBe(`/chat/${sessionId}`);
diff --git a/packages/web/e2e/dock.spec.mjs b/packages/web/e2e/dock.spec.mjs
index a7f045d9..d798b9e2 100644
--- a/packages/web/e2e/dock.spec.mjs
+++ b/packages/web/e2e/dock.spec.mjs
@@ -334,7 +334,8 @@ test("tabs of every kind share a dock: switch, close a panel tab, terminals numb
// Tab click switches; the terminal's view survives being covered (still attached below).
await right.locator('[data-tab-id="workspace"]').click();
await expect(right.locator('[data-tab-id="workspace"][data-active="true"]')).toBeVisible();
- await expect(right.getByText("根目录")).toBeVisible();
+ // The Workspace root is spelled "." (the shell's name for the working directory).
+ await expect(right.getByText(".", { exact: true })).toBeVisible();
await right.locator('[data-testid="dock-tab"][data-terminal-id]').click();
await expect.poll(() => screenText(page), { timeout: 20000 }).toContain("MIXED_DOCK");
diff --git a/packages/web/e2e/draft-user-scope.spec.mjs b/packages/web/e2e/draft-user-scope.spec.mjs
index 34b73e3a..52dd6a6e 100644
--- a/packages/web/e2e/draft-user-scope.spec.mjs
+++ b/packages/web/e2e/draft-user-scope.spec.mjs
@@ -69,7 +69,9 @@ test("switching accounts: B does not restore A's draft; both drafts coexist", as
// B logs in on the same browser, landing on the draft page for the shared Project.
await page.getByLabel("用户名").fill(UB);
// exact: without it, a substring match would also hit the "show password" toggle button (aria-label) next to the password field.
- await page.getByLabel("密码", { exact: true }).fill(P);
+ // Prefix match: the required mark appends "*" to the label text, and the reveal
+ // toggle's own name ("显示密码") does not start with "密码".
+ await page.getByLabel(/^密码/).fill(P);
await page.locator('button[type="submit"]').click();
await page.waitForURL(/\/chat/);
await expect(page.getByRole("heading", { name: "Adelie" })).toBeVisible();
diff --git a/packages/web/e2e/draft.spec.mjs b/packages/web/e2e/draft.spec.mjs
index 3d3b2194..b872e625 100644
--- a/packages/web/e2e/draft.spec.mjs
+++ b/packages/web/e2e/draft.spec.mjs
@@ -96,7 +96,7 @@ test("draft: pick model/approval -> reload restores them -> send creates the ses
await page.getByRole("button", { name: /^权限/ }).click();
await page.getByRole("menuitemradio", { name: /放行只读/ }).click();
await expect(page.getByRole("button", { name: /^权限/ })).toHaveAttribute(
- "title",
+ "data-tooltip",
/审批: 放行只读/,
);
@@ -147,11 +147,12 @@ test("draft: pick model/approval -> reload restores them -> send creates the ses
.toBe(true);
await expect(page.getByRole("button", { name: "选择模型" })).toContainText("claude-4-8-mini");
await expect(page.getByRole("button", { name: /^权限/ })).toHaveAttribute(
- "title",
+ "data-tooltip",
/审批: 放行只读/,
);
// The thinking level is NOT draft state: it restores from the Agent config (written through above), not the cache.
- await expect(page.getByRole("button", { name: "思考等级" })).toContainText("高 (high)");
+ await expect(page.getByRole("button", { name: "思考等级" })).toContainText("高");
+ await expect(page.getByRole("button", { name: "思考等级" })).not.toContainText("high");
// Send: the Session is only created now, and the selections land faithfully in its meta.
await page.getByRole("button", { name: "发送" }).click();
await page.waitForURL(/\/chat\/session-/);
@@ -172,7 +173,7 @@ test("draft: pick model/approval -> reload restores them -> send creates the ses
).json();
const meta = replay.messages.find((m) => m.type === "session_meta");
expect(meta?.payload?.thinking_level).toBeUndefined();
- await expect(page.locator('[data-tooltip="思考等级:高 (high)"]')).toBeVisible();
+ await expect(page.locator('[data-tooltip="思考等级:高"]')).toBeVisible();
// On a successful send the cache clears — except the model selection, which carries over as
// the next conversation's default (switch-becomes-default, like the thinking level above).
@@ -293,7 +294,7 @@ test("draft: pick model/approval -> reload restores them -> send creates the ses
// —— Switch the sidebar to agent mode via the header's list-settings menu (persists in
// localStorage; the grouping radios moved from the inline toggle into this menu) ——
await page.getByRole("button", { name: "列表选项" }).click();
- await page.getByRole("menuitemradio", { name: "按 Agent 分组" }).click();
+ await page.getByRole("menuitemradio", { name: "按智能体分组" }).click();
await expect
.poll(() => page.evaluate(() => localStorage.getItem("penguin.sidebarGroupMode")))
.toBe("agent");
diff --git a/packages/web/e2e/layout.spec.mjs b/packages/web/e2e/layout.spec.mjs
index eeebdd13..ea3ccd2b 100644
--- a/packages/web/e2e/layout.spec.mjs
+++ b/packages/web/e2e/layout.spec.mjs
@@ -534,7 +534,9 @@ test("layout: mobile chat dropdowns stay inside the viewport", async ({ page })
});
expect(put.ok(), "put models").toBeTruthy();
- const panel = page.locator("div.anim-pop.z-40");
+ // Every composer menu is the shared Dropdown's glass panel: in-flow ones keep the z-40 tier,
+ // portaled ones (the permission picker among them) sit at z-[60].
+ const panel = page.locator("div.ui-glass:is(.z-40,.z-\\[60\\])");
/** Assert the one open menu panel and the page itself stay inside the viewport. */
const checkPanel = async (name) => {
await expect(panel, `${name}: menu open`).toHaveCount(1);
@@ -573,8 +575,10 @@ test("layout: mobile chat dropdowns stay inside the viewport", async ({ page })
});
expect(hit, `${name}: panel not clipped by an ancestor`).toBe(true);
};
+ // Prefix match: the permission button's name carries its level ("Permissions: Full access"),
+ // while the others are named by their label alone.
const open = async (label, name) => {
- await page.locator(`button[aria-label="${label}"]`).click();
+ await page.locator(`button[aria-label^="${label}"]`).click();
await checkPanel(name);
};
const close = async () => {
@@ -595,7 +599,7 @@ test("layout: mobile chat dropdowns stay inside the viewport", async ({ page })
// Model / thinking-level buttons stay disabled until models and the agent config load.
await expect(page.locator('button[aria-label="Choose model"]')).toBeEnabled();
await expect(page.locator('button[aria-label="Thinking level"]')).toBeEnabled();
- await open("Approval mode", `approval @${vp.width}`);
+ await open("Permissions", `approval @${vp.width}`);
await close();
await open("Skills", `skills @${vp.width}`);
await close();
@@ -634,7 +638,7 @@ test("layout: mobile chat dropdowns stay inside the viewport", async ({ page })
data: { provider: "custom", modelId: "claude-4-8", approvalMode: "always-ask" },
})
).json();
- const sessionPickers = ["Approval mode", "Skills", "More input options", "Thinking level"];
+ const sessionPickers = ["Permissions", "Skills", "More input options", "Thinking level"];
for (const vp of [
{ width: 320, height: 640 },
{ width: 375, height: 667 },
@@ -656,7 +660,7 @@ test("layout: mobile chat dropdowns stay inside the viewport", async ({ page })
await page.getByRole("button", { name: /^Allow$/ }).waitFor();
// Skills are deliberately locked mid-run; the rest must still open.
await expect(page.locator('button[aria-label="Skills"]')).toBeDisabled();
- for (const label of ["Approval mode", "More input options", "Thinking level"]) {
+ for (const label of ["Permissions", "More input options", "Thinking level"]) {
await open(label, `${label} @running 375`);
await close();
}
diff --git a/packages/web/e2e/llm-errors.spec.mjs b/packages/web/e2e/llm-errors.spec.mjs
index 3888d4cc..7b6ee02c 100644
--- a/packages/web/e2e/llm-errors.spec.mjs
+++ b/packages/web/e2e/llm-errors.spec.mjs
@@ -66,12 +66,12 @@ test("a quota-403 retries with a live countdown; 'retry now' skips the wait and
// waiting/retried text), so asserting any single early ordinal is a race against the stream
// model's commit throttle. What is stable is that there is exactly ONE retry line, and that it
// has reached at least attempt 2 by the time the countdown below appears.
- const ladder = page.locator("p.text-amber-600", { hasText: "[重试]" });
+ const ladder = page.getByText(/\[重试\]/);
await expect(ladder).toHaveCount(1, { timeout: 20000 });
await expect(ladder).toHaveText(/第 [2-9] 次重试/, { timeout: 20000 });
// The 4s wait before retry #5: a live countdown (whole seconds, ticking down).
- const countdown = page.locator("p.text-amber-600", { hasText: /第 5 次重试,\d+ 秒后发起/ });
+ const countdown = page.getByText(/第 5 次重试,\d+ 秒后发起/);
await expect(countdown).toBeVisible({ timeout: 20000 });
const readSecs = async () => {
const txt = await countdown.textContent({ timeout: 500 }).catch(() => null);
@@ -93,7 +93,7 @@ test("a quota-403 retries with a live countdown; 'retry now' skips the wait and
// scheduled 4s would have elapsed (the 1.5s expectation window is the proof: without
// the skip, the natural timer still had >2s to go).
await page.getByRole("button", { name: "立即重试" }).click();
- await expect(page.locator("p.text-amber-600", { hasText: "已发起第 5 次重试" })).toBeVisible({
+ await expect(page.getByText(/已发起第 5 次重试/)).toBeVisible({
timeout: 1500,
});
@@ -137,7 +137,7 @@ test("'give up' on the countdown aborts the backoff: the turn ends and the compo
// turn (abort line + the waiting notice flips to "stopped"), and the composer is
// immediately usable again.
await expect(page.getByText(/已中断/)).toBeVisible({ timeout: 10000 });
- await expect(page.locator("p.text-amber-600", { hasText: "已停止重试" })).toBeVisible();
+ await expect(page.getByText(/已停止重试/)).toBeVisible();
await expect(page.getByPlaceholder(/输入消息/)).toBeEnabled();
});
diff --git a/packages/web/e2e/malformed.spec.mjs b/packages/web/e2e/malformed.spec.mjs
index 1b0b4c0f..7cd1feca 100644
--- a/packages/web/e2e/malformed.spec.mjs
+++ b/packages/web/e2e/malformed.spec.mjs
@@ -52,12 +52,12 @@ test("a malformed tool_call settles unpaired; the retry line shows and the retry
// Retry hint line: set to "retry attempt 1 started" once request_begin arrives.
await expect(page.getByText(/已发起第 1 次重试/)).toBeVisible();
- // Trace: the broken tool_call is persisted (stop_reason=malformed) but **no paired output is
+ // Trace: the broken tool_call is persisted (settled as retryable) but **no paired output is
// added** — it never entered AgentHub's history, so there's nothing to pair; the retry is
- // represented by a request_end(malformed) event.
+ // represented by a request_end whose status is retryable and whose error_code says why.
const msgs = await (await page.request.get(`${BASE}/api/sessions/${sessionId}/messages`)).json();
const broken = msgs.messages.find(
- (m) => m.payload.type === "tool_call" && m.payload.stop_reason === "malformed",
+ (m) => m.payload.type === "tool_call" && m.payload.stop_reason === "retryable",
);
expect(broken, "malformed tool_call recorded").toBeTruthy();
const paired = msgs.messages.find(
@@ -67,9 +67,9 @@ test("a malformed tool_call settles unpaired; the retry line shows and the retry
);
expect(paired, "no paired output for a never-dispatched call").toBeFalsy();
const retryEnd = msgs.messages.find(
- (m) => m.payload.type === "request_end" && m.payload.status === "malformed",
+ (m) => m.payload.type === "request_end" && m.payload.error_code === "malformed",
);
- expect(retryEnd, "request_end(malformed) recorded").toBeTruthy();
+ expect(retryEnd, "request_end(error_code=malformed) recorded").toBeTruthy();
// UI: after expanding the group, the broken tool card shows malformed and is **settled**
// (no more running timer).
@@ -78,13 +78,12 @@ test("a malformed tool_call settles unpaired; the retry line shows and the retry
.first()
.click();
const group = page.locator(".anim-msg.my-2").first();
- // Visibility is asserted explicitly: `toContainText` walks every descendant except
- // SCRIPT/NOSCRIPT/STYLE, so the StatusIcon's own SVG <title>malformed</title> satisfies it
- // even when nothing is drawn. This call never ran, so it has no output block to expand
- // into — the row's `[malformed]` marker is the only explanation a touch user can reach.
+ // This call never ran, so it has no output block to expand into: the row's status icon
+ // carries the state. Since the stop-reason convergence the card's label is the settled
+ // reason itself ("retryable"); the wire-level cause (malformed) lives on request_end.
await expect(
- group.getByText("[malformed]").filter({ visible: true }),
- "the broken tool card shows a visible malformed marker",
+ group.locator('[aria-label="retryable"]'),
+ "the broken tool card's status icon names the settled stop reason",
).toHaveCount(1);
// A running spinner has role=status; none should remain after the turn ends.
await expect(page.locator('[role="status"]')).toHaveCount(0);
diff --git a/packages/web/e2e/outline.spec.mjs b/packages/web/e2e/outline.spec.mjs
index 1eb131f0..6822aef5 100644
--- a/packages/web/e2e/outline.spec.mjs
+++ b/packages/web/e2e/outline.spec.mjs
@@ -225,7 +225,7 @@ test("minimap ticks + hover preview + jump, five-turn gate, sticky group header,
container.scrollTop = card.offsetTop + 400;
const ct = container.getBoundingClientRect().top;
const row = [...document.querySelectorAll("button[aria-expanded]")].find((b) =>
- b.textContent.includes("exec_command"),
+ b.textContent.includes("执行命令"),
);
return {
delta: Math.abs(head.getBoundingClientRect().top - ct),
diff --git a/packages/web/e2e/processes.spec.mjs b/packages/web/e2e/processes.spec.mjs
index 98da401f..1f1797f1 100644
--- a/packages/web/e2e/processes.spec.mjs
+++ b/packages/web/e2e/processes.spec.mjs
@@ -201,13 +201,13 @@ test("clear exited removes every exited process and leaves the running one", asy
const longCommand =
"sleep 0.5 && echo the-exited-process-whose-command-line-runs-far-past-the-width-of-its-row-in-the-details-card";
await exited.getByText(longCommand).hover();
- await expect(page.getByTestId("tooltip")).toHaveText(longCommand);
+ await expect(page.getByTestId("tooltip").first()).toHaveText(longCommand);
// One click on the list heading's text action removes the exited entry; the running row
// stays, and with nothing exited left the action itself goes away. Its hint names what
// leaves with the rows.
const clearExited = page.getByRole("button", { name: "清除已退出", exact: true });
- await expect(clearExited).toHaveAttribute("title", /已捕获的输出也会一并丢弃/);
+ await expect(clearExited).toHaveAttribute("data-tooltip", /已捕获的输出也会一并丢弃/);
await clearExited.click();
await expect(page.locator("li", { hasText: "sleep 0.5" })).toHaveCount(0, { timeout: 10_000 });
await expect(running).toBeVisible();
diff --git a/packages/web/e2e/reload-midstream.spec.mjs b/packages/web/e2e/reload-midstream.spec.mjs
index 9d0bb7b8..a11bbf8f 100644
--- a/packages/web/e2e/reload-midstream.spec.mjs
+++ b/packages/web/e2e/reload-midstream.spec.mjs
@@ -99,9 +99,9 @@ test("in-progress tool output survives a reload: prefix back promptly, still gro
timeout: 30_000,
});
const controlPre = await openToolOutput(page);
- // The output's reveal is paced by the theme (StreamText), and the reply after it can land
- // in the same frame: compare the output once it has settled, not the instant the reply shows.
- await expect(controlPre).toHaveAttribute("data-state", "done");
+ // The output's reveal is paced by the theme, and the reply after it can land in the same
+ // frame: compare the output once the last line is on screen, not the instant the reply shows.
+ await expect(controlPre).toContainText("line 40");
const controlOutput = await controlPre.textContent();
expect(controlOutput).toContain("line 40");
@@ -125,7 +125,7 @@ test("in-progress tool output survives a reload: prefix back promptly, still gro
timeout: 30_000,
});
const reloadedPre = await openToolOutput(page);
- await expect(reloadedPre).toHaveAttribute("data-state", "done");
+ await expect(reloadedPre).toContainText("line 40");
const reloadedOutput = await reloadedPre.textContent();
expect(reloadedOutput).toBe(controlOutput);
});
diff --git a/packages/web/e2e/reloaded-followup.spec.mjs b/packages/web/e2e/reloaded-followup.spec.mjs
index 9602754b..4973cd68 100644
--- a/packages/web/e2e/reloaded-followup.spec.mjs
+++ b/packages/web/e2e/reloaded-followup.spec.mjs
@@ -101,10 +101,18 @@ test("a stale steer response after reload queues the follow-up instead of strand
await expect(thinkingBtn).toContainText("中");
// Now switch for real: a compaction cannot start while the task runs, so "压缩后切换" is
- // disabled here and "仍要切换" is the applying choice.
+ // disabled here and "仍要切换" is the applying choice. The pick PINS the loaded Session
+ // (PATCH /sessions { thinkingLevel }) — the level is no longer a per-task field, so the
+ // follow-up below must not carry it and the pin is what makes it stick.
await thinkingBtn.click();
await page.getByRole("button", { name: "高 (high)", exact: true }).click();
+ const pinned = page.waitForResponse(
+ (r) =>
+ r.request().method() === "PATCH" &&
+ new URL(r.url()).pathname === `/api/sessions/${sessionId}`,
+ );
await page.getByRole("button", { name: "仍要切换", exact: true }).click();
+ expect((await pinned).request().postDataJSON()).toMatchObject({ thinkingLevel: "high" });
await expect(thinkingBtn).toContainText("高");
await composer.fill("hello after reload");
@@ -114,10 +122,11 @@ test("a stale steer response after reload queues the follow-up instead of strand
await page.getByRole("button", { name: "发送给运行中的 Agent" }).click();
const response = await followUpPost;
expect(response.status()).toBe(202);
- expect(response.request().postDataJSON()).toMatchObject({
- queueIfBusy: true,
- thinkingLevel: "high",
- });
+ const queuedBody = response.request().postDataJSON();
+ expect(queuedBody).toMatchObject({ queueIfBusy: true });
+ // The pin above already put the level on the Session; a task-level copy would now be a
+ // second, competing source of truth (upstream removed TaskCreateRequest.thinkingLevel).
+ expect(queuedBody).not.toHaveProperty("thinkingLevel");
expect(await response.json()).toMatchObject({ queued: true });
// The queued hint is now one line per entry carrying that entry's own content (the bare
// "N queued" count is only the fallback for a server that predates pendingFollowUps), and
diff --git a/packages/web/e2e/session-fork.spec.mjs b/packages/web/e2e/session-fork.spec.mjs
index 59881fe9..8c196dfd 100644
--- a/packages/web/e2e/session-fork.spec.mjs
+++ b/packages/web/e2e/session-fork.spec.mjs
@@ -136,7 +136,7 @@ test("fork from reply: button order + confirm gate + clean fork deletion", async
const sidebar = page.getByRole("complementary");
const forkRow = sidebar.locator("li", { hasText: "(1)" }).first();
await forkRow.hover();
- await forkRow.getByRole("button", { name: "对话选项" }).click();
+ await forkRow.getByRole("button", { name: "更多" }).click();
await page.getByRole("button", { name: "删除对话" }).click();
const tDelete = Date.now();
await page.getByRole("button", { name: "删除", exact: true }).click();
diff --git a/packages/web/e2e/skills.spec.mjs b/packages/web/e2e/skills.spec.mjs
index 69c31d26..d21b0e99 100644
--- a/packages/web/e2e/skills.spec.mjs
+++ b/packages/web/e2e/skills.spec.mjs
@@ -182,8 +182,10 @@ test("skills: library list and cards -> manage-install Modal -> quick-invoke pre
return res.skills.map((s) => s.name);
})
.toContain("data-analysis");
- // Clicking "已安装" ("Installed") uninstalls: flips back to "安装" ("Install").
+ // Clicking "已安装" ("Installed") uninstalls: it deletes installed files, so the row
+ // button only opens the confirmation; confirming flips back to "安装" ("Install").
await uninstallHelper.click();
+ await page.getByRole("dialog").getByRole("button", { name: "卸载", exact: true }).click();
await expect(page.getByRole("button", { name: "安装 agent_helper" })).toBeVisible();
// Escape closes the Modal (built into the Modal).
await page.keyboard.press("Escape");
@@ -276,6 +278,6 @@ test("skills: library list and cards -> manage-install Modal -> quick-invoke pre
).json();
const flat = JSON.stringify(messages);
expect(flat, "stored message keeps the [use_skills] block").toContain("[use_skills]");
- expect(flat, "block lists the selected skill").toContain("skills: agent-initialization");
- expect(flat, "prefilled body follows the block").toContain("使用 agent-initialization 技能");
+ expect(flat, "block lists the selected skill").toContain("skills: data-analysis");
+ expect(flat, "prefilled body follows the block").toContain("使用 data-analysis 技能");
});