mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-01-07 00:32:28 +08:00
- Add tests/e2e/lib/fixtures.ts with shared test helpers - Add tests/e2e/fixtures/diagrams.ts with XML test data - Add expectBeforeAndAfterReload() helper for persistence tests - Add test.step() for better test reporting in complex tests - Consolidate mock helpers into fixtures module - Reduce code duplication across 17 test files
27 lines
923 B
TypeScript
27 lines
923 B
TypeScript
import { expect, getIframe, openSettings, test } from "./lib/fixtures"
|
|
|
|
test.describe("Keyboard Interactions", () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
await page.goto("/", { waitUntil: "networkidle" })
|
|
await getIframe(page).waitFor({ state: "visible", timeout: 30000 })
|
|
})
|
|
|
|
test("Escape closes settings dialog", async ({ page }) => {
|
|
await openSettings(page)
|
|
|
|
const dialog = page.locator('[role="dialog"]')
|
|
await expect(dialog).toBeVisible({ timeout: 5000 })
|
|
|
|
await page.keyboard.press("Escape")
|
|
await expect(dialog).not.toBeVisible({ timeout: 2000 })
|
|
})
|
|
|
|
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)
|
|
})
|
|
})
|