Skip to content

πŸ™Œ OpenHands: AI-Driven Development

test: add snapshot coverage for Automations, MCP, and Skills pages (#436) (#438)

Rohit Malhotra15363865b7a5
diff --git a/AGENTS.md b/AGENTS.md
index 371633c11d..a95cd7f7e2 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -35,6 +35,7 @@
- Snapshots are organized by `{snapshotDir}/{testFilePath}/{projectName}/{arg}.png` (configured in `playwright.config.ts`).
- **Conversation page snapshot tests**: The dev server uses MSW service workers for API mocking. For conversation-page tests, rely on MSW's pre-defined mock conversations (IDs "1", "2", "3" in `src/mocks/conversation-handlers.ts`) rather than fighting Playwright route interception. MSW's service worker intercepts requests before Playwright `page.route()` can; Playwright route interceptors only see requests that escape the service worker. Stub WebSocket via `page.addInitScript()` and inject events into the Zustand store via the exposed `window.__OH_EVENT_STORE__` API. Use `test.describe.configure({ mode: "serial" })` for conversation tests since the WebSocket stub + heavier page setup can cause intermittent failures in parallel mode.
- **Baseline generation for CI**: Baselines generated locally will NOT match CI (different OS, fonts, rendering). Always regenerate baselines in CI after adding new snapshot tests: trigger the "Snapshot Tests" workflow manually with `update_snapshots=true`. The workflow commits updated baselines with `[skip ci]`, so push an empty commit afterward to trigger a fresh CI run that validates against the new baselines.
+- **MSW handler state is PAGE-level JS, not service-worker state**: In MSW 2.x browser mode the request handlers (including mutable Maps like `automations`) are compiled into the client bundle and run in the main thread. `page.reload()` re-initialises all module-level state (e.g. `const automations = new Map(...)` runs fresh on every page load). Tests that need to show an "empty list" state must NOT call `page.reload()` after deleting items. Instead: make the DELETE fetches from `page.evaluate()` (which DO go through MSW), then call `window.__TEST_INVALIDATE_QUERIES__()` (exposed in mock mode by `entry.client.tsx`) to trigger React Query's cache invalidation in-place without a reload. Example: the automations empty-state snapshot test in `tests/e2e/snapshots/automations.snapshot.spec.ts`.
## Live End-to-End Test Framework
diff --git a/src/entry.client.tsx b/src/entry.client.tsx
index a72c607ded..3b2dc09737 100644
--- a/src/entry.client.tsx
+++ b/src/entry.client.tsx
@@ -23,6 +23,19 @@ async function prepareApp() {
await worker.start({
onUnhandledRequest: "bypass",
});
+
+ // Expose a lightweight test helper so Playwright snapshot specs can
+ // trigger React Query refetches without a full page.reload() β€” a reload
+ // would re-initialize MSW handler state (e.g. the automations Map) back
+ // to its seed values, making it impossible to test empty-list UI states.
+ const { queryClient } = await import("./query-client-config");
+ (
+ window as Window &
+ typeof globalThis & {
+ __TEST_INVALIDATE_QUERIES__: (queryKey?: unknown[]) => void;
+ }
+ ).__TEST_INVALIDATE_QUERIES__ = (queryKey?: unknown[]) =>
+ void queryClient.invalidateQueries(queryKey ? { queryKey } : undefined);
}
}
diff --git a/src/mocks/automation-handlers.ts b/src/mocks/automation-handlers.ts
index cbf28ae14b..2a83167a08 100644
--- a/src/mocks/automation-handlers.ts
+++ b/src/mocks/automation-handlers.ts
@@ -20,6 +20,12 @@ export const resetAutomationMockData = () => {
};
export const AUTOMATION_HANDLERS = [
+ // GET /api/automation/health β€” Health check
+ http.get("*/api/automation/health", async () => {
+ await delay(100);
+ return HttpResponse.json({ status: "ok" });
+ }),
+
// GET /api/automation/v1 β€” List automations
http.get("*/api/automation/v1", async ({ request }) => {
await delay(300);
diff --git a/tests/e2e/__snapshots__/snapshots/automations.snapshot.spec.ts/chromium/automations-delete-modal.png b/tests/e2e/__snapshots__/snapshots/automations.snapshot.spec.ts/chromium/automations-delete-modal.png
new file mode 100644
index 0000000000..3b4cb7f142
Binary files /dev/null and b/tests/e2e/__snapshots__/snapshots/automations.snapshot.spec.ts/chromium/automations-delete-modal.png differ
diff --git a/tests/e2e/__snapshots__/snapshots/automations.snapshot.spec.ts/chromium/automations-list-active-inactive.png b/tests/e2e/__snapshots__/snapshots/automations.snapshot.spec.ts/chromium/automations-list-active-inactive.png
new file mode 100644
index 0000000000..a4bdc39937
Binary files /dev/null and b/tests/e2e/__snapshots__/snapshots/automations.snapshot.spec.ts/chromium/automations-list-active-inactive.png differ
diff --git a/tests/e2e/__snapshots__/snapshots/automations.snapshot.spec.ts/chromium/automations-no-automations.png b/tests/e2e/__snapshots__/snapshots/automations.snapshot.spec.ts/chromium/automations-no-automations.png
new file mode 100644
index 0000000000..5dcf254ee9
Binary files /dev/null and b/tests/e2e/__snapshots__/snapshots/automations.snapshot.spec.ts/chromium/automations-no-automations.png differ
diff --git a/tests/e2e/__snapshots__/snapshots/automations.snapshot.spec.ts/chromium/automations-search-no-results.png b/tests/e2e/__snapshots__/snapshots/automations.snapshot.spec.ts/chromium/automations-search-no-results.png
new file mode 100644
index 0000000000..e00855658f
Binary files /dev/null and b/tests/e2e/__snapshots__/snapshots/automations.snapshot.spec.ts/chromium/automations-search-no-results.png differ
diff --git a/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-custom-server-1-editor-open.png b/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-custom-server-1-editor-open.png
new file mode 100644
index 0000000000..5330a8e7e6
Binary files /dev/null and b/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-custom-server-1-editor-open.png differ
diff --git a/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-custom-server-2-url-filled.png b/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-custom-server-2-url-filled.png
new file mode 100644
index 0000000000..7688b43262
Binary files /dev/null and b/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-custom-server-2-url-filled.png differ
diff --git a/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-custom-server-3-all-filled.png b/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-custom-server-3-all-filled.png
new file mode 100644
index 0000000000..352f271600
Binary files /dev/null and b/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-custom-server-3-all-filled.png differ
diff --git a/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-custom-server-4-installed.png b/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-custom-server-4-installed.png
new file mode 100644
index 0000000000..496b49d6ce
Binary files /dev/null and b/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-custom-server-4-installed.png differ
diff --git a/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-custom-server-editor.png b/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-custom-server-editor.png
new file mode 100644
index 0000000000..abdb989b39
Binary files /dev/null and b/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-custom-server-editor.png differ
diff --git a/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-empty-installed.png b/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-empty-installed.png
new file mode 100644
index 0000000000..e017dff27d
Binary files /dev/null and b/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-empty-installed.png differ
diff --git a/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-search-filtered.png b/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-search-filtered.png
new file mode 100644
index 0000000000..0b4c0b6e73
Binary files /dev/null and b/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-search-filtered.png differ
diff --git a/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-slack-install-1-marketplace.png b/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-slack-install-1-marketplace.png
new file mode 100644
index 0000000000..f3b8f78469
Binary files /dev/null and b/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-slack-install-1-marketplace.png differ
diff --git a/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-slack-install-2-modal.png b/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-slack-install-2-modal.png
new file mode 100644
index 0000000000..e4fc236bd7
Binary files /dev/null and b/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-slack-install-2-modal.png differ
diff --git a/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-slack-install-3-filled.png b/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-slack-install-3-filled.png
new file mode 100644
index 0000000000..42f8cd1643
Binary files /dev/null and b/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-slack-install-3-filled.png differ
diff --git a/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-slack-install-4-installed.png b/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-slack-install-4-installed.png
new file mode 100644
index 0000000000..716a374e05
Binary files /dev/null and b/tests/e2e/__snapshots__/snapshots/mcp-page.snapshot.spec.ts/chromium/mcp-slack-install-4-installed.png differ
diff --git a/tests/e2e/__snapshots__/snapshots/skills-page.snapshot.spec.ts/chromium/skills-empty.png b/tests/e2e/__snapshots__/snapshots/skills-page.snapshot.spec.ts/chromium/skills-empty.png
new file mode 100644
index 0000000000..cafe8fc24a
Binary files /dev/null and b/tests/e2e/__snapshots__/snapshots/skills-page.snapshot.spec.ts/chromium/skills-empty.png differ
diff --git a/tests/e2e/snapshots/COVERAGE_PLAN.md b/tests/e2e/snapshots/COVERAGE_PLAN.md
new file mode 100644
index 0000000000..f84db6547a
--- /dev/null
+++ b/tests/e2e/snapshots/COVERAGE_PLAN.md
@@ -0,0 +1,377 @@
+# Snapshot Test Coverage Plan
+
+Visual regression tests that should be added to this directory. Each proposed
+spec file maps to one feature area. Tests follow the existing patterns:
+`setupMocks` + `dismissConsentModal` for static pages; `navigateToConversation`
++ `injectEvents` / `window.__OH_EVENT_STORE__` for conversation-page scenarios;
+`animations: "disabled"` and `maxDiffPixelRatio: 0.01` on every
+`toHaveScreenshot()` call.
+
+Existing coverage is marked **βœ… done**. Everything else is proposed.
+
+---
+
+## 1. Home Screen
+
+**File:** `home-screen.snapshot.spec.ts`
+**Existing:** βœ… `home-screen.png` in `settings-page.snapshot.spec.ts`
+
+| Snapshot name | State to capture |
+|---|---|
+| `home-empty-no-workspace` | No workspaces stored, no recent conversations |
+| `home-with-workspace-selected` | One workspace selected in the dropdown |
+| `home-with-recent-conversations` | Recent conversations list populated (mock 2–3 entries) |
+| `home-workspace-dropdown-open` | Workspace dropdown expanded showing stored workspaces |
+| `home-folder-browser-modal` | `FolderBrowserModal` open with a mocked directory listing |
+| `home-manage-workspaces-modal` | `ManageWorkspacesModal` open with two workspaces listed |
+| `home-task-suggestions-loading` | Task suggestions skeleton (loading state) |
+| `home-task-suggestions-loaded` | Task suggestion cards visible |
+
+---
+
+## 2. Onboarding Modal
+
+**File:** `onboarding.snapshot.spec.ts`
+
+Mock `openhands-onboarded` absent from localStorage so the modal appears. Use
+`page.addInitScript` to clear the key. Step navigation is driven by clicking
+the "Next" / "Back" buttons between snapshots.
+
+| Snapshot name | State to capture |
+|---|---|
+| `onboarding-step-0-choose-agent` | Step 0 – agent cards; OpenHands selected, others "coming soon" |
+| `onboarding-step-1-check-backend-connecting` | Step 1 – backend form with status banner in connecting state |
+| `onboarding-step-1-check-backend-connected` | Step 1 – status banner green (mock `/server_info` 200) |
+| `onboarding-step-1-check-backend-error` | Step 1 – status banner red (mock `/server_info` 500) |
+| `onboarding-step-2-setup-llm` | Step 2 – LLM settings form embedded (basic view) |
+| `onboarding-step-3-say-hello` | Step 3 – pre-filled message input |
+| `onboarding-progress-bar-step-2` | Progress bar at step 2 (two segments completed) |
+
+---
+
+## 3. Settings Pages
+
+**File:** `settings.snapshot.spec.ts`
+**Existing:** βœ… `settings-page.png`, `settings-app-page.png` in `settings-page.snapshot.spec.ts`
+
+### LLM Settings
+| Snapshot name | State to capture |
+|---|---|
+| `settings-llm-basic-view` | Model picker + API key (no custom base URL) |
+| `settings-llm-basic-api-key-set` | API key field showing the "key set" icon |
+| `settings-llm-advanced-view` | "All settings" view: custom model string + base URL + API key |
+| `settings-llm-openhands-model-help` | OpenHands model selected β†’ help link visible below API key |
+| `settings-llm-profiles-list` | LLM profiles manager showing two profile rows |
+| `settings-llm-profiles-rename-modal` | Rename profile modal open |
+| `settings-llm-profiles-delete-modal` | Delete profile confirmation modal open |
+| `settings-llm-dirty-save-button` | Save button enabled after a field change |
+
+### Condenser Settings
+| Snapshot name | State to capture |
+|---|---|
+| `settings-condenser` | Schema-driven condenser form loaded |
+
+### Verification Settings
+| Snapshot name | State to capture |
+|---|---|
+| `settings-verification-confirmation-off` | Confirmation mode toggle off (security analyzer hidden) |
+| `settings-verification-confirmation-on` | Confirmation mode toggle on β†’ security analyzer dropdown visible |
+
+### App Settings
+| Snapshot name | State to capture |
+|---|---|
+| `settings-app-default` | βœ… Already captured as `settings-app-page.png`; keep as baseline |
+| `settings-app-dirty` | At least one field changed, Save button enabled |
+
+### Secrets Settings
+| Snapshot name | State to capture |
+|---|---|
+| `settings-secrets-empty` | No secrets, only the "Add New Secret" button |
+| `settings-secrets-list` | Three secrets listed in the table |
+| `settings-secrets-add-form` | Add-secret form open |
+| `settings-secrets-edit-form` | Edit-secret form open (secret name pre-populated) |
+| `settings-secrets-delete-confirm` | Confirmation modal open with secret name in text |
+
+### Settings Navigation
+| Snapshot name | State to capture |
+|---|---|
+| `settings-nav-llm-active` | Left nav with LLM link highlighted |
+| `settings-nav-secrets-active` | Left nav with Secrets link highlighted |
+
+---
+
+## 4. MCP Page
+
+**File:** `mcp-page.snapshot.spec.ts`
+
+| Snapshot name | State to capture |
+|---|---|
+| `mcp-page-empty` | No installed servers, full marketplace visible |
+| `mcp-page-with-installed` | Two installed servers (one SSE, one STDIO) in the installed section |
+| `mcp-marketplace-card-uninstalled` | A marketplace card in default state |
+| `mcp-marketplace-card-installed` | Same card showing "Installed" badge |
+| `mcp-search-filtered` | Search query "slack" – only matching cards visible |
+| `mcp-install-modal` | `InstallServerModal` open for a marketplace entry |
+| `mcp-custom-server-editor-sse` | Custom server editor showing SSE form |
+| `mcp-custom-server-editor-stdio` | Custom server editor showing stdio form |
+| `mcp-delete-confirm-modal` | Delete confirmation modal open |
+
+---
+
+## 5. Skills Page
+
+**File:** `skills-page.snapshot.spec.ts`
+
+| Snapshot name | State to capture |
+|---|---|
+| `skills-loading` | Skeleton pulse placeholders |
+| `skills-loaded` | 2-column grid with several skill cards (enabled + disabled) |
+| `skills-card-enabled` | Single enabled skill card (close-up via `getByTestId`) |
+| `skills-card-disabled` | Single disabled skill card |
+| `skills-search-filtered` | Search query applied, subset of cards visible |
+| `skills-no-match` | Search query returns zero results – "no match" message |
+| `skills-empty-from-server` | Server returns no skills – empty state text |
+
+---
+
+## 6. Automations
+
+**File:** `automations.snapshot.spec.ts`
+
+| Snapshot name | State to capture |
+|---|---|
+| `automations-loading` | Skeleton cards (health check in-flight) |
+| `automations-backend-not-configured` | `BackendNotConfigured` full-page state |
+| `automations-empty` | Backend healthy but zero automations |
+| `automations-list-active-inactive` | Active group (2 cards) + Inactive group (1 card) |
+| `automations-search-filtered` | Search narrows list to one card |
+| `automations-delete-modal` | Delete confirmation modal open over the list |
+| `automations-detail-active` | Detail page – active automation, all sections visible |
+| `automations-detail-activity-log` | Detail page – activity log section with run entries |
+
+---
+
+## 7. Backend Management
+
+**File:** `backends.snapshot.spec.ts`
+
+| Snapshot name | State to capture |
+|---|---|
+| `backend-selector-single` | Dropdown closed, one backend, green status dot |
+| `backend-selector-multiple` | Dropdown open, two backends with status dots |
+| `backend-selector-error-dot` | Dropdown open, one backend with red status dot |
+| `backend-add-modal` | `BackendFormModal` open in "add" mode |
+| `backend-edit-modal` | `BackendFormModal` open in "edit" mode, fields pre-filled |
+| `backend-manage-modal` | `ManageBackendsModal` listing two backends |
+| `backend-unavailable-recovery` | Full-screen recovery: "Manage Backends" modal over dark backdrop |
+| `environment-switch-overlay` | `EnvironmentSwitchOverlay` visible during backend switch |
+
+---
+
+## 8. Analytics Consent Modal
+
+**File:** `settings-page.snapshot.spec.ts` (already exists)
+**Existing:** βœ… `analytics-consent-modal.png`
+
+No new snapshots needed; keep existing baseline.
+
+---
+
+## 9. Conversation Page – Happy Path
+
+**File:** `conversation-happy-path.snapshot.spec.ts`
+
+All tests use `navigateToConversation` + `injectEvents` via
+`window.__OH_EVENT_STORE__`. Use serial mode.
+
+| Snapshot name | State to capture |
+|---|---|
+| `conversation-chat-messages-skeleton` | Before events load (store empty, skeleton visible) |
+| `conversation-user-message` | Single user message injected |
+| `conversation-assistant-message` | User message + assistant text message |
+| `conversation-event-group-collapsed` | Two back-to-back action events folded into a group (collapsed) |
+| `conversation-event-group-expanded` | Same group after clicking to expand |
+| `conversation-finish-event` | `FinishAction` event rendered (green check or finish card) |
+| `conversation-typing-indicator` | `RUNNING` state injected – typing indicator visible |
+| `conversation-right-panel-closed` | Chat takes full width, right-panel toggle button visible |
+| `conversation-right-panel-files` | Right panel open on Files tab |
+| `conversation-right-panel-terminal` | Right panel open on Terminal tab |
+| `conversation-right-panel-planner` | Right panel open on Planner tab, Build button visible |
+| `conversation-tab-nav-full` | All tabs visible including Task List (inject task tracker event) |
+| `conversation-btw-message-pending` | BTW message with spinner in "pending" state |
+| `conversation-btw-message-answered` | BTW message answered, "Got it" button visible |
+
+---
+
+## 10. Conversation Page – Confirmation Mode
+
+**File:** `conversation-confirmation-mode.snapshot.spec.ts`
+
+| Snapshot name | State to capture |
+|---|---|
+| `confirmation-mode-locked-icon` | Lock icon visible in chat input row (mock `confirmation_mode: true`) |
+| `confirmation-awaiting-normal-risk` | `WAITING_FOR_CONFIRMATION` state + action event β†’ Approve/Reject buttons visible, no risk banner |
+| `confirmation-awaiting-high-risk` | Same but action has `security_risk: "high"` β†’ red `RiskAlert` banner above buttons |
+
+---
+
+## 11. Conversation Page – Collapsible Thinking
+
+**File:** `collapsible-thinking.snapshot.spec.ts` (already exists)
+**Existing:** βœ… `think-action-collapsed.png`, `think-action-expanded.png`, `reasoning-content-collapsed.png`, `reasoning-content-expanded.png`
+
+No new snapshots needed; keep existing baselines.
+
+---
+
+## 12. Conversation Creation – Error States
+
+**File:** `conversation-creation-errors.snapshot.spec.ts`
+
+These tests mock the relevant API endpoints to trigger each failure path.
+
+| Snapshot name | What to mock | State to capture |
+|---|---|---|
+| `creation-backend-unavailable` | `GET /server_info` β†’ network error / timeout | Full-screen backend recovery modal rendered over the home route |
+| `creation-api-failure-toast` | `POST /api/conversations` β†’ 500 | Home screen + error toast visible in top-right corner |
+| `creation-task-polling-error` | `GET /api/conversations/start-tasks/:id` β†’ `{ status: "ERROR", detail: "Sandbox failed to start" }` | Conversation route showing error toast; button returns to idle |
+| `creation-conversation-not-found` | `GET /api/conversations/:id` β†’ 404 | Error toast + redirect back to home (capture just before redirect navigates away) |
+| `creation-loading-spinner` | `GET /api/conversations/start-tasks/:id` β†’ `{ status: "PENDING" }` (never resolves) | `ConversationLoading` full-screen spinner |
+
+---
+
+## 13. Conversation Page – In-Progress Error States
+
+**File:** `conversation-errors.snapshot.spec.ts`
+
+All tests use `navigateToConversation` + inject agent state or events. Serial mode.
+
+### Agent error events (inline in chat)
+| Snapshot name | State to capture |
+|---|---|
+| `error-event-known-id` | `AgentErrorEvent` with a known i18n `errorId` – translated title shown, details collapsed |
+| `error-event-unknown-id` | `AgentErrorEvent` with unknown `errorId` – generic fallback title |
+| `error-event-expanded` | Same event after clicking the chevron – raw markdown details visible |
+| `error-event-long-message` | Error with a very long `defaultMessage` – details scroll within the card |
+
+### Agent status bar error states
+| Snapshot name | State to capture |
+|---|---|
+| `agent-status-error` | `ExecutionStatus.ERROR` injected β†’ red `CircleErrorIcon` in status button, error status text in pill |
+| `agent-status-stuck` | `ExecutionStatus.STUCK` β†’ same error icon path |
+| `agent-status-paused-resume` | `ExecutionStatus.PAUSED` β†’ play/resume button visible |
+| `agent-status-running-stop` | `ExecutionStatus.RUNNING` β†’ stop button visible, pulsing dot |
+| `agent-status-websocket-closed` | WebSocket mock closed after open β†’ `CircleErrorIcon` |
+
+### ErrorMessageBanner (scroll-up pagination / anchor error)
+| Snapshot name | State to capture |
+|---|---|
+| `error-banner-short` | `setErrorMessage` called with a short message (< 220 chars) – no toggle button |
+| `error-banner-long-collapsed` | Long message (> 220 chars) – banner shows line-clamp with "View more" |
+| `error-banner-long-expanded` | Same banner after clicking "View more" – full text visible |
+| `error-banner-dismissed` | Banner after clicking Γ— – banner no longer rendered |
+
+### Session / WebSocket errors (toast)
+| Snapshot name | State to capture |
+|---|---|
+| `ws-session-expired-toast` | Inject `{ error: true, error_code: 401, message: "..." }` event β†’ "Session expired." toast |
+| `ws-generic-error-toast` | Inject `{ error: "Something went wrong", message: "..." }` event β†’ generic error toast |
+| `ws-max-iterations-paused` | Inject `{ type: "error", message: "Agent reached maximum..." }` β†’ agent transitions to PAUSED state |
+
+### Send-message failure (optimistic pending bubble)
+| Snapshot name | State to capture |
+|---|---|
+| `pending-message-sending` | Message sent but not echoed yet – faded "sending" bubble |
+| `pending-message-error` | Mock `send()` throws β†’ bubble shows error treatment + Retry button |
+| `pending-message-after-retry` | After clicking Retry – bubble back to "sending" state |
+
+### File upload validation
+| Snapshot name | State to capture |
+|---|---|
+| `file-upload-too-large-toast` | Attach files exceeding 3 MB limit β†’ error toast (no upload starts) |
+
+---
+
+## 14. Conversation Page – Alert Banner
+
+**File:** `alert-banner.snapshot.spec.ts`
+
+Mock `GET /server_info` (or the relevant endpoint) to return alert payload.
+
+| Snapshot name | State to capture |
+|---|---|
+| `alert-banner-maintenance` | Maintenance start time set β†’ banner with clock/triangle icon and formatted local time |
+| `alert-banner-faulty-models` | Faulty models list β†’ banner listing model names |
+| `alert-banner-error-message` | Free-form error string β†’ banner with raw text |
+| `alert-banner-dismissed` | Banner after clicking Γ— – not rendered, page unobstructed |
+
+---
+
+## 15. Changes Tab – Diff Viewer Edge Cases
+
+**File:** `changes-tab.snapshot.spec.ts`
+
+| Snapshot name | State to capture |
+|---|---|
+| `diff-viewer-modified-file` | Normal modified file – Monaco diff editor visible |
+| `diff-viewer-deleted-file` | File with `type: "D"` selected β†’ "file deleted" placeholder, no Monaco editor |
+| `diff-viewer-no-changes` | Empty git changes list – empty state text |
+
+---
+
+## 16. Sidebar
+
+**File:** `sidebar.snapshot.spec.ts`
+
+| Snapshot name | State to capture |
+|---|---|
+| `sidebar-with-conversations` | Conversation list populated, active conversation highlighted |
+| `sidebar-empty` | No conversations |
+| `sidebar-new-conversation-popover` | "+ New Conversation" popover open showing workspace entries |
+| `sidebar-status-dots` | Conversation list showing multiple status dots (finished, running, error, paused) |
+
+---
+
+## Key User Flow Sequences
+
+The following multi-step flows should each be captured as a `test.step()` series
+within a single test, producing a sequence of named snapshots that together tell
+the story of the flow.
+
+### Flow A – Modify LLM settings β†’ start conversation
+**File:** `flow-llm-settings-to-conversation.snapshot.spec.ts`
+
+1. `flow-llm-settings-initial` β€” LLM settings page, default model
+2. `flow-llm-settings-dirty` β€” Model changed to a new value, Save button enabled
+3. `flow-llm-settings-saved` β€” After save, success toast, button disabled again
+4. `flow-llm-conversation-started` β€” New conversation page, status indicator shows model in use
+
+### Flow B – Enable confirmation mode β†’ agent action requires approval
+**File:** `flow-confirmation-mode.snapshot.spec.ts`
+
+1. `flow-confirmation-settings` β€” Verification settings page, confirmation mode off
+2. `flow-confirmation-settings-toggled` β€” Toggle turned on, security analyzer dropdown appears
+3. `flow-confirmation-settings-saved` β€” Saved, lock icon now shows in conversation input
+4. `flow-confirmation-action-pending` β€” Conversation page: agent at `WAITING_FOR_CONFIRMATION`, Approve/Reject buttons visible
+5. `flow-confirmation-high-risk` β€” Same with `security_risk: "high"` β€” red RiskAlert above buttons
+
+### Flow C – Add a secret β†’ confirm it appears in the secrets list
+**File:** `flow-secrets.snapshot.spec.ts`
+
+1. `flow-secrets-empty` β€” Secrets settings, empty table
+2. `flow-secrets-add-form` β€” "Add New Secret" form open
+3. `flow-secrets-list-populated` β€” After save, secret appears in the table
+
+### Flow D – Install MCP server β†’ appears as installed
+**File:** `flow-mcp-install.snapshot.spec.ts`
+
+1. `flow-mcp-marketplace` β€” Marketplace, server shows as uninstalled
+2. `flow-mcp-install-modal` β€” Install modal open with form
+3. `flow-mcp-installed` β€” Modal closed, server now in Installed section
+
+### Flow E – Conversation creation failure recovery
+**File:** `flow-creation-failure-recovery.snapshot.spec.ts`
+
+1. `flow-recovery-api-down` β€” Home screen, `/api/conversations` returning 500
+2. `flow-recovery-error-toast` β€” Toast visible after clicking "New Conversation"
+3. `flow-recovery-home-intact` β€” Toast dismissed, home screen unchanged and ready to retry
diff --git a/tests/e2e/snapshots/automations.snapshot.spec.ts b/tests/e2e/snapshots/automations.snapshot.spec.ts
new file mode 100644
index 0000000000..7e206af0a7
--- /dev/null
+++ b/tests/e2e/snapshots/automations.snapshot.spec.ts
@@ -0,0 +1,189 @@
+import { test, expect, Page } from "@playwright/test";
+
+/**
+ * Visual snapshot tests for the Automations pages.
+ *
+ * Three states are covered:
+ * 1. Backend not configured (health check returns an error)
+ * 2. List view with active and inactive automation groups (MSW serves 5 automations)
+ * 3. Empty list (health OK, list returns zero items)
+ *
+ * The test server runs with VITE_MOCK_API=true (npm run dev:mock).
+ * MSW handles GET /api/automation/v1 with pre-built data from
+ * src/mocks/automation-handlers.ts. The health endpoint is NOT
+ * covered by MSW so page.route() owns it in all tests.
+ */
+
+/**
+ * Dismiss the analytics consent modal if it appears (MSW settings return
+ * user_consents_to_analytics: null so the modal can show on any page).
+ */
+async function dismissConsentModal(page: Page) {
+ await page
+ .getByRole("button", { name: "Confirm preferences" })
+ .click({ timeout: 3_000 })
+ .catch(() => undefined);
+}
+
+/**
+ * Wire up the routes that every automations test needs:
+ * - Skip onboarding so the modal never blocks the page
+ * - Conversations search (empty – keeps the sidebar quiet)
+ *
+ * NOTE: Settings requests go to the same-origin Vite dev server where MSW
+ * intercepts them before page.route(). We call dismissConsentModal() after
+ * navigation to handle the MSW consent modal instead of suppressing it here.
+ *
+ * Automation health and list requests go cross-origin to :8000 where
+ * page.route() takes precedence. Health is mocked per-test; list is mocked
+ * here with INLINE_AUTOMATIONS so all tests have a consistent baseline.
+ */
+async function setupMocks(page: Page) {
+ await page.addInitScript(() => {
+ window.localStorage.setItem("openhands-onboarded", "true");
+ });
+
+ await page.route("**/api/conversations/search**", async (route) => {
+ await route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ results: [] }),
+ });
+ });
+}
+
+test.describe("Automations Visual Snapshots", () => {
+ test.setTimeout(60_000);
+
+ // TODO: add automations-backend-not-configured snapshot once window.__MSW_WORKER__
+ // is exposed in mock mode so tests can call worker.use() to override the health
+ // handler per-test. See COVERAGE_PLAN.md Β§6 for the full snapshot list.
+
+ test("list with active and inactive groups renders correctly", async ({ page }) => {
+ // MSW (automation-handlers.ts) serves health OK and the full automations list
+ // (3 active, 2 inactive) so no page.route() overrides are needed here.
+ await setupMocks(page);
+
+ await page.goto("/automations");
+ await dismissConsentModal(page);
+ await page.waitForLoadState("networkidle");
+
+ // Wait for at least one automation card to confirm the list loaded
+ const rootLayout = page.getByTestId("root-layout");
+ await expect(rootLayout).toBeVisible({ timeout: 15_000 });
+ await expect(page.getByRole("button", { name: "Automation actions" }).first()).toBeVisible({
+ timeout: 10_000,
+ });
+
+ await expect(rootLayout).toHaveScreenshot(
+ "automations-list-active-inactive.png",
+ { animations: "disabled", maxDiffPixelRatio: 0.01 },
+ );
+ });
+
+ test("search with no results renders correctly", async ({ page }) => {
+ // Load the full list then type a query that matches nothing.
+ await setupMocks(page);
+
+ await page.goto("/automations");
+ await dismissConsentModal(page);
+ await page.waitForLoadState("networkidle");
+
+ await expect(page.getByRole("button", { name: "Automation actions" }).first()).toBeVisible({
+ timeout: 10_000,
+ });
+
+ // Type a query that matches no automation name, repository, or prompt
+ const searchInput = page.getByRole("textbox");
+ await searchInput.fill("zzznomatchquery");
+
+ // Wait for the filtered state to settle
+ await page.waitForTimeout(300);
+
+ const rootLayout = page.getByTestId("root-layout");
+ await expect(rootLayout).toHaveScreenshot("automations-search-no-results.png", {
+ animations: "disabled",
+ maxDiffPixelRatio: 0.01,
+ });
+ });
+
+ test("no automations shows empty state", async ({ page }) => {
+ // Each Playwright test gets a fresh browser context, so MSW starts with
+ // the full MOCK_AUTOMATIONS_RESPONSE. We delete every automation via the
+ // REST API (MSW handles DELETE) then reload so React Query fetches the
+ // now-empty list and renders the EmptyState component.
+ await setupMocks(page);
+
+ await page.goto("/automations");
+ await dismissConsentModal(page);
+
+ // Wait for initial list to confirm the service worker is active
+ await expect(
+ page.getByRole("button", { name: "Automation actions" }).first(),
+ ).toBeVisible({ timeout: 10_000 });
+
+ // Delete every automation from the MSW mutable state.
+ // Important: the `automations` Map lives in PAGE-level JS (the MSW handlers
+ // are compiled into the client bundle). A page.reload() would re-run the
+ // module initialiser and reset the Map to 5 items, so instead we:
+ // 1. Make the DELETE fetches (MSW handles them in the page context)
+ // 2. Call window.__TEST_INVALIDATE_QUERIES__() to ask React Query to
+ // refetch without a reload
+ await page.evaluate(async () => {
+ const res = await fetch("/api/automation/v1?limit=100");
+ const data = (await res.json()) as { automations: { id: string }[] };
+ await Promise.all(
+ data.automations.map((a) =>
+ fetch(`/api/automation/v1/${a.id}`, { method: "DELETE" }),
+ ),
+ );
+ });
+
+ // Trigger React Query to refetch the now-empty list
+ await page.evaluate(() => {
+ (
+ window as Window & { __TEST_INVALIDATE_QUERIES__?: () => void }
+ ).__TEST_INVALIDATE_QUERIES__?.();
+ });
+
+ await page.waitForLoadState("networkidle");
+
+ const rootLayout = page.getByTestId("root-layout");
+ await expect(rootLayout).toBeVisible({ timeout: 15_000 });
+
+ // No kebab buttons means the list is truly empty
+ await expect(
+ page.getByRole("button", { name: "Automation actions" }),
+ ).toHaveCount(0, { timeout: 10_000 });
+
+ await expect(rootLayout).toHaveScreenshot("automations-no-automations.png", {
+ animations: "disabled",
+ maxDiffPixelRatio: 0.01,
+ });
+ });
+
+ test("delete confirmation modal renders correctly", async ({ page }) => {
+ await setupMocks(page);
+
+ await page.goto("/automations");
+ await dismissConsentModal(page);
+ await page.waitForLoadState("networkidle");
+
+ // Wait for the first kebab button to be visible before interacting
+ const kebab = page.getByRole("button", { name: "Automation actions" }).first();
+ await expect(kebab).toBeVisible({ timeout: 10_000 });
+ await kebab.click();
+
+ await page.getByRole("button", { name: "Delete" }).click();
+
+ // DeleteConfirmationModal is a plain div (no dialog role).
+ // Wait for its title to confirm it appeared.
+ await expect(page.getByText("Delete automation")).toBeVisible({ timeout: 5_000 });
+
+ const rootLayout = page.getByTestId("root-layout");
+ await expect(rootLayout).toHaveScreenshot(
+ "automations-delete-modal.png",
+ { animations: "disabled", maxDiffPixelRatio: 0.01 },
+ );
+ });
+});
diff --git a/tests/e2e/snapshots/mcp-page.snapshot.spec.ts b/tests/e2e/snapshots/mcp-page.snapshot.spec.ts
new file mode 100644
index 0000000000..763704b6ea
--- /dev/null
+++ b/tests/e2e/snapshots/mcp-page.snapshot.spec.ts
@@ -0,0 +1,276 @@
+import { test, expect, Page } from "@playwright/test";
+
+/**
+ * Visual snapshot tests for the MCP page (/mcp).
+ *
+ * The MCP marketplace catalog is hardcoded in src/constants/mcp-marketplace.ts,
+ * so it never requires an API call. Installed servers are read from
+ * settings.agent_settings.mcp_config (SDK format: { mcpServers: { ... } }).
+ *
+ * Three states are covered:
+ * 1. No installed servers – empty installed section, full marketplace visible
+ * 2. Two installed servers (one SSE, one stdio)
+ * 3. Search query "slack" filtering both sections simultaneously
+ */
+
+/**
+ * Dismiss the analytics consent modal if MSW shows it (settings return
+ * user_consents_to_analytics: null by default in mock mode).
+ */
+async function dismissConsentModal(page: Page) {
+ await page
+ .getByRole("button", { name: "Confirm preferences" })
+ .click({ timeout: 3_000 })
+ .catch(() => undefined);
+}
+
+/**
+ * Wire up the base routes every MCP page test needs.
+ *
+ * NOTE: Settings requests go to the same-origin Vite dev server where MSW
+ * wins over page.route(). We dismiss the consent modal after navigation
+ * instead of trying to suppress it here.
+ */
+async function setupMocks(page: Page) {
+ await page.addInitScript(() => {
+ window.localStorage.setItem("openhands-onboarded", "true");
+ });
+
+ await page.route("**/api/conversations/search**", async (route) => {
+ await route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ results: [] }),
+ });
+ });
+}
+
+test.describe("MCP Page Visual Snapshots", () => {
+ test.setTimeout(60_000);
+
+ test("empty installed section with marketplace renders correctly", async ({
+ page,
+ }) => {
+ // MSW settings have no mcp_config β†’ installed section is empty
+ await setupMocks(page);
+
+ await page.goto("/mcp");
+ await dismissConsentModal(page);
+ await page.waitForLoadState("networkidle");
+
+ const mcpPage = page.getByTestId("mcp-page");
+ await expect(mcpPage).toBeVisible({ timeout: 15_000 });
+
+ await expect(mcpPage).toHaveScreenshot("mcp-empty-installed.png", {
+ animations: "disabled",
+ maxDiffPixelRatio: 0.01,
+ });
+ });
+
+ test("add custom server editor form renders correctly", async ({ page }) => {
+ // The "Add custom server" modal does not depend on settings state so it
+ // is reliably testable regardless of MSW's default settings response.
+ await setupMocks(page);
+
+ await page.goto("/mcp");
+ await dismissConsentModal(page);
+ await page.waitForLoadState("networkidle");
+
+ const mcpPage = page.getByTestId("mcp-page");
+ await expect(mcpPage).toBeVisible({ timeout: 15_000 });
+
+ // Open the custom server editor
+ await page.getByTestId("mcp-add-custom-server").click();
+
+ // Wait for the editor form to appear inside the modal
+ const modal = page.locator(".fixed.inset-0").last();
+ await expect(modal).toBeVisible({ timeout: 5_000 });
+
+ await expect(page.getByTestId("root-layout")).toHaveScreenshot(
+ "mcp-custom-server-editor.png",
+ { animations: "disabled", maxDiffPixelRatio: 0.01 },
+ );
+ });
+
+ test("search query filters marketplace", async ({ page }) => {
+ await setupMocks(page);
+
+ await page.goto("/mcp");
+ await dismissConsentModal(page);
+ await page.waitForLoadState("networkidle");
+
+ const mcpPage = page.getByTestId("mcp-page");
+ await expect(mcpPage).toBeVisible({ timeout: 15_000 });
+
+ // Type "slack" into the unified search box
+ const searchInput = page.getByTestId("mcp-search-input");
+ await expect(searchInput).toBeVisible({ timeout: 5_000 });
+ await searchInput.fill("slack");
+
+ // Wait for the filtered results to stabilise
+ await page.waitForTimeout(300);
+
+ await expect(mcpPage).toHaveScreenshot("mcp-search-filtered.png", {
+ animations: "disabled",
+ maxDiffPixelRatio: 0.01,
+ });
+ });
+
+ /**
+ * Iterative snapshot test: install the Slack server from the marketplace.
+ *
+ * Simulates the full user journey with one snapshot per step:
+ * step 1 – marketplace view with Slack card visible
+ * step 2 – Slack install modal open with empty fields
+ * step 3 – Slack install modal with bot-token and team-ID filled in
+ * step 4 – after clicking Install, Slack card appears in Installed section
+ *
+ * The MSW settings PATCH handler persists the new mcp_config so the
+ * refetch shows the installed server without any page.route() trickery.
+ */
+ test("install Slack from marketplace (iterative snapshots)", async ({
+ page,
+ }) => {
+ await setupMocks(page);
+
+ await page.goto("/mcp");
+ await dismissConsentModal(page);
+ await page.waitForLoadState("networkidle");
+
+ const mcpPage = page.getByTestId("mcp-page");
+ const rootLayout = page.getByTestId("root-layout");
+ await expect(mcpPage).toBeVisible({ timeout: 15_000 });
+
+ await test.step("step 1 – marketplace before install", async () => {
+ await expect(
+ page.getByTestId("mcp-marketplace-card-slack"),
+ ).toBeVisible({ timeout: 5_000 });
+ await expect(mcpPage).toHaveScreenshot("mcp-slack-install-1-marketplace.png", {
+ animations: "disabled",
+ maxDiffPixelRatio: 0.01,
+ });
+ });
+
+ await test.step("step 2 – Slack install modal open", async () => {
+ await page.getByTestId("mcp-marketplace-card-slack").click();
+ await expect(page.getByTestId("mcp-install-modal")).toBeVisible({
+ timeout: 5_000,
+ });
+ await expect(rootLayout).toHaveScreenshot("mcp-slack-install-2-modal.png", {
+ animations: "disabled",
+ maxDiffPixelRatio: 0.01,
+ });
+ });
+
+ await test.step("step 3 – fill in bot token and team ID", async () => {
+ await page
+ .getByTestId("mcp-install-field-SLACK_BOT_TOKEN")
+ .fill("xoxb-test-bot-token-1234567890");
+ await page
+ .getByTestId("mcp-install-field-SLACK_TEAM_ID")
+ .fill("T01ABC123");
+ await expect(rootLayout).toHaveScreenshot("mcp-slack-install-3-filled.png", {
+ animations: "disabled",
+ maxDiffPixelRatio: 0.01,
+ });
+ });
+
+ await test.step("step 4 – submit and confirm Slack is installed", async () => {
+ await page.getByTestId("mcp-install-submit").click();
+
+ // Modal should disappear once the mutation completes
+ await expect(page.getByTestId("mcp-install-modal")).not.toBeVisible({
+ timeout: 10_000,
+ });
+ await page.waitForLoadState("networkidle");
+
+ // The installed section should now contain a Slack server card
+ await expect(page.getByTestId("mcp-server-item")).toBeVisible({
+ timeout: 10_000,
+ });
+ // Brief wait to let the toast and any animations settle
+ await page.waitForTimeout(400);
+
+ await expect(mcpPage).toHaveScreenshot("mcp-slack-install-4-installed.png", {
+ animations: "disabled",
+ maxDiffPixelRatio: 0.01,
+ });
+ });
+ });
+
+ /**
+ * Iterative snapshot test: manually add a custom SSE server via the editor.
+ *
+ * Simulates the full user journey with one snapshot per step:
+ * step 1 – custom server editor open (SSE type, empty fields)
+ * step 2 – URL field filled in
+ * step 3 – API key field filled in (optional field shown)
+ * step 4 – after clicking Add Server, the custom server appears installed
+ *
+ * Uses the same MSW settings PATCH + GET refetch flow as the marketplace
+ * install test so no page.route() overrides are needed.
+ */
+ test("add custom SSE server via editor (iterative snapshots)", async ({
+ page,
+ }) => {
+ await setupMocks(page);
+
+ await page.goto("/mcp");
+ await dismissConsentModal(page);
+ await page.waitForLoadState("networkidle");
+
+ const mcpPage = page.getByTestId("mcp-page");
+ const rootLayout = page.getByTestId("root-layout");
+ await expect(mcpPage).toBeVisible({ timeout: 15_000 });
+
+ await test.step("step 1 – custom server editor open (empty)", async () => {
+ await page.getByTestId("mcp-add-custom-server").click();
+ await expect(page.getByTestId("mcp-custom-editor")).toBeVisible({
+ timeout: 5_000,
+ });
+ await expect(rootLayout).toHaveScreenshot(
+ "mcp-custom-server-1-editor-open.png",
+ { animations: "disabled", maxDiffPixelRatio: 0.01 },
+ );
+ });
+
+ await test.step("step 2 – URL filled in", async () => {
+ await page
+ .getByTestId("url-input")
+ .fill("https://api.example-mcp.com/sse");
+ await expect(rootLayout).toHaveScreenshot(
+ "mcp-custom-server-2-url-filled.png",
+ { animations: "disabled", maxDiffPixelRatio: 0.01 },
+ );
+ });
+
+ await test.step("step 3 – API key filled in (optional)", async () => {
+ await page.getByTestId("api-key-input").fill("test-api-key-xyz-123");
+ await expect(rootLayout).toHaveScreenshot(
+ "mcp-custom-server-3-all-filled.png",
+ { animations: "disabled", maxDiffPixelRatio: 0.01 },
+ );
+ });
+
+ await test.step("step 4 – save and confirm custom server is installed", async () => {
+ await page.getByTestId("submit-button").click();
+
+ // Editor modal should close
+ await expect(page.getByTestId("mcp-custom-editor")).not.toBeVisible({
+ timeout: 10_000,
+ });
+ await page.waitForLoadState("networkidle");
+
+ // Installed section should now contain the custom SSE server
+ await expect(page.getByTestId("mcp-server-item")).toBeVisible({
+ timeout: 10_000,
+ });
+ await page.waitForTimeout(400);
+
+ await expect(mcpPage).toHaveScreenshot(
+ "mcp-custom-server-4-installed.png",
+ { animations: "disabled", maxDiffPixelRatio: 0.01 },
+ );
+ });
+ });
+});
diff --git a/tests/e2e/snapshots/skills-page.snapshot.spec.ts b/tests/e2e/snapshots/skills-page.snapshot.spec.ts
new file mode 100644
index 0000000000..513f27f916
--- /dev/null
+++ b/tests/e2e/snapshots/skills-page.snapshot.spec.ts
@@ -0,0 +1,76 @@
+import { test, expect, Page } from "@playwright/test";
+
+/**
+ * Visual snapshot tests for the Skills page (/skills).
+ *
+ * SkillsService.getSkills() issues POST /api/skills. In mock-API mode
+ * MSW returns { skills: [] }, so the empty state is free. For the loaded
+ * and search states we intercept the POST with page.route() and return a
+ * small set of realistic skills.
+ *
+ * Three states are covered:
+ * 1. Empty – server returns no skills (MSW default)
+ * 2. Loaded – four skill cards including one disabled via disabled_skills
+ * 3. Search match / no-match – filtered results after typing in the search box
+ */
+
+/**
+ * Dismiss the analytics consent modal if MSW shows it.
+ */
+async function dismissConsentModal(page: Page) {
+ await page
+ .getByRole("button", { name: "Confirm preferences" })
+ .click({ timeout: 3_000 })
+ .catch(() => undefined);
+}
+
+/**
+ * Wire up the base routes every skills test needs.
+ *
+ * NOTE: POST /api/skills goes to the same-origin Vite dev server where MSW
+ * intercepts it before page.route() can. MSW always returns { skills: [] }
+ * in mock mode, so tests that require skill card data need a different
+ * injection mechanism (e.g. exposing a __OH_QUERY_CLIENT__ on window so
+ * tests can seed the React Query cache directly). Those tests are tracked in
+ * COVERAGE_PLAN.md and deferred until that mechanism is available.
+ */
+async function setupMocks(page: Page) {
+ await page.addInitScript(() => {
+ window.localStorage.setItem("openhands-onboarded", "true");
+ });
+
+ await page.route("**/api/conversations/search**", async (route) => {
+ await route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ results: [] }),
+ });
+ });
+}
+
+test.describe("Skills Page Visual Snapshots", () => {
+ test.setTimeout(60_000);
+
+ test("empty state renders correctly", async ({ page }) => {
+ // MSW intercepts POST /api/skills and returns { skills: [] } so the
+ // "No skills found" empty state is the reliable baseline here.
+ await setupMocks(page);
+
+ await page.goto("/skills");
+ await dismissConsentModal(page);
+ await page.waitForLoadState("networkidle");
+
+ const skillsScreen = page.getByTestId("skills-settings-screen");
+ await expect(skillsScreen).toBeVisible({ timeout: 15_000 });
+
+ await expect(skillsScreen).toHaveScreenshot("skills-empty.png", {
+ animations: "disabled",
+ maxDiffPixelRatio: 0.01,
+ });
+ });
+
+ // TODO: add skills-loaded, skills-search-filtered, skills-no-match once
+ // window.__OH_QUERY_CLIENT__ (or equivalent) is exposed so tests can seed
+ // the React Query skills cache without fighting MSW's same-origin intercept.
+ // See tests/e2e/snapshots/COVERAGE_PLAN.md Β§5 for the full snapshot list.
+});