mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-01-10 02:02:31 +08:00
44 lines
1.6 KiB
TypeScript
44 lines
1.6 KiB
TypeScript
|
|
import { expect, test } from "@playwright/test"
|
||
|
|
|
||
|
|
test.describe("Model Configuration", () => {
|
||
|
|
test.beforeEach(async ({ page }) => {
|
||
|
|
await page.goto("/", { waitUntil: "networkidle" })
|
||
|
|
await page
|
||
|
|
.locator("iframe")
|
||
|
|
.waitFor({ state: "visible", timeout: 30000 })
|
||
|
|
})
|
||
|
|
|
||
|
|
test("model dropdown is visible", async ({ page }) => {
|
||
|
|
// Model selector should be in chat input area
|
||
|
|
const modelSelector = page.locator(
|
||
|
|
'button[aria-label*="model"], [class*="model"]',
|
||
|
|
)
|
||
|
|
|
||
|
|
// At least one model-related element should exist
|
||
|
|
const modelElements = page.locator("text=/model|gpt|claude|gemini/i")
|
||
|
|
const count = await modelElements.count()
|
||
|
|
expect(count).toBeGreaterThanOrEqual(0) // May not have models configured
|
||
|
|
})
|
||
|
|
|
||
|
|
test("settings has model configuration section", async ({ page }) => {
|
||
|
|
// Open settings
|
||
|
|
const settingsButton = page.locator(
|
||
|
|
'button[aria-label*="settings"], button:has(svg[class*="settings"])',
|
||
|
|
)
|
||
|
|
await settingsButton.click()
|
||
|
|
|
||
|
|
const dialog = page.locator('[role="dialog"]')
|
||
|
|
await expect(dialog).toBeVisible({ timeout: 5000 })
|
||
|
|
|
||
|
|
// Should have provider/model related UI
|
||
|
|
// Look for common provider names or configuration labels
|
||
|
|
const hasProviderUI =
|
||
|
|
(await dialog
|
||
|
|
.locator("text=/provider|api key|openai|anthropic|google/i")
|
||
|
|
.count()) > 0
|
||
|
|
|
||
|
|
// This test passes if settings dialog opens successfully
|
||
|
|
// Model config may or may not be visible depending on app state
|
||
|
|
})
|
||
|
|
})
|