|
@@ -8,15 +8,21 @@ test("completed research appears in inbox until opened", async ({ page }) => {
|
|
|
.getByRole("button", { name: /已有研究/ })
|
|
.getByRole("button", { name: /已有研究/ })
|
|
|
.first()
|
|
.first()
|
|
|
.click()
|
|
.click()
|
|
|
- const inbox = page.getByRole("button", { name: /待处理/ })
|
|
|
|
|
- await expect(inbox).toContainText("1")
|
|
|
|
|
|
|
+ const inbox = page.getByRole("button", { name: "待处理 1 项", exact: true })
|
|
|
|
|
+ await expect(inbox).toBeVisible()
|
|
|
|
|
+ await page.getByRole("button", { name: "平台任务", exact: true }).click()
|
|
|
|
|
+ await expect(page.getByRole("heading", { name: "平台任务", exact: true })).toBeVisible()
|
|
|
|
|
+ await expect(page.getByRole("heading", { name: "研究计划", exact: true })).not.toBeVisible()
|
|
|
await inbox.click()
|
|
await inbox.click()
|
|
|
- const panel = page.getByRole("dialog", { name: "待处理" })
|
|
|
|
|
- await panel.getByRole("button", { name: /已有研究/ }).click()
|
|
|
|
|
|
|
+ await page
|
|
|
|
|
+ .getByRole("dialog", { name: "待处理" })
|
|
|
|
|
+ .getByRole("button", { name: /已有研究/ })
|
|
|
|
|
+ .click()
|
|
|
|
|
+ await expect(page.getByRole("heading", { name: "研究计划", exact: true })).toBeVisible()
|
|
|
await expect(page.getByRole("button", { name: /待处理/ })).toHaveCount(0)
|
|
await expect(page.getByRole("button", { name: /待处理/ })).toHaveCount(0)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
-test("inbox panel closes with Escape and restores focus", async ({ page }) => {
|
|
|
|
|
|
|
+test("inbox panel closes on Escape inside it and on an outside pointer click", async ({ page }) => {
|
|
|
await page.goto("/e2e/paas/index.html?completed")
|
|
await page.goto("/e2e/paas/index.html?completed")
|
|
|
await page.getByLabel("API Key", { exact: true }).fill("inbox-escape")
|
|
await page.getByLabel("API Key", { exact: true }).fill("inbox-escape")
|
|
|
await page.getByRole("button", { name: "连接平台", exact: true }).click()
|
|
await page.getByRole("button", { name: "连接平台", exact: true }).click()
|
|
@@ -24,10 +30,35 @@ test("inbox panel closes with Escape and restores focus", async ({ page }) => {
|
|
|
.getByRole("button", { name: /已有研究/ })
|
|
.getByRole("button", { name: /已有研究/ })
|
|
|
.first()
|
|
.first()
|
|
|
.click()
|
|
.click()
|
|
|
- const inbox = page.getByRole("button", { name: /待处理/ })
|
|
|
|
|
|
|
+ const inbox = page.getByRole("button", { name: "待处理 1 项", exact: true })
|
|
|
|
|
+ const panel = page.getByRole("dialog", { name: "待处理" })
|
|
|
await inbox.click()
|
|
await inbox.click()
|
|
|
- await expect(page.getByRole("dialog", { name: "待处理" })).toBeVisible()
|
|
|
|
|
|
|
+ await expect(panel).toBeVisible()
|
|
|
|
|
+ await page.getByRole("textbox", { name: "消息", exact: true }).focus()
|
|
|
await page.keyboard.press("Escape")
|
|
await page.keyboard.press("Escape")
|
|
|
- await expect(page.getByRole("dialog", { name: "待处理" })).toHaveCount(0)
|
|
|
|
|
|
|
+ await expect(panel).toBeVisible()
|
|
|
|
|
+ await inbox.focus()
|
|
|
|
|
+ await page.keyboard.press("Escape")
|
|
|
|
|
+ await expect(panel).toHaveCount(0)
|
|
|
await expect(inbox).toBeFocused()
|
|
await expect(inbox).toBeFocused()
|
|
|
|
|
+ await inbox.click()
|
|
|
|
|
+ await expect(panel).toBeVisible()
|
|
|
|
|
+ await page.locator(".paas-conversation").click({ position: { x: 8, y: 8 } })
|
|
|
|
|
+ await expect(panel).toHaveCount(0)
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
|
|
+test("opening an approval keeps it listed in inbox", async ({ page }) => {
|
|
|
|
|
+ await page.goto("/e2e/paas/index.html")
|
|
|
|
|
+ await page.getByLabel("API Key", { exact: true }).fill("inbox-approval")
|
|
|
|
|
+ await page.getByRole("button", { name: "连接平台", exact: true }).click()
|
|
|
|
|
+ await page
|
|
|
|
|
+ .getByRole("button", { name: /已有研究/ })
|
|
|
|
|
+ .first()
|
|
|
|
|
+ .click()
|
|
|
|
|
+ await page.getByRole("button", { name: "待处理 1 项", exact: true }).click()
|
|
|
|
|
+ const panel = page.getByRole("dialog", { name: "待处理" })
|
|
|
|
|
+ await panel.getByRole("button", { name: /已有研究/ }).click()
|
|
|
|
|
+ await expect(page.getByRole("heading", { name: "研究计划", exact: true })).toBeVisible()
|
|
|
|
|
+ await expect(page.getByRole("dialog", { name: "待处理" })).toHaveCount(0)
|
|
|
|
|
+ await expect(page.getByRole("button", { name: "待处理 1 项", exact: true })).toBeVisible()
|
|
|
})
|
|
})
|