studio.spec.ts 2.0 KB

123456789101112131415161718192021222324252627282930313233
  1. import { expect, test } from "@playwright/test"
  2. test("new research centers the editable composer and suggestions never execute automatically", async ({ page }) => {
  3. await page.setViewportSize({ width: 1440, height: 900 })
  4. await page.goto("/e2e/paas/index.html?ux")
  5. await page.getByLabel("API Key", { exact: true }).fill("studio-test-only")
  6. await page.getByRole("button", { name: "连接平台", exact: true }).click()
  7. const input = page.getByRole("textbox", { name: "消息", exact: true })
  8. await expect(input).toBeInViewport()
  9. const composer = await page.locator(".paas-composer").boundingBox()
  10. const suggestions = await page.getByLabel("任务起点", { exact: true }).boundingBox()
  11. expect(composer!.y).toBeLessThan(600)
  12. expect(suggestions!.y).toBeGreaterThanOrEqual(composer!.y + composer!.height)
  13. await page.getByRole("button", { name: /方案设计.*把研究问题/ }).click()
  14. await expect(input).toBeFocused()
  15. await expect(input).toHaveValue("围绕我的研究问题,设计可检验的研究方案")
  16. expect(await page.evaluate(() => window.paasTestCalls.filter((call) => call.action === "execute").length)).toBe(0)
  17. await input.press("Enter")
  18. await expect(page.locator(".paas-conversation-empty")).toHaveCount(0)
  19. await expect(page.getByLabel("任务起点", { exact: true })).toHaveCount(0)
  20. await expect(input).toBeInViewport()
  21. })
  22. test("small windows keep writing, agent selection and send reachable", async ({ page }) => {
  23. await page.setViewportSize({ width: 520, height: 705 })
  24. await page.goto("/e2e/paas/index.html?ux")
  25. await page.getByLabel("API Key", { exact: true }).fill("studio-narrow")
  26. await page.getByRole("button", { name: "连接平台", exact: true }).click()
  27. await expect(page.getByRole("textbox", { name: "消息", exact: true })).toBeInViewport()
  28. await expect(page.locator(".paas-agent-route > summary")).toBeInViewport()
  29. await expect(page.getByRole("button", { name: "发送消息", exact: true })).toBeInViewport()
  30. expect(await page.evaluate(() => document.documentElement.scrollWidth)).toBe(520)
  31. })