mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-01-11 18:48:36 +08:00
refactor: add shared fixtures and test.step() patterns
- 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
This commit is contained in:
@@ -1,25 +1,21 @@
|
||||
import { expect, test } from "@playwright/test"
|
||||
import { expect, getIframe, test } from "./lib/fixtures"
|
||||
|
||||
test.describe("Chat Panel", () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto("/", { waitUntil: "networkidle" })
|
||||
await page
|
||||
.locator("iframe")
|
||||
.waitFor({ state: "visible", timeout: 30000 })
|
||||
await getIframe(page).waitFor({ state: "visible", timeout: 30000 })
|
||||
})
|
||||
|
||||
test("page has interactive elements", async ({ page }) => {
|
||||
// Verify buttons exist (settings, etc.)
|
||||
const buttons = page.locator("button")
|
||||
const count = await buttons.count()
|
||||
expect(count).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
test("draw.io iframe is interactive", async ({ page }) => {
|
||||
const iframe = page.locator("iframe")
|
||||
const iframe = getIframe(page)
|
||||
await expect(iframe).toBeVisible()
|
||||
|
||||
// Iframe should have loaded draw.io
|
||||
const src = await iframe.getAttribute("src")
|
||||
expect(src).toBeTruthy()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user