| 1234567891011121314151617181920212223242526272829303132333435363738 |
- import { expect, test } from "@playwright/test"
- for (const theme of ["light", "dark"] as const) {
- test(`hidden scrollbars retain editor wheel access in ${theme}`, async ({ page }) => {
- await page.setViewportSize({ width: 1100, height: 520 })
- await page.emulateMedia({ colorScheme: theme })
- await page.goto("/e2e/paas/index.html?ux")
- await page.getByLabel("API Key", { exact: true }).fill("scrolling-fixture")
- await page.getByRole("button", { name: "连接平台", exact: true }).click()
- const agents = page.getByRole("button", { name: "智能体", exact: true })
- if (!(await agents.isVisible())) await page.getByRole("button", { name: "打开导航", exact: true }).click()
- await agents.click()
- await page.getByRole("button", { name: "编辑 λ-Scientist 科研助手", exact: true }).click()
- const viewport = page.locator(".paas-edit-scroll")
- await expect(viewport).toBeVisible()
- expect(await viewport.evaluate((element) => getComputedStyle(element).scrollbarWidth)).toBe("none")
- await viewport.hover()
- await page.mouse.wheel(0, 480)
- await expect.poll(() => viewport.evaluate((element) => element.scrollTop)).toBeGreaterThan(0)
- await expect(page.getByRole("button", { name: "保存修改", exact: true })).toBeInViewport()
- })
- test(`hidden dialog scrollbars retain keyboard access in ${theme}`, async ({ page }) => {
- await page.setViewportSize({ width: 900, height: 520 })
- await page.emulateMedia({ colorScheme: theme })
- await page.goto("/e2e/paas/index.html?ux&agent-groups")
- await page.getByLabel("API Key", { exact: true }).fill("scrolling-fixture")
- await page.getByRole("button", { name: "连接平台", exact: true }).click()
- await page.getByRole("button", { name: "选择执行角色", exact: true }).click()
- const list = page.getByRole("listbox", { name: "执行角色" })
- await expect(list).toHaveCSS("scrollbar-width", "none")
- await expect(list.getByRole("option", { name: /^自动匹配/ })).toBeFocused()
- await page.keyboard.press("End")
- await expect(list.getByRole("option").last()).toBeFocused()
- await expect(list.getByRole("option").last()).toBeInViewport({ ratio: 1 })
- await page.screenshot({ path: `/private/tmp/hidden-scrollbars-${theme}.png` })
- })
- }
|