|
@@ -1,5 +1,37 @@
|
|
|
import { expect, test } from "@playwright/test"
|
|
import { expect, test } from "@playwright/test"
|
|
|
|
|
|
|
|
|
|
+test("workspace assistant requires and forwards the project folder", async ({ page }) => {
|
|
|
|
|
+ await page.goto("/e2e/paas/index.html?workspace")
|
|
|
|
|
+ await page.getByLabel("API Key", { exact: true }).fill("workspace-context")
|
|
|
|
|
+ await page.getByRole("button", { name: "连接平台", exact: true }).click()
|
|
|
|
|
+ await page.getByLabel("选择智能体", { exact: true }).selectOption({ label: "工作区助手" })
|
|
|
|
|
+ await page.getByRole("textbox", { name: "消息", exact: true }).fill("整理这个文件夹")
|
|
|
|
|
+ await page.getByRole("textbox", { name: "消息", exact: true }).press("Enter")
|
|
|
|
|
+ await expect(page.getByText("需要绑定项目工作文件夹", { exact: true })).toBeVisible()
|
|
|
|
|
+ expect(
|
|
|
|
|
+ await page.evaluate(
|
|
|
|
|
+ () => (window as unknown as { paasTestCalls: { action: string }[] }).paasTestCalls.filter((call) => call.action === "execute").length,
|
|
|
|
|
+ ),
|
|
|
|
|
+ ).toBe(0)
|
|
|
|
|
+
|
|
|
|
|
+ await page.getByRole("button", { name: "新建项目", exact: true }).click()
|
|
|
|
|
+ await page.getByLabel("项目名称", { exact: true }).fill("工作区研究")
|
|
|
|
|
+ await page.getByRole("button", { name: "创建项目", exact: true }).click()
|
|
|
|
|
+ await page.getByRole("button", { name: "绑定工作文件夹", exact: true }).click()
|
|
|
|
|
+ await page.getByLabel("选择智能体", { exact: true }).selectOption({ label: "工作区助手" })
|
|
|
|
|
+ await page.getByRole("textbox", { name: "消息", exact: true }).fill("整理这个文件夹并改 README")
|
|
|
|
|
+ await page.getByRole("textbox", { name: "消息", exact: true }).press("Enter")
|
|
|
|
|
+ await expect
|
|
|
|
|
+ .poll(() =>
|
|
|
|
|
+ page.evaluate(
|
|
|
|
|
+ () => (window as unknown as { paasTestCalls: { action: string; workDir?: string }[] }).paasTestCalls.find(
|
|
|
|
|
+ (call) => call.action === "execute",
|
|
|
|
|
+ )?.workDir,
|
|
|
|
|
+ ),
|
|
|
|
|
+ )
|
|
|
|
|
+ .toBe("D:/Research/optics")
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
test("projects isolate chat history and keep a bound workspace after reload", async ({ page }) => {
|
|
test("projects isolate chat history and keep a bound workspace after reload", async ({ page }) => {
|
|
|
await page.goto("/e2e/paas/index.html")
|
|
await page.goto("/e2e/paas/index.html")
|
|
|
await page.getByLabel("API Key", { exact: true }).fill("project-test")
|
|
await page.getByLabel("API Key", { exact: true }).fill("project-test")
|