import { expect, test } from "@playwright/test" test("renamed internal roles remain hidden and knowledge requests use installed capabilities", async ({ page }) => { await page.goto("/e2e/paas/index.html?entry-metadata&completed") await page.getByLabel("API Key", { exact: true }).fill("entry-metadata") await page.getByRole("button", { name: "连接平台", exact: true }).click() const message = page.getByRole("textbox", { name: "消息", exact: true }) await message.fill("根据知识库中的报销制度回答差旅标准") await expect(page.getByRole("button", { name: "选择执行角色", exact: true })).toContainText("部门制度问答") await page.getByRole("button", { name: "选择执行角色", exact: true }).click() await expect(page.getByRole("option", { name: /已改名的复核节点|旧版改名节点/ })).toHaveCount(0) await page.keyboard.press("Escape") await message.press("Enter") await expect.poll(() => page.evaluate(() => (window as unknown as { paasTestCalls: { action: string; agentID?: string }[] }).paasTestCalls.find(c => c.action === "execute")?.agentID, )).toBe("qa-random") }) test("old installed pack names use product names in discovery and new instances", async ({ page }) => { await page.goto("/e2e/paas/index.html?plugins&unified") await page.evaluate(() => Object.assign((window as unknown as { paasPlugins: object }).paasPlugins, { packs: [{ id: "data.analyst", name: "Data67 数据分析", version: "0.1.0", description: "分析表格", dependencies: [] }], })) await page.getByLabel("API Key", { exact: true }).fill("pack-names") await page.getByRole("button", { name: "连接平台", exact: true }).click() await page.getByRole("button", { name: "应用与插件", exact: true }).click() await page.getByRole("tab", { name: "发现应用" }).click() await expect(page.getByRole("heading", { name: "数据分析助手", exact: true })).toBeVisible() await page.getByRole("button", { name: "了解并添加" }).click() await expect(page.getByLabel("应用名称", { exact: true })).toHaveValue("数据分析助手") await page.getByRole("button", { name: "检查依赖并添加" }).click() await expect(page.getByRole("heading", { name: "应用已添加" })).toBeVisible() await page.getByRole("button", { name: "开始使用", exact: true }).click() await expect(page.getByRole("button", { name: "选择执行角色", exact: true })).toContainText("数据分析助手") })