mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-01-10 18:22:29 +08:00
- Fix double build in CI: remove redundant build from playwright webServer - Export chat helpers from shared module for proper unit testing - Replace waitForTimeout with explicit waits in E2E tests - Add data-testid attributes to settings and new chat buttons - Add list reporter for CI to show failures in logs - Add Playwright browser caching to speed up CI - Add vitest coverage configuration - Fix conditional test assertions to use test.skip() instead of silent pass - Remove unused variables flagged by linter
50 lines
1.6 KiB
TypeScript
50 lines
1.6 KiB
TypeScript
import { expect, test } from "@playwright/test"
|
|
|
|
test.describe("Smoke Tests", () => {
|
|
test("homepage loads without errors", async ({ page }) => {
|
|
const errors: string[] = []
|
|
page.on("pageerror", (err) => errors.push(err.message))
|
|
|
|
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")
|
|
await expect(iframe).toBeVisible({ timeout: 30000 })
|
|
|
|
expect(errors).toEqual([])
|
|
})
|
|
|
|
test("Japanese locale page loads", async ({ page }) => {
|
|
const errors: string[] = []
|
|
page.on("pageerror", (err) => errors.push(err.message))
|
|
|
|
await page.goto("/ja", { waitUntil: "networkidle" })
|
|
await expect(page).toHaveTitle(/Draw\.io/i, { timeout: 10000 })
|
|
|
|
const iframe = page.locator("iframe")
|
|
await expect(iframe).toBeVisible({ timeout: 30000 })
|
|
|
|
expect(errors).toEqual([])
|
|
})
|
|
|
|
test("settings dialog opens", async ({ page }) => {
|
|
await page.goto("/", { waitUntil: "networkidle" })
|
|
|
|
// 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,
|
|
})
|
|
})
|
|
})
|