Dev testing frontend

From google/capsem · View interactive version

Dev testing frontend is an AI agent skill from the GitHub repository google/capsem. Testing the Capsem frontend. Use when writing frontend tests, running type checks, or doing visual verification with Chrome DevTools MCP.

How to use this skill

Skill file

Frontend Testing

Stack

Astro 7 + Svelte 5 (runes only) + Tailwind v4 + Capsem-owned semantic CSS + LayerChart v2.

Running tests

pnpm --dir web/app run check              # astro check + svelte-check
pnpm --dir web/app exec vitest run --coverage
pnpm --dir web/app run build              # Production bundle

All three run as part of just test. The production build is important -- Tailwind v4's Vite plugin can miss client:only components in the SSR module graph, so @source directives in global.css must explicitly include .svelte and .ts files.

Test files

Tests live in web/app/src/lib/__tests__/. Use vitest with standard patterns:

import { describe, it, expect } from 'vitest';

Browser and test data

Browser and Tauri sessions both use the real gateway through the SDK in

api.ts. The absence of window.__TAURI_INTERNALS__ does not enable mock

responses. Start the real service and gateway for browser acceptance, or

explicitly supply a hermetic test transport in unit tests.

just dev ui starts the frontend; its API requests use the gateway. Stopped

fixture sessions can exercise UI states without booting a VM, but cannot

establish working guest execution or credential connection flows.

Generated test data: mock-settings.generated.ts is produced by

build_system/scripts/build/generate_schema.py from the canonical settings

metadata. It supports explicit test fixtures, not an automatic browser mode.

Use the schema-generation owner included in just test; never hand-edit it.

Visual verification with Chrome DevTools MCP

Every UI change requires visual verification via Chrome DevTools MCP. No exceptions. Type checks and unit tests pass on broken UIs all the time. The only way to know the UI actually works is to look at it.

Workflow for every UI change

  1. Start just dev ui (if not already running)
  2. navigate_page to http://localhost:5173
  3. list_console_messages types=["error","warn"] -- expect zero
  4. Navigate to the view(s) affected by your change
  5. take_screenshot each affected view -- visually confirm it renders correctly
  6. If the change affects multiple views or layout, screenshot all views (Terminal, Sessions, Network, Settings)
  7. Check console again after navigation for new errors

Settings view

Click through every section (AI Providers, Repositories, Security, VM, Appearance). Verify:

derive the expected settings from that metadata instead of copying a count

After changing TOML configs or generated mock data

When modifying config/settings/ui-metadata.generated.json or regenerating mock-settings.generated.ts:

  1. Use the schema-generation owner included in just test
  2. Start just dev ui
  3. Navigate to Settings view
  4. Screenshot and verify new/changed settings appear correctly
  5. Check that setting counts match (grep mockSettings.find in generated file)

Color rules (firm)

Svelte 5 reference

Read references/svelte5.md for Svelte 5 patterns and the @sveltejs/mcp CLI for doc lookups.

Gotchas

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.