Make English the repository working language (#5)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Yaowei Zheng
2026-07-20 17:45:02 +08:00
committed by GitHub
parent e80cde0ea6
commit 0eaaa54e25
136 changed files with 1515 additions and 1352 deletions
+13 -11
View File
@@ -15,7 +15,9 @@ const MOCK = process.env.MOCK_URL;
const U = "draftuser";
const P = "password123";
test("draft: 选模型/审批 → 刷新保留 → 发送建会话并清缓存 → 侧栏 + 指定 Agent", async ({ page }) => {
test("draft: pick model/approval -> reload restores them -> send creates the session and clears the cache -> sidebar + scopes the Agent", async ({
page,
}) => {
// Draft keys are isolated by user x Project/Session (#68); building the key needs userId (i.e. the username).
const userId = (await provisionAndLogin(page.request, U, P)).userId;
@@ -57,14 +59,14 @@ test("draft: 选模型/审批 → 刷新保留 → 发送建会话并清缓存
await expect(page.getByRole("heading", { name: "PenguinHarness" })).toBeVisible();
const ta = page.getByPlaceholder(/输入消息/);
await ta.fill("草稿正文不能丢");
await ta.fill("Draft body must not be lost");
// The @ delegation target is also draft content: typing an @ prefix at the end summons the
// menu, selecting it turns into a chip (the @token in the body text is stripped out).
await ta.fill("草稿正文不能丢 @agent_hel");
await ta.fill("Draft body must not be lost @agent_hel");
await page.getByRole("button", { name: /@agent_helper/ }).click();
await expect(page.getByText("@agent_helper")).toBeVisible();
await expect(ta).toHaveValue("草稿正文不能丢");
await expect(ta).toHaveValue("Draft body must not be lost");
// Switch the model: the selector sits to the left of the send button, opens downward, with a quick-search field at the top.
await page.getByRole("button", { name: "选择模型" }).click();
@@ -80,10 +82,10 @@ test("draft: 选模型/审批 → 刷新保留 → 发送建会话并清缓存
const draftKey = `penguin.chatDraft.${userId}.${projectId}`;
await expect
.poll(() => page.evaluate((k) => localStorage.getItem(k), draftKey))
.toContain("草稿正文不能丢");
.toContain("Draft body must not be lost");
await page.reload();
await expect(ta).toHaveValue("草稿正文不能丢");
await expect(ta).toHaveValue("Draft body must not be lost");
// After restoring, the cursor lands at the end of the draft (focus defaults to the start, so it must be explicitly moved to the end to keep typing).
await expect
.poll(() =>
@@ -120,7 +122,7 @@ test("draft: 选模型/审批 → 刷新保留 → 发送建会话并清缓存
await groupRow.getByRole("button", { name: "新建对话" }).click();
await expect(page.getByLabel("选择 Agent")).toContainText("Helper Agent");
await ta.fill("给 helper 的第一条");
await ta.fill("First message for helper");
await page.getByRole("button", { name: "发送" }).click();
await page.waitForURL(/\/chat\/session-/);
const secondSessionId = page.url().split("/chat/")[1];
@@ -133,17 +135,17 @@ test("draft: 选模型/审批 → 刷新保留 → 发送建会话并清缓存
expect(second.session.approvalMode).toBe("allow-all");
// Under allow-all, the mock's exec_command is auto-approved, so the round runs to completion (turn 2 text lands).
await expect(page.getByText("命令已执行完成,结果符合预期。")).toBeVisible();
await expect(page.getByText("Command finished; the result looks as expected.")).toBeVisible();
// —— Input draft for an existing session: cached by user x Session, restored on reload, cleared once sending succeeds ——
await ta.fill("会话里的草稿");
await ta.fill("Draft inside the session");
const sessionKey = `penguin.chatDraft.session.${userId}.${secondSessionId}`;
await expect
.poll(() => page.evaluate((k) => localStorage.getItem(k), sessionKey))
.toContain("会话里的草稿");
.toContain("Draft inside the session");
await page.reload();
await expect(ta).toHaveValue("会话里的草稿");
await expect(ta).toHaveValue("Draft inside the session");
await page.getByRole("button", { name: "发送" }).click();
await expect.poll(() => page.evaluate((k) => localStorage.getItem(k), sessionKey)).toBeNull();
});