Files
next-ai-draw-io/tests/e2e/settings.spec.ts
T
dayuan.jiang 69fb66804d feat(settings): reorganize the settings dialog and the model settings
Tabs Models, General, Drawing and About, each with a fixed title row.

The models tab becomes three pages: the user's providers with one status
each and the server's models; a searchable picker of all 24 providers in
four groups; and a provider page in three steps (connection, models,
test). A new provider gets its first suggested model, and a passing test
offers to use the model in the chat. Bedrock asks for one way of signing
in, with an optional session token for temporary access keys.

The composer's model picker lists every model, marking untested and
failed ones, and can open the provider picker. A chat error that offers
model settings opens the provider the request went to.
2026-10-08 17:44:08 +09:00

58 lines
1.8 KiB
TypeScript

import {
expect,
getIframe,
openSettings,
openSettingsTab,
test,
} from "./lib/fixtures"
test.describe("Settings", () => {
test.beforeEach(async ({ page }) => {
await page.goto("/", { waitUntil: "networkidle" })
await getIframe(page).waitFor({ state: "visible", timeout: 30000 })
})
test("settings dialog opens", async ({ page }) => {
await openSettings(page)
// openSettings already verifies dialog is visible
})
test("language selection is available", async ({ page }) => {
await openSettingsTab(page, "general")
const dialog = page.locator('[role="dialog"]')
await expect(dialog.locator("#language-select")).toHaveText(/English/)
})
test("max output tokens is editable and persists", async ({ page }) => {
await openSettingsTab(page, "drawing")
const input = page.locator("#max-output-tokens")
await expect(input).toBeVisible()
await input.fill("48000")
await expect
.poll(() =>
page.evaluate(() =>
localStorage.getItem("next-ai-draw-io-max-output-tokens"),
),
)
.toBe("48000")
// Non-digits are dropped so the header always carries a plain number
await input.fill("12k000")
await expect(input).toHaveValue("12000")
})
test("theme can be light, dark or follow the system", async ({ page }) => {
await openSettingsTab(page, "general")
const dialog = page.locator('[role="dialog"]')
for (const name of ["Light", "Dark", "System"]) {
await expect(dialog.getByRole("radio", { name })).toBeVisible()
}
await dialog.getByRole("radio", { name: "Dark" }).click()
await expect(page.locator("html")).toHaveClass(/dark/)
})
})