test(mock-llm): add LLM profile lifecycle + folder→workspace E2E tests#946
test(mock-llm): add LLM profile lifecycle + folder→workspace E2E tests#946malhotra5 wants to merge 6 commits into
Conversation
Cover the core LLM profiles lifecycle with 8 snapshot tests: 1. Empty state — no profiles, shows Add button 2. Profile list — 3 seeded profiles with active badge 3. Create form (blank) — empty name + LLM fields 4. Create form (filled) — name + model + API key, Save enabled 5. Delete modal — confirmation dialog 6. Rename active — badge follows the renamed profile 7. Delete active — no active badge remains after deletion 8. Activate — badge moves to the newly activated profile Profiles are seeded via fetch calls intercepted by MSW's service worker (settings-handlers.ts has full CRUD + activate handlers). Closes part of #511 (LLM Profiles section). Co-authored-by: openhands <openhands@all-hands.dev>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Replace snapshot tests with proper mock-LLM E2E tests that run against the real agent-server. 4 serial steps cover the full profile lifecycle: 1. Create two profiles via UI, verify they appear in list + via API 2. Activate profile-beta, verify badge moves + API confirms active_profile 3. Rename the active profile, verify badge follows the new name + old name gone + API reflects new name 4. Delete the active profile, verify no badge remains + API returns active_profile: null Each step includes both UI assertions and API verification to confirm the agent-server persisted the expected state. Closes part of #511 (LLM Profiles section). Co-authored-by: openhands <openhands@all-hands.dev>
❌ Mock-LLM E2E Tests7/11 passed · 1 failed · 3 skipped Commit:
🔍 Failure details (1)❌ mock-llm-profiles.spec.ts › mock-LLM profile lifecycle › step 1: create two LLM profiles and verify they appear in the listPosted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses) |
❌ Mock-LLM E2E Tests7/11 passed · 1 failed · 3 skipped Commit:
🔍 Failure details (1)❌ mock-llm-profiles.spec.ts › mock-LLM profile lifecycle › step 1: create two LLM profiles and verify they appear in the listPosted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses) |
❌ Mock-LLM E2E Tests7/11 passed · 1 failed · 3 skipped Commit:
🔍 Failure details (1)❌ mock-llm-profiles.spec.ts › mock-LLM profile lifecycle › step 1: create two LLM profiles and verify they appear in the listPosted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses) |
… config
The profiles test's cleanupProfiles() only deleted named profiles via
DELETE /api/profiles/{name}. The automation test's ensureMockLLMProfile()
PATCHes /api/settings with agent_settings_diff.llm.*, which persists LLM
config at the settings layer. After deleting named profiles, the server
may still surface a "default" profile derived from those lingering
settings, causing the 'verify empty state' assertion to find 1 profile
instead of 0.
Fix:
- Also PATCH /api/settings to clear LLM model/api_key/base_url after
deleting named profiles
- Add diagnostic logging for non-OK API responses instead of silently
swallowing errors
- Add a verification step that re-fetches profiles after cleanup and
warns if any remain
- Increase empty-state assertion timeout to 10s for slower CI
Co-authored-by: openhands <openhands@all-hands.dev>
Mock-LLM E2E Fix — Profile CleanupThe failing Root CauseThe The old cleanup also silently swallowed all errors ( Fix (dae3e75)
Open questionIf the settings-level reset via This comment was generated by an AI agent (OpenHands). |
Confirmed:
|
❌ Mock-LLM E2E Tests7/11 passed · 1 failed · 3 skipped Commit:
🔍 Failure details (1)❌ mock-llm-profiles.spec.ts › mock-LLM profile lifecycle › step 1: create two LLM profiles and verify they appear in the listPosted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses) |
Exercise the full flow: open folder browser → navigate to a test directory → 'Use this folder' → select in dropdown → confirm → type message → submit → verify POST /api/conversations payload has correct workspace.working_dir → verify selected_workspace persisted in localStorage. Covers two 'I can' statements from #511: - 'I can browse local files and folders to choose where to begin' - 'I can start a conversation against a local Git repo without typing the path' The test creates /tmp/e2e-folder-workspace-test/my-test-project before running and cleans it up after. The folder browser navigates the real filesystem served by the agent-server's /api/file/ endpoints. Co-authored-by: openhands <openhands@all-hands.dev>
❌ Mock-LLM E2E Tests7/12 passed · 2 failed · 3 skipped Commit:
🔍 Failure details (2)⏱️ mock-llm-folder-workspace.spec.ts › mock-LLM folder browser → workspace → conversation › step 1: browse to a folder, add it as a workspace, and launch a conversation with the correct working_dir❌ mock-llm-profiles.spec.ts › mock-LLM profile lifecycle › step 1: create two LLM profiles and verify they appear in the listPosted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses) |
📸 Snapshot Test Report✅ All snapshots match the main branch baselines.
✅ Unchanged snapshots (73)
Generated by the Snapshot Tests workflow. This comment was created by an AI agent (OpenHands) on behalf of the repo maintainers. |
Why
Issue #511 identifies multiple fully-implemented features with zero test coverage. This PR adds mock-LLM E2E tests that exercise two coverage areas against the real agent-server.
Summary
1. LLM Profile lifecycle (
mock-llm-profiles.spec.ts) — 4 serial testsGET /api/profilesconfirms server-sideactive_profile === "profile-beta"active_profileactive_profile: null2. Folder browser → workspace → conversation (
mock-llm-folder-workspace.spec.ts) — 1 testCovers two "I can" statements:
Flow: Open folder browser → navigate
/tmp/e2e-folder-workspace-test/my-test-projectvia real filesystem → "Use this folder" → select in dropdown → confirm → type message → submit → verify:POST /api/conversationspayload hasworkspace.working_dir === "/tmp/e2e-folder-workspace-test/my-test-project"selected_workspacepersisted in localStorage under the conversation metadata keyIssue Number
#511
How to Test
npm run build:app # if build/ is missing npm run test:e2e:mock-llmType
This PR was created by an AI agent (OpenHands) on behalf of the user.
🐳 Docker images for this PR
• GHCR package: https://github.com/OpenHands/agent-canvas/pkgs/container/agent-canvas
ghcr.io/openhands/agent-canvasghcr.io/openhands/agent-server:1.24.0-pythonopenhands-automation==1.0.0a51f5784c11ece56e23873f6bb85a5a9a8fd065faaPull (multi-arch manifest)
# Multi-arch manifest — Docker automatically pulls the correct architecture docker pull ghcr.io/openhands/agent-canvas:sha-1f5784cRun
All tags pushed for this build
About Multi-Architecture Support
sha-1f5784c) is a multi-arch manifest supporting both amd64 and arm64sha-1f5784c-amd64) are also available if needed