openpencil/tests/e2e/chat/profiles.spec.ts
Danila Poyarkov d7971ff03b
fix(ai): reach the custom model option and update stale chat specs (#719)
* fix(ai): keep the custom model option reachable

The model picker appends its custom entry last, but the combobox renders
only the first hundred rows until the user types. Providers with large
catalogs, such as OpenRouter, pushed the entry past that cap, so a custom
model ID was only discoverable by guessing that a search for "custom"
would reveal it.

Place the custom entry after the curated recommendations, ahead of the
long tail, and give its group a label without the ellipsis that belongs to
the option text.

* fix(ui): stop pinning combobox group labels

Pinned labels sit inside the scroll container's padding, so a scrolled row
stayed visible as a clipped sliver above the label. Group labels now
scroll with their rows.

* test(chat): update specs for the current settings UI

The credential persistence assertions pointed at test ids that moved to
General settings and are covered by the credentials spec, the model editor
returns through Cancel rather than Back, and the API-key link is an anchor
whose href can be asserted directly instead of stubbing window.open.

* docs: note the custom model picker fix

* test(chat): assert the provider key page URL
2026-09-17 16:34:08 +03:00

37 lines
1.6 KiB
TypeScript

import { expect, test } from '#tests/helpers/chat/fixture'
test('Design profile selector exposes provider and capabilities', async ({
configuredChat: chat
}) => {
await chat.profileTrigger.click()
await expect(chat.page.getByText('Design agent', { exact: true })).toBeVisible()
await expect(chat.page.getByRole('option', { name: /Claude Sonnet/ })).toContainText('OpenRouter')
await expect(chat.page.getByLabel('Supports image input')).toBeVisible()
await expect(chat.page.getByRole('button', { name: 'Manage models and roles…' })).toBeVisible()
})
test('OpenRouter accepts a custom model ID from Settings', async ({ configuredChat: chat }) => {
const customModel = 'meta-llama/llama-3.3-70b-instruct'
await chat.page.getByTestId('provider-settings-trigger').click()
await chat.page.locator('[data-model-id]').first().click()
await chat.page.getByLabel('Model ID').click()
await chat.page.getByRole('option', { name: 'Custom model…' }).click()
const input = chat.page.getByTestId('provider-settings-custom-model')
await input.fill(customModel)
await chat.page.getByRole('button', { name: 'Save model' }).click()
await chat.page.getByTestId('app-settings-done').click()
await expect(chat.profileTrigger).toContainText('Claude Sonnet')
})
test('Get API key links to the provider key page', async ({ configuredChat: chat }) => {
await chat.page.getByTestId('provider-settings-trigger').click()
await chat.page.locator('[data-model-id]').first().click()
await expect(chat.page.getByRole('link', { name: 'Get API key' })).toHaveAttribute(
'href',
'https://openrouter.ai/keys'
)
})