[Test] UI - Models: Add E2E tests for Add Model flow#25590
[Test] UI - Models: Add E2E tests for Add Model flow#25590yuneng-berri merged 4 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryAdds four Playwright E2E tests for the Add Model flow (connection failure, adding a specific model, adding a wildcard route, verifying results in the All Models table) and instruments the relevant UI components with
Confidence Score: 5/5Safe to merge — production code changes are purely additive data-testid annotations, all findings are P2 style suggestions. All five changed files either add ui/litellm-dashboard/e2e_tests/tests/modelsPage/addModel.spec.ts — minor type-safety and timing robustness improvements suggested.
|
| Filename | Overview |
|---|---|
| ui/litellm-dashboard/e2e_tests/tests/modelsPage/addModel.spec.ts | New E2E test file covering four Add Model scenarios; minor type-safety gap (page: any) and fixed waitForTimeout delays that could slow CI; one test explicitly depends on outbound internet access to Anthropic. |
| ui/litellm-dashboard/src/app/(dashboard)/models-and-endpoints/components/AllModelsTab.tsx | Adds data-testid="model-search-input" and data-testid="models-results-count" attributes to support stable test selectors; no logic changes. |
| ui/litellm-dashboard/src/components/add_model/AddModelForm.tsx | Adds data-testid attributes to "Test Connect" and "Add Model" buttons; no logic changes. |
| ui/litellm-dashboard/src/components/add_model/litellm_model_name.tsx | Adds data-testid="model-name-select" to the model multi-select; no logic changes. |
| ui/litellm-dashboard/src/components/add_model/model_connection_test.tsx | Adds data-testid attributes to the connection success and failure text nodes; no logic changes. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Navigate to Models Page] --> B[Click 'Add Model' tab]
B --> C[selectProvider helper\nfill + Enter + waitForTimeout]
C --> D{Test scenario}
D -->|Test Connection| E[Select model & enter bad key]
E --> F[Click 'Test Connect' button]
F --> G[LiteLLM Proxy calls\nexternal API with bad key]
G --> H[UI shows 'Connection Test Results' modal]
H --> I{API response}
I -->|401 from Anthropic| J[✅ 'Connection to X failed' visible]
D -->|Add Specific Model| K[Select claude-haiku-4-5\nenter API key]
K --> L[Click 'Add Model' button]
L --> M[POST /model/new]
M --> N[✅ 'created successfully' toast]
N --> O[Navigate to 'All Models' tab]
O --> P[Search 'claude-haiku-4-5']
P --> Q[✅ Results count > 0 & model in table]
D -->|Add Wildcard Route| R[Select 'All Cohere Models Wildcard'\nenter API key]
R --> S[Click 'Add Model' button]
S --> T[✅ 'created successfully' toast]
T --> U[Search 'cohere' in All Models]
U --> V[✅ 'cohere/' appears in table]
Reviews (5): Last reviewed commit: "remove unnecessary cleanup helper" | Re-trigger Greptile
Add E2E tests covering: - Test connection with bad credentials shows failure modal - Adding a specific model and verifying it appears in All Models table - Adding a wildcard route and verifying it appears in All Models table - Verifying model dropdown shows provider-specific models (existing test updated) Added data-testid attributes to UI components to support stable test selectors. Tests verified passing 3/3 consecutive runs with zero flakiness.
Add cleanup helper to delete models created during tests, preventing stale data accumulation across repeated test runs.
The data-testid attributes added to React components are not present in the CI-built UI output. Switch to using getByRole and getByText selectors which work with the rendered DOM regardless of build cache.
The database is freshly seeded on every test run via seed.sql, so per-test cleanup is not needed.
5c80cd8 to
9b74ff3
Compare
Summary
Adds E2E tests for the Add Model page covering test connection failure, adding specific models, adding wildcard routes, and verifying models appear in the All Models table. Added
data-testidattributes to support stable test selectors.Testing
All 4 tests pass 3/3 consecutive runs with zero flakiness.
Type
✅ Test