entry-metadata.spec.ts 2.4 KB

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