mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-01-11 02:28:30 +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,4 +1,4 @@
|
||||
import { expect, test } from "@playwright/test"
|
||||
import { expect, getIframe, openSettings, test } from "./lib/fixtures"
|
||||
|
||||
test.describe("Smoke Tests", () => {
|
||||
test("homepage loads without errors", async ({ page }) => {
|
||||
@@ -8,8 +8,7 @@ test.describe("Smoke Tests", () => {
|
||||
await page.goto("/", { waitUntil: "networkidle" })
|
||||
await expect(page).toHaveTitle(/Draw\.io/i, { timeout: 10000 })
|
||||
|
||||
// Wait for draw.io iframe to be present
|
||||
const iframe = page.locator("iframe")
|
||||
const iframe = getIframe(page)
|
||||
await expect(iframe).toBeVisible({ timeout: 30000 })
|
||||
|
||||
expect(errors).toEqual([])
|
||||
@@ -22,7 +21,7 @@ test.describe("Smoke Tests", () => {
|
||||
await page.goto("/ja", { waitUntil: "networkidle" })
|
||||
await expect(page).toHaveTitle(/Draw\.io/i, { timeout: 10000 })
|
||||
|
||||
const iframe = page.locator("iframe")
|
||||
const iframe = getIframe(page)
|
||||
await expect(iframe).toBeVisible({ timeout: 30000 })
|
||||
|
||||
expect(errors).toEqual([])
|
||||
@@ -30,20 +29,8 @@ test.describe("Smoke Tests", () => {
|
||||
|
||||
test("settings dialog opens", async ({ page }) => {
|
||||
await page.goto("/", { waitUntil: "networkidle" })
|
||||
await getIframe(page).waitFor({ state: "visible", timeout: 30000 })
|
||||
|
||||
// Wait for page to load
|
||||
await page
|
||||
.locator("iframe")
|
||||
.waitFor({ state: "visible", timeout: 30000 })
|
||||
|
||||
// Click settings button (gear icon)
|
||||
const settingsButton = page.locator('[data-testid="settings-button"]')
|
||||
await expect(settingsButton).toBeVisible()
|
||||
await settingsButton.click()
|
||||
|
||||
// Check if settings dialog appears
|
||||
await expect(page.locator('[role="dialog"]')).toBeVisible({
|
||||
timeout: 5000,
|
||||
})
|
||||
await openSettings(page)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user