"""The AI curator 'Model' field is a real dropdown that lists the provider being edited.""" from __future__ import annotations import os import pytest from playwright.sync_api import Page, expect from tests.e2e.conftest import ShortlistApp pytestmark = pytest.mark.e2e LOAD = 20_000 # What each provider "offers" — the stub keys off provider so switching providers changes the list. MODELS_BY_PROVIDER = { "anthropic": ["claude-haiku-4-5", "claude-sonnet-5"], "google": ["gemini-2.5-flash", "gemini-2.5-pro"], } def _stub_models(monkeypatch) -> None: from types import SimpleNamespace def fake_make(provider, **_kw): return SimpleNamespace(list_models=lambda: MODELS_BY_PROVIDER.get(provider, [])) monkeypatch.setattr("shortlist.engine.curator.make_curator", fake_make) def test_curator_model_field_is_a_real_dropdown(page: Page, app: ShortlistApp, monkeypatch) -> None: app.api("PUT", "/api/settings", json={"values": {"curator.provider": "anthropic", "curator.api_key": "sk-fake"}}) _stub_models(monkeypatch) page.goto("/settings") card = page.get_by_test_id("connection-llm") expect(card).to_be_visible(timeout=LOAD) card.get_by_role("button", name="Edit").click() # The Model field is a native