2026-01-05 00:37:40 +09:00
|
|
|
import { expect, getIframe, openSettings, test } from "./lib/fixtures"
|
2026-01-04 19:46:37 +09:00
|
|
|
|
|
|
|
|
test.describe("Keyboard Interactions", () => {
|
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
|
|
|
await page.goto("/", { waitUntil: "networkidle" })
|
2026-01-05 00:37:40 +09:00
|
|
|
await getIframe(page).waitFor({ state: "visible", timeout: 30000 })
|
2026-01-04 19:46:37 +09:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test("Escape closes settings dialog", async ({ page }) => {
|
2026-01-05 00:37:40 +09:00
|
|
|
await openSettings(page)
|
2026-01-04 19:46:37 +09:00
|
|
|
|
2026-01-04 19:58:48 +09:00
|
|
|
const dialog = page.locator('[role="dialog"]')
|
|
|
|
|
await expect(dialog).toBeVisible({ timeout: 5000 })
|
2026-01-04 19:46:37 +09:00
|
|
|
|
2026-01-04 19:58:48 +09:00
|
|
|
await page.keyboard.press("Escape")
|
|
|
|
|
await expect(dialog).not.toBeVisible({ timeout: 2000 })
|
2026-01-04 19:46:37 +09:00
|
|
|
})
|
|
|
|
|
|
2026-01-04 19:58:48 +09:00
|
|
|
test("page is keyboard accessible", async ({ page }) => {
|
|
|
|
|
const focusableElements = page.locator(
|
|
|
|
|
'button, [tabindex="0"], input, textarea, a[href]',
|
|
|
|
|
)
|
|
|
|
|
const count = await focusableElements.count()
|
|
|
|
|
expect(count).toBeGreaterThan(0)
|
2026-01-04 19:46:37 +09:00
|
|
|
})
|
|
|
|
|
})
|