Files
next-ai-draw-io/tests/e2e/smoke.spec.ts
dayuan.jiang d517268dbe fix: improve test infrastructure based on PR review
- 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
2026-01-04 22:25:50 +09:00

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,
})
})
})