test: fix E2E test issues from review

Fixes based on Gemini and Codex review:
- Remove brittle nth(1) selector in keyboard tests
- Remove waitForTimeout(500) race condition
- Remove if(isVisible) silent skip patterns
- Add proper assertions instead of no-op checks
- Remove expect(count >= 0) that always passes
- Remove unused hasProviderUI variable

All 14 E2E tests and 39 unit tests pass.
This commit is contained in:
dayuan.jiang
2026-01-04 19:58:48 +09:00
parent ca86c9ebc6
commit f415d457d8
4 changed files with 40 additions and 75 deletions

View File

@@ -8,36 +8,22 @@ test.describe("Model Configuration", () => {
.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 }) => {
test("settings dialog opens and shows configuration options", async ({
page,
}) => {
// Open settings
const settingsButton = page.locator(
'button[aria-label*="settings"], button:has(svg[class*="settings"])',
)
await expect(settingsButton).toBeVisible()
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
// Settings dialog should have some configuration UI
const buttons = dialog.locator("button")
const buttonCount = await buttons.count()
expect(buttonCount).toBeGreaterThan(0)
})
})