[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6C7EEW4A9HCT7AWYDN4NBDR":3,"skill-same:01M6C7EEW4A9HCT7AWYDN4NBDR":67},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":10,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":17,"categories":18,"keywords":29,"publishedAt":41,"linkOnly":42,"markdownContent":43,"markdownBody":44,"frontMatter":45,"refName":46,"commitSha":47,"skillDirectory":48,"forksCount":49,"repositoryHtmlUrl":50,"repositoryHomepageUrl":16,"ownerHtmlUrl":51,"ownerBlogUrl":16,"ownerDescription":16,"updatedAt":52,"install":53,"resources":66},"01M6C7EEW4A9HCT7AWYDN4NBDR","e2e","kspec Web UI 端到端测试","E2E testing patterns for kspec web UI. Use when writing Playwright tests, debugging hydration issues, or working with daemon fixtures.","针对 kspec Web UI 的端到端（E2E）测试模式。适用于编写 Playwright 测试、调试 hydration（水合）问题，或处理 daemon fixtures（守护进程测试夹具）。","lepahc\u002Fkynetic-spec","lepahc","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F255431765?v=4","01M6C7E6Z0C8SE1X6PJ2F9Q1CX","01M6C7E744QKNYBVZ7KV7Z69GF",1,"MIT",null,"https:\u002F\u002Fgithub.com\u002Flepahc\u002Fkynetic-spec\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fe2e\u002FSKILL.md",[19,24],{"categoryNo":20,"categoryName":21,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8BQGD5WG86P4AQ5GPSSKBFR","测试工程师","PROFESSION","适用职业",{"categoryNo":25,"categoryName":26,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8BQJH394GT47X57A9Q8G7HX","测试与质量保障","SCENARIO","使用场景",[5,30,31,32,33,34,35,36,37,38,39,40],"testing","writing","e2e testing","playwright","web","debugging","issues","ui","e2e testing patterns","testing patterns","use","2026-11-10 10:12:30",false,"---\nname: e2e\ndescription: E2E testing patterns for kspec web UI. Use when writing Playwright\n  tests, debugging hydration issues, or working with daemon fixtures.\n---\n\u003C!-- kspec-managed -->\n\n# E2E Testing Skill\n\nLearnings and patterns from completed E2E work (tasks.spec.ts, items.spec.ts).\n\n## Quick Reference\n\n| Scenario | Pattern | Example |\n|----------|---------|---------|\n| Isolated daemon | `import { test } from '..\u002Ffixtures\u002Ftest-base'` | Every E2E test |\n| Select dropdown (bits-ui) | Click trigger → `getByRole('option')` or `locator('[data-slot=\"select-item\"]')` | Filter tests |\n| Text input | `pressSequentially()` with delay | Tag filter |\n| Wait for API | `waitForRequest()` | Action tests |\n| Wait for URL | `waitForURL(\u002Fpattern\u002F)` | Navigation tests |\n| Scoped selectors | `.locator('> div').first().getByTestId()` | Tree nav |\n| Content check | `toContainText()` not just `toBeVisible()` | All tests |\n\n## Fixture Architecture\n\n### Test-base.ts Pattern\n\nThe `test-base.ts` fixture creates a completely isolated environment per test:\n\n```typescript\n\u002F\u002F Key steps performed automatically:\n1. Create temp dir with .kspec\u002F subdirectory\n2. Copy E2E fixtures from tests\u002Fe2e\u002Ffixtures\u002F\n3. Initialize git repo with test user config\n4. Create fake shadow worktree structure:\n   - .git\u002Fworktrees\u002F-kspec\u002F directory\n   - .kspec\u002F.git file with \"gitdir:\" pointer\n5. Allocate ephemeral port (OS-assigned, never hardcoded)\n6. Start daemon via node + CLI_PATH (no npm link needed)\n7. Set WEB_UI_DIR for static serving\n8. Poll health endpoint until ready\n9. Provide isolated fixture to test\n10. Cleanup: stop daemon, remove temp directory\n```\n\n**Key file locations:**\n- `tests\u002Fe2e\u002Ffixtures\u002F` - E2E YAML fixtures and test-base.ts\n- `tests\u002Fe2e\u002F*.spec.ts` - Test files\n- `playwright.config.ts` - Playwright config (root level)\n\n### Fixture Isolation is Non-Negotiable\n\nE2E fixtures MUST be separate from unit test fixtures:\n\n```\ntests\u002Ffixtures\u002F           ← Unit test fixtures (shared)\ntests\u002Fe2e\u002Ffixtures\u002F       ← E2E fixtures (isolated)\n```\n\n**Why:** E2E daemon mutations affect fixtures. Unit tests need stable data.\n\n## ULID Format Requirements\n\n**Critical:** ULIDs use Crockford base32 which **excludes I, L, O, U**.\n\n```typescript\n\u002F\u002F INVALID ULIDs - contain forbidden characters\n'01TASK100...'   \u002F\u002F I is invalid\n'01MODULE0...'   \u002F\u002F O and U are invalid\n'01TRAIT10...'   \u002F\u002F I is invalid\n\n\u002F\u002F VALID ULIDs - only 0-9, A-H, J-K, M-N, P-T, V-Z\n'01TASK0000...'  \u002F\u002F T, A, S, K are all valid\n'01TRATT100...'  \u002F\u002F No I, L, O, U\n```\n\n**Recommendation:** Use `testUlid()` helper from `tests\u002Fhelpers\u002Fcli.ts`:\n\n```typescript\nimport { testUlid, testUlids } from '..\u002F..\u002Fhelpers\u002Fcli';\n\nconst taskId = testUlid('TASK');     \u002F\u002F '01TASK00000000000000000000'\nconst traitId = testUlid('TRAIT');   \u002F\u002F '01TRAJT0000000000000000000' (I auto-replaced)\nconst [id1, id2, id3] = testUlids('TASK', 3);\n```\n\n## Svelte 5 SSR\u002FHydration Gotchas\n\n### Problem: $state Variables Don't React After Hydration\n\n**Symptom:** Detail panel state updates correctly but UI doesn't re-render.\n\n**Root cause:** `adapter-static` pre-renders pages. After hydration, reactive subscriptions with `$state` can disconnect.\n\n**Solution 1 (Preferred):** Disable SSR for interactive pages\n\n```typescript\n\u002F\u002F +page.ts\nexport const ssr = false;\n```\n\n**Solution 2:** Use $state object pattern with flushSync\n\n```typescript\nlet panel = $state\u003C{ open: boolean; task: Task | null }>({\n  open: false,\n  task: null\n});\n\n\u002F\u002F When updating, use flushSync for synchronous DOM update\nimport { flushSync } from 'svelte';\n\nflushSync(() => {\n  panel.task = task;\n  panel.open = true;\n});\n```\n\n### Problem: URL Param Changes Don't Trigger Reactivity\n\n**Symptom:** Clicking navigation that uses `goto()` doesn't reload data.\n\n**Root cause:** Client-side navigation bypasses component mount.\n\n**Solution:** Use reactive `$:` blocks instead of `onMount`:\n\n```typescript\n\u002F\u002F BAD - only runs once\nonMount(() => {\n  loadItem(ref);\n});\n\n\u002F\u002F GOOD - reacts to URL changes\n$: if (ref && open) {\n  loadItem(ref);\n}\n```\n\n### Problem: bits-ui Select Returns Array\n\n**Symptom:** Selecting \"in_progress\" produces `['i', 'n', '_', 'p', 'r', 'o', 'g', 'r', 'e', 's', 's', 'in_progress']`\n\n**Solution:** Take last element if array:\n\n### bits-ui Select E2E Selectors\n\nbits-ui Select components use **both** standard ARIA roles and `data-slot` attributes. Either selector approach works:\n\n```typescript\n\u002F\u002F Open dropdown\nawait page.getByTestId('my-select-trigger').click();\n\n\u002F\u002F Option 1: Standard ARIA role (recommended - more semantic)\nawait page.getByRole('option', { name: 'Option Name' }).click();\n\n\u002F\u002F Option 2: data-slot attribute (alternative)\nconst dropdown = page.locator('[data-slot=\"select-content\"]');\nawait dropdown.locator('[data-slot=\"select-item\"]').filter({ hasText: 'Option Name' }).click();\n```\n\n**Note:** Each select item element has both `role=\"option\"` and `data-slot=\"select-item\"` attributes.\n\n```typescript\nfunction updateFilter(key: string, value: string | string[] | undefined) {\n  let actualValue: string | undefined;\n  if (Array.isArray(value)) {\n    actualValue = value.length > 0 ? value[value.length - 1] : undefined;\n  } else {\n    actualValue = value;\n  }\n  \u002F\u002F ... rest of filter logic\n}\n```\n\n## Common Test Patterns\n\n### Filter Testing\n\n```typescript\n\u002F\u002F Select dropdown - both role=\"option\" and data-slot work\nconst filterStatus = page.getByTestId('filter-status');\nawait filterStatus.click();\n\n\u002F\u002F Click option using ARIA role (recommended)\nawait page.getByRole('option', { name: 'Pending', exact: true }).click();\nawait page.waitForURL(\u002Fstatus=pending\u002F);\n\n\u002F\u002F Text input - use pressSequentially, not fill()\nconst filterTag = page.getByTestId('filter-tag');\nawait filterTag.click();\nawait filterTag.pressSequentially('e2e', { delay: 50 });\nawait page.waitForURL(\u002Ftag=e2e\u002F);\n```\n\n### Detail Panel Testing\n\n```typescript\n\u002F\u002F Open panel\nconst item = page.getByTestId('list-item').first();\nawait item.click();\n\n\u002F\u002F Verify panel content\nconst panel = page.getByTestId('detail-panel');\nawait expect(panel).toBeVisible();\nawait expect(panel.getByTestId('title')).toContainText('Expected Title');\n```\n\n### API Request Verification\n\n```typescript\n\u002F\u002F Verify API call was made, not just UI state\nconst requestPromise = page.waitForRequest((req) =>\n  req.url().includes('\u002Fapi\u002Ftasks\u002F') && req.url().includes('\u002Fstart')\n);\nawait startButton.click();\nconst request = await requestPromise;\nexpect(request.method()).toBe('POST');\n```\n\n### Tree\u002FHierarchy Navigation\n\n```typescript\n\u002F\u002F Get module node\nconst specTree = page.getByTestId('spec-tree').first();\nconst moduleNode = specTree.locator('[data-testid*=\"tree-node-module\"]').first();\n\n\u002F\u002F Expand module (expand toggle is sibling to node-title)\nconst expandToggle = moduleNode.locator('> div').first().getByTestId('expand-toggle');\nawait expandToggle.click();\n\n\u002F\u002F Find child feature after expansion\nconst childContainer = moduleNode.getByTestId('tree-node-child');\nconst featureNode = childContainer.locator('[data-testid*=\"tree-node-feature\"]').first();\nawait expect(featureNode).toBeVisible();\n```\n\n### Navigation Verification\n\n```typescript\n\u002F\u002F Verify navigation occurred\nconst link = page.getByTestId('spec-ref-link');\nawait link.click();\nawait page.waitForURL(\u002F\\\u002Fitems\\?ref=\u002F);\n\n\u002F\u002F Verify content loaded after navigation\nconst detail = page.getByTestId('item-detail');\nawait expect(detail).toBeVisible();\n```\n\n## data-testid Conventions\n\n| Component | Pattern | Example |\n|-----------|---------|---------|\n| Lists | `{entity}-list` | `task-list`, `spec-tree` |\n| List items | `{entity}-list-item` or `tree-node-{type}` | `task-list-item`, `tree-node-module` |\n| Detail panels | `{entity}-detail-panel` | `task-detail-panel`, `spec-detail-panel` |\n| Filters | `filter-{name}` | `filter-status`, `filter-tag` |\n| Badges | `{entity}-{field}` | `task-status-badge`, `task-priority` |\n| Buttons | `{action}-{entity}-button` or `{action}-button` | `start-task-button`, `expand-toggle` |\n| Counts | `{entity}-count-{status}` | `task-count-ready`, `task-count-blocked` |\n\n## WebSocket Testing\n\n### Current Limitation\n\nDaemon WebSocket in E2E tests returns 200 instead of 101 for upgrade handshake.\n\n**Impact:** WebSocket connection tests fail in E2E environment.\n\n### Workaround Options\n\n1. **Skip with documentation:**\n   ```typescript\n   test.skip('counts animate on WebSocket update', async ({ page }) => {\n     \u002F\u002F Skipped: Daemon WebSocket upgrade returns 200 in E2E environment\n     \u002F\u002F See: AGENTS.md \"CI Limitations\" section\n   });\n   ```\n\n2. **Test API triggers instead:** Verify API calls that would trigger WebSocket events:\n   ```typescript\n   test('task update triggers refetch', async ({ page, daemon }) => {\n     \u002F\u002F Trigger update via API\n     const response = await fetch(`${daemon.url}\u002Fapi\u002Ftasks\u002F${id}\u002Fstart`, {\n       method: 'POST'\n     });\n     expect(response.ok).toBe(true);\n\n     \u002F\u002F Verify UI updates (without WebSocket, need page reload)\n     await page.reload();\n     await expect(page.getByTestId('task-status')).toContainText('In Progress');\n   });\n   ```\n\n### When WebSocket Works\n\nFull test pattern for future:\n```typescript\ntest('counts animate on update', async ({ page, daemon }) => {\n  await page.goto('\u002F');\n\n  \u002F\u002F Get initial count\n  const countEl = page.getByTestId('task-count-in_progress');\n  const initialCount = await countEl.textContent();\n\n  \u002F\u002F Trigger task start via API\n  await fetch(`${daemon.url}\u002Fapi\u002Ftasks\u002F${taskId}\u002Fstart`, { method: 'POST' });\n\n  \u002F\u002F Wait for animation class\n  await expect(countEl).toHaveClass(\u002Fanimate-pulse\u002F);\n\n  \u002F\u002F Verify count changed\n  await expect(countEl).not.toContainText(initialCount!);\n});\n```\n\n## New E2E Test Checklist\n\nBefore writing a new E2E test:\n\n- [ ] Fixtures have required data (tasks, items, meta with variety)\n- [ ] ULIDs are valid Crockford base32 (no I, L, O, U)\n- [ ] Import from `..\u002Ffixtures\u002Ftest-base` (not Playwright direct)\n- [ ] Use `daemon` fixture parameter for isolated environment\n- [ ] Components have data-testid attributes for selectors\n- [ ] Use scoped selectors with `.first()` for ambiguous queries\n- [ ] Verify API calls with `waitForRequest()`, not just UI\n- [ ] Check URL params with `waitForURL()` for navigation tests\n- [ ] Test content with `toContainText()`, not just visibility\n- [ ] Include variety: happy path, edge cases, responsive\n\n## Fixture Data Requirements\n\n### Task Status Variety\n\nFixtures should include tasks with all statuses:\n- `pending` (ready - no unmet dependencies)\n- `in_progress` (started)\n- `pending_review` (code done, awaiting merge)\n- `blocked` (has unmet dependencies)\n- `completed` (done)\n\n### Hierarchy for Tree Tests\n\n```yaml\nmodules:\n  - _ulid: 01M0DULE00000000000000000\n    type: module\n    features:\n      - _ulid: 01FEATURE0000000000000000\n        type: feature\n        requirements:\n          - _ulid: 01REQVREMENT000000000000\n            type: requirement\n```\n\n### Linked Data\n\n- Tasks with `spec_ref` pointing to spec items\n- Items with `traits` array referencing trait items\n- Observations with `spec_ref` or `task_ref` links\n\n## Debugging Tips\n\n### Test Passes Locally, Fails in CI\n\n1. **Check file watchers:** CI containers don't support recursive `fs.watch`. Tests using watchers are skipped in CI.\n2. **Check port conflicts:** E2E uses port 3456. Previous daemon may not have cleaned up.\n3. **Check fixture paths:** CI paths may differ. Use relative paths in fixtures.\n\n### Element Not Found\n\n1. **SSR timing:** Add `{ timeout: 5000 }` to assertions\n2. **Scope correctly:** Use `element.getByTestId()` not `page.getByTestId()`\n3. **Wait for load:** `await page.waitForLoadState('networkidle')`\n\n### State Not Updating\n\n1. **Check SSR:** Add `export const ssr = false` to page\n2. **Check reactivity:** Use `$:` blocks for URL-driven state\n3. **Check flushSync:** For synchronous DOM updates\n\n## Anti-Patterns\n\n### Don't: Conditional Assertions\n\n```typescript\n\u002F\u002F BAD - hides failures\nif (await element.isVisible()) {\n  await expect(element).toContainText('value');\n}\n\n\u002F\u002F GOOD - fails clearly\nawait expect(element).toBeVisible();\nawait expect(element).toContainText('value');\n```\n\n### Don't: Share Fixtures with Unit Tests\n\n```typescript\n\u002F\u002F BAD - mutations affect unit tests\nawait copyFixtures('..\u002F..\u002Ftests\u002Ffixtures\u002F');\n\n\u002F\u002F GOOD - isolated E2E fixtures\nawait copyFixtures('..\u002Ffixtures\u002F');  \u002F\u002F tests\u002Fe2e\u002Ffixtures\u002F\n```\n\n### Don't: Test UI State Only\n\n```typescript\n\u002F\u002F BAD - doesn't verify API call\nawait startButton.click();\nawait expect(statusBadge).toContainText('In Progress');\n\n\u002F\u002F GOOD - verifies both\nconst req = await page.waitForRequest(r => r.url().includes('\u002Fstart'));\nexpect(req.method()).toBe('POST');\nawait expect(statusBadge).toContainText('In Progress');\n```\n\n## Related Skills\n\n- `$svelte-5` - Svelte 5 patterns, SSR, reactivity\n- `$local-review` - Pre-PR quality checks\n- `$kspec-task-work` - Task lifecycle workflow\n","\u003C!-- kspec-managed -->\n\n# E2E Testing Skill\n\nLearnings and patterns from completed E2E work (tasks.spec.ts, items.spec.ts).\n\n## Quick Reference\n\n| Scenario | Pattern | Example |\n|----------|---------|---------|\n| Isolated daemon | `import { test } from '..\u002Ffixtures\u002Ftest-base'` | Every E2E test |\n| Select dropdown (bits-ui) | Click trigger → `getByRole('option')` or `locator('[data-slot=\"select-item\"]')` | Filter tests |\n| Text input | `pressSequentially()` with delay | Tag filter |\n| Wait for API | `waitForRequest()` | Action tests |\n| Wait for URL | `waitForURL(\u002Fpattern\u002F)` | Navigation tests |\n| Scoped selectors | `.locator('> div').first().getByTestId()` | Tree nav |\n| Content check | `toContainText()` not just `toBeVisible()` | All tests |\n\n## Fixture Architecture\n\n### Test-base.ts Pattern\n\nThe `test-base.ts` fixture creates a completely isolated environment per test:\n\n```typescript\n\u002F\u002F Key steps performed automatically:\n1. Create temp dir with .kspec\u002F subdirectory\n2. Copy E2E fixtures from tests\u002Fe2e\u002Ffixtures\u002F\n3. Initialize git repo with test user config\n4. Create fake shadow worktree structure:\n   - .git\u002Fworktrees\u002F-kspec\u002F directory\n   - .kspec\u002F.git file with \"gitdir:\" pointer\n5. Allocate ephemeral port (OS-assigned, never hardcoded)\n6. Start daemon via node + CLI_PATH (no npm link needed)\n7. Set WEB_UI_DIR for static serving\n8. Poll health endpoint until ready\n9. Provide isolated fixture to test\n10. Cleanup: stop daemon, remove temp directory\n```\n\n**Key file locations:**\n- `tests\u002Fe2e\u002Ffixtures\u002F` - E2E YAML fixtures and test-base.ts\n- `tests\u002Fe2e\u002F*.spec.ts` - Test files\n- `playwright.config.ts` - Playwright config (root level)\n\n### Fixture Isolation is Non-Negotiable\n\nE2E fixtures MUST be separate from unit test fixtures:\n\n```\ntests\u002Ffixtures\u002F           ← Unit test fixtures (shared)\ntests\u002Fe2e\u002Ffixtures\u002F       ← E2E fixtures (isolated)\n```\n\n**Why:** E2E daemon mutations affect fixtures. Unit tests need stable data.\n\n## ULID Format Requirements\n\n**Critical:** ULIDs use Crockford base32 which **excludes I, L, O, U**.\n\n```typescript\n\u002F\u002F INVALID ULIDs - contain forbidden characters\n'01TASK100...'   \u002F\u002F I is invalid\n'01MODULE0...'   \u002F\u002F O and U are invalid\n'01TRAIT10...'   \u002F\u002F I is invalid\n\n\u002F\u002F VALID ULIDs - only 0-9, A-H, J-K, M-N, P-T, V-Z\n'01TASK0000...'  \u002F\u002F T, A, S, K are all valid\n'01TRATT100...'  \u002F\u002F No I, L, O, U\n```\n\n**Recommendation:** Use `testUlid()` helper from `tests\u002Fhelpers\u002Fcli.ts`:\n\n```typescript\nimport { testUlid, testUlids } from '..\u002F..\u002Fhelpers\u002Fcli';\n\nconst taskId = testUlid('TASK');     \u002F\u002F '01TASK00000000000000000000'\nconst traitId = testUlid('TRAIT');   \u002F\u002F '01TRAJT0000000000000000000' (I auto-replaced)\nconst [id1, id2, id3] = testUlids('TASK', 3);\n```\n\n## Svelte 5 SSR\u002FHydration Gotchas\n\n### Problem: $state Variables Don't React After Hydration\n\n**Symptom:** Detail panel state updates correctly but UI doesn't re-render.\n\n**Root cause:** `adapter-static` pre-renders pages. After hydration, reactive subscriptions with `$state` can disconnect.\n\n**Solution 1 (Preferred):** Disable SSR for interactive pages\n\n```typescript\n\u002F\u002F +page.ts\nexport const ssr = false;\n```\n\n**Solution 2:** Use $state object pattern with flushSync\n\n```typescript\nlet panel = $state\u003C{ open: boolean; task: Task | null }>({\n  open: false,\n  task: null\n});\n\n\u002F\u002F When updating, use flushSync for synchronous DOM update\nimport { flushSync } from 'svelte';\n\nflushSync(() => {\n  panel.task = task;\n  panel.open = true;\n});\n```\n\n### Problem: URL Param Changes Don't Trigger Reactivity\n\n**Symptom:** Clicking navigation that uses `goto()` doesn't reload data.\n\n**Root cause:** Client-side navigation bypasses component mount.\n\n**Solution:** Use reactive `$:` blocks instead of `onMount`:\n\n```typescript\n\u002F\u002F BAD - only runs once\nonMount(() => {\n  loadItem(ref);\n});\n\n\u002F\u002F GOOD - reacts to URL changes\n$: if (ref && open) {\n  loadItem(ref);\n}\n```\n\n### Problem: bits-ui Select Returns Array\n\n**Symptom:** Selecting \"in_progress\" produces `['i', 'n', '_', 'p', 'r', 'o', 'g', 'r', 'e', 's', 's', 'in_progress']`\n\n**Solution:** Take last element if array:\n\n### bits-ui Select E2E Selectors\n\nbits-ui Select components use **both** standard ARIA roles and `data-slot` attributes. Either selector approach works:\n\n```typescript\n\u002F\u002F Open dropdown\nawait page.getByTestId('my-select-trigger').click();\n\n\u002F\u002F Option 1: Standard ARIA role (recommended - more semantic)\nawait page.getByRole('option', { name: 'Option Name' }).click();\n\n\u002F\u002F Option 2: data-slot attribute (alternative)\nconst dropdown = page.locator('[data-slot=\"select-content\"]');\nawait dropdown.locator('[data-slot=\"select-item\"]').filter({ hasText: 'Option Name' }).click();\n```\n\n**Note:** Each select item element has both `role=\"option\"` and `data-slot=\"select-item\"` attributes.\n\n```typescript\nfunction updateFilter(key: string, value: string | string[] | undefined) {\n  let actualValue: string | undefined;\n  if (Array.isArray(value)) {\n    actualValue = value.length > 0 ? value[value.length - 1] : undefined;\n  } else {\n    actualValue = value;\n  }\n  \u002F\u002F ... rest of filter logic\n}\n```\n\n## Common Test Patterns\n\n### Filter Testing\n\n```typescript\n\u002F\u002F Select dropdown - both role=\"option\" and data-slot work\nconst filterStatus = page.getByTestId('filter-status');\nawait filterStatus.click();\n\n\u002F\u002F Click option using ARIA role (recommended)\nawait page.getByRole('option', { name: 'Pending', exact: true }).click();\nawait page.waitForURL(\u002Fstatus=pending\u002F);\n\n\u002F\u002F Text input - use pressSequentially, not fill()\nconst filterTag = page.getByTestId('filter-tag');\nawait filterTag.click();\nawait filterTag.pressSequentially('e2e', { delay: 50 });\nawait page.waitForURL(\u002Ftag=e2e\u002F);\n```\n\n### Detail Panel Testing\n\n```typescript\n\u002F\u002F Open panel\nconst item = page.getByTestId('list-item').first();\nawait item.click();\n\n\u002F\u002F Verify panel content\nconst panel = page.getByTestId('detail-panel');\nawait expect(panel).toBeVisible();\nawait expect(panel.getByTestId('title')).toContainText('Expected Title');\n```\n\n### API Request Verification\n\n```typescript\n\u002F\u002F Verify API call was made, not just UI state\nconst requestPromise = page.waitForRequest((req) =>\n  req.url().includes('\u002Fapi\u002Ftasks\u002F') && req.url().includes('\u002Fstart')\n);\nawait startButton.click();\nconst request = await requestPromise;\nexpect(request.method()).toBe('POST');\n```\n\n### Tree\u002FHierarchy Navigation\n\n```typescript\n\u002F\u002F Get module node\nconst specTree = page.getByTestId('spec-tree').first();\nconst moduleNode = specTree.locator('[data-testid*=\"tree-node-module\"]').first();\n\n\u002F\u002F Expand module (expand toggle is sibling to node-title)\nconst expandToggle = moduleNode.locator('> div').first().getByTestId('expand-toggle');\nawait expandToggle.click();\n\n\u002F\u002F Find child feature after expansion\nconst childContainer = moduleNode.getByTestId('tree-node-child');\nconst featureNode = childContainer.locator('[data-testid*=\"tree-node-feature\"]').first();\nawait expect(featureNode).toBeVisible();\n```\n\n### Navigation Verification\n\n```typescript\n\u002F\u002F Verify navigation occurred\nconst link = page.getByTestId('spec-ref-link');\nawait link.click();\nawait page.waitForURL(\u002F\\\u002Fitems\\?ref=\u002F);\n\n\u002F\u002F Verify content loaded after navigation\nconst detail = page.getByTestId('item-detail');\nawait expect(detail).toBeVisible();\n```\n\n## data-testid Conventions\n\n| Component | Pattern | Example |\n|-----------|---------|---------|\n| Lists | `{entity}-list` | `task-list`, `spec-tree` |\n| List items | `{entity}-list-item` or `tree-node-{type}` | `task-list-item`, `tree-node-module` |\n| Detail panels | `{entity}-detail-panel` | `task-detail-panel`, `spec-detail-panel` |\n| Filters | `filter-{name}` | `filter-status`, `filter-tag` |\n| Badges | `{entity}-{field}` | `task-status-badge`, `task-priority` |\n| Buttons | `{action}-{entity}-button` or `{action}-button` | `start-task-button`, `expand-toggle` |\n| Counts | `{entity}-count-{status}` | `task-count-ready`, `task-count-blocked` |\n\n## WebSocket Testing\n\n### Current Limitation\n\nDaemon WebSocket in E2E tests returns 200 instead of 101 for upgrade handshake.\n\n**Impact:** WebSocket connection tests fail in E2E environment.\n\n### Workaround Options\n\n1. **Skip with documentation:**\n   ```typescript\n   test.skip('counts animate on WebSocket update', async ({ page }) => {\n     \u002F\u002F Skipped: Daemon WebSocket upgrade returns 200 in E2E environment\n     \u002F\u002F See: AGENTS.md \"CI Limitations\" section\n   });\n   ```\n\n2. **Test API triggers instead:** Verify API calls that would trigger WebSocket events:\n   ```typescript\n   test('task update triggers refetch', async ({ page, daemon }) => {\n     \u002F\u002F Trigger update via API\n     const response = await fetch(`${daemon.url}\u002Fapi\u002Ftasks\u002F${id}\u002Fstart`, {\n       method: 'POST'\n     });\n     expect(response.ok).toBe(true);\n\n     \u002F\u002F Verify UI updates (without WebSocket, need page reload)\n     await page.reload();\n     await expect(page.getByTestId('task-status')).toContainText('In Progress');\n   });\n   ```\n\n### When WebSocket Works\n\nFull test pattern for future:\n```typescript\ntest('counts animate on update', async ({ page, daemon }) => {\n  await page.goto('\u002F');\n\n  \u002F\u002F Get initial count\n  const countEl = page.getByTestId('task-count-in_progress');\n  const initialCount = await countEl.textContent();\n\n  \u002F\u002F Trigger task start via API\n  await fetch(`${daemon.url}\u002Fapi\u002Ftasks\u002F${taskId}\u002Fstart`, { method: 'POST' });\n\n  \u002F\u002F Wait for animation class\n  await expect(countEl).toHaveClass(\u002Fanimate-pulse\u002F);\n\n  \u002F\u002F Verify count changed\n  await expect(countEl).not.toContainText(initialCount!);\n});\n```\n\n## New E2E Test Checklist\n\nBefore writing a new E2E test:\n\n- [ ] Fixtures have required data (tasks, items, meta with variety)\n- [ ] ULIDs are valid Crockford base32 (no I, L, O, U)\n- [ ] Import from `..\u002Ffixtures\u002Ftest-base` (not Playwright direct)\n- [ ] Use `daemon` fixture parameter for isolated environment\n- [ ] Components have data-testid attributes for selectors\n- [ ] Use scoped selectors with `.first()` for ambiguous queries\n- [ ] Verify API calls with `waitForRequest()`, not just UI\n- [ ] Check URL params with `waitForURL()` for navigation tests\n- [ ] Test content with `toContainText()`, not just visibility\n- [ ] Include variety: happy path, edge cases, responsive\n\n## Fixture Data Requirements\n\n### Task Status Variety\n\nFixtures should include tasks with all statuses:\n- `pending` (ready - no unmet dependencies)\n- `in_progress` (started)\n- `pending_review` (code done, awaiting merge)\n- `blocked` (has unmet dependencies)\n- `completed` (done)\n\n### Hierarchy for Tree Tests\n\n```yaml\nmodules:\n  - _ulid: 01M0DULE00000000000000000\n    type: module\n    features:\n      - _ulid: 01FEATURE0000000000000000\n        type: feature\n        requirements:\n          - _ulid: 01REQVREMENT000000000000\n            type: requirement\n```\n\n### Linked Data\n\n- Tasks with `spec_ref` pointing to spec items\n- Items with `traits` array referencing trait items\n- Observations with `spec_ref` or `task_ref` links\n\n## Debugging Tips\n\n### Test Passes Locally, Fails in CI\n\n1. **Check file watchers:** CI containers don't support recursive `fs.watch`. Tests using watchers are skipped in CI.\n2. **Check port conflicts:** E2E uses port 3456. Previous daemon may not have cleaned up.\n3. **Check fixture paths:** CI paths may differ. Use relative paths in fixtures.\n\n### Element Not Found\n\n1. **SSR timing:** Add `{ timeout: 5000 }` to assertions\n2. **Scope correctly:** Use `element.getByTestId()` not `page.getByTestId()`\n3. **Wait for load:** `await page.waitForLoadState('networkidle')`\n\n### State Not Updating\n\n1. **Check SSR:** Add `export const ssr = false` to page\n2. **Check reactivity:** Use `$:` blocks for URL-driven state\n3. **Check flushSync:** For synchronous DOM updates\n\n## Anti-Patterns\n\n### Don't: Conditional Assertions\n\n```typescript\n\u002F\u002F BAD - hides failures\nif (await element.isVisible()) {\n  await expect(element).toContainText('value');\n}\n\n\u002F\u002F GOOD - fails clearly\nawait expect(element).toBeVisible();\nawait expect(element).toContainText('value');\n```\n\n### Don't: Share Fixtures with Unit Tests\n\n```typescript\n\u002F\u002F BAD - mutations affect unit tests\nawait copyFixtures('..\u002F..\u002Ftests\u002Ffixtures\u002F');\n\n\u002F\u002F GOOD - isolated E2E fixtures\nawait copyFixtures('..\u002Ffixtures\u002F');  \u002F\u002F tests\u002Fe2e\u002Ffixtures\u002F\n```\n\n### Don't: Test UI State Only\n\n```typescript\n\u002F\u002F BAD - doesn't verify API call\nawait startButton.click();\nawait expect(statusBadge).toContainText('In Progress');\n\n\u002F\u002F GOOD - verifies both\nconst req = await page.waitForRequest(r => r.url().includes('\u002Fstart'));\nexpect(req.method()).toBe('POST');\nawait expect(statusBadge).toContainText('In Progress');\n```\n\n## Related Skills\n\n- `$svelte-5` - Svelte 5 patterns, SSR, reactivity\n- `$local-review` - Pre-PR quality checks\n- `$kspec-task-work` - Task lifecycle workflow\n",{"name":5,"description":7},"main","c4b0de3035f8512bba7eb0a9b4e39ea2fbd3f08e",".agents\u002Fskills\u002Fe2e",2,"https:\u002F\u002Fgithub.com\u002Flepahc\u002Fkynetic-spec","https:\u002F\u002Fgithub.com\u002Flepahc","2026-07-22 18:57:40",{"source":9,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add lepahc\u002Fkynetic-spec --skill e2e",{"tool":59,"command":60},"bunx","bunx skills add lepahc\u002Fkynetic-spec --skill e2e",{"tool":62,"command":63},"pnpm","pnpm dlx skills add lepahc\u002Fkynetic-spec --skill e2e","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flepahc\u002Fkynetic-spec\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fe2e\u002FSKILL.md",true,[],[68,83,96,109,122,135],{"skillNo":69,"name":70,"nameZh":71,"description":16,"descriptionZh":72,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":10,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":73,"categories":74,"keywords":81,"publishedAt":41},"01M6C7KCZE43MDZ74FV3A5TDCQ","writing-specs","技术规格文档撰写","","https:\u002F\u002Fgithub.com\u002Flepahc\u002Fkynetic-spec\u002Fblob\u002Fmain\u002Ftemplates\u002Fskills\u002Fwriting-specs\u002FSKILL.md",[75,78],{"categoryNo":76,"categoryName":77,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8BVB0FJ0RR8KXYVFTKEA3XX","技术文档工程师",{"categoryNo":79,"categoryName":80,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8C5C7NGT4DWWBE15R6QGEX5","技术文档编写",[31,82],"writing specs",{"skillNo":84,"name":85,"nameZh":86,"description":16,"descriptionZh":72,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":10,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":87,"categories":88,"keywords":95,"publishedAt":41},"01M6C7KAK9CBJ87PX3BCW7B7YG","triage","问题分诊分类","https:\u002F\u002Fgithub.com\u002Flepahc\u002Fkynetic-spec\u002Fblob\u002Fmain\u002Ftemplates\u002Fskills\u002Ftriage\u002FSKILL.md",[89,92],{"categoryNo":90,"categoryName":91,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8BS5011KJDVSRXG1DC4P666","普通用户",{"categoryNo":93,"categoryName":94,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8C2MZSDTE56BDKER3VPW2JM","工单与问题跟踪管理",[85],{"skillNo":97,"name":98,"nameZh":99,"description":16,"descriptionZh":72,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":10,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":100,"categories":101,"keywords":106,"publishedAt":41},"01M6C7K89VN6FJCT8M86K56EE8","triage-inbox","收件箱分诊整理","https:\u002F\u002Fgithub.com\u002Flepahc\u002Fkynetic-spec\u002Fblob\u002Fmain\u002Ftemplates\u002Fskills\u002Ftriage-inbox\u002FSKILL.md",[102,103],{"categoryNo":90,"categoryName":91,"taxonomyType":22,"taxonomyTypeDesc":23},{"categoryNo":104,"categoryName":105,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8CA5BYP6JTMPXCGK1Y0G4M3","邮件检索与管理",[85,107,108],"inbox","triage inbox",{"skillNo":110,"name":111,"nameZh":112,"description":16,"descriptionZh":72,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":10,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":113,"categories":114,"keywords":119,"publishedAt":41},"01M6C7K6F2342AC1TJCN9PM0ZB","triage-automation","任务分诊自动化","https:\u002F\u002Fgithub.com\u002Flepahc\u002Fkynetic-spec\u002Fblob\u002Fmain\u002Ftemplates\u002Fskills\u002Ftriage-automation\u002FSKILL.md",[115,118],{"categoryNo":116,"categoryName":117,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8BRZZF9D7PVFN5MXSPWWD61","AI 工程师",{"categoryNo":93,"categoryName":94,"taxonomyType":27,"taxonomyTypeDesc":28},[85,120,121],"automation","triage automation",{"skillNo":123,"name":124,"nameZh":125,"description":16,"descriptionZh":72,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":10,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":126,"categories":127,"keywords":132,"publishedAt":41},"01M6C7K3TFQ88QQBW3PXYDHQG2","task-work","任务执行","https:\u002F\u002Fgithub.com\u002Flepahc\u002Fkynetic-spec\u002Fblob\u002Fmain\u002Ftemplates\u002Fskills\u002Ftask-work\u002FSKILL.md",[128,129],{"categoryNo":116,"categoryName":117,"taxonomyType":22,"taxonomyTypeDesc":23},{"categoryNo":130,"categoryName":131,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8BSFHC0DJXKNN0QBZDDS4K9","定时任务与自动化编排",[133,134],"work","task work",{"skillNo":136,"name":137,"nameZh":138,"description":16,"descriptionZh":72,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":10,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":139,"categories":140,"keywords":147,"publishedAt":41},"01M6C7K168CH3XJCC3PDGA9H6C","review","成果审查","https:\u002F\u002Fgithub.com\u002Flepahc\u002Fkynetic-spec\u002Fblob\u002Fmain\u002Ftemplates\u002Fskills\u002Freview\u002FSKILL.md",[141,144],{"categoryNo":142,"categoryName":143,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8BQ6TQZN6R52WBJ9H8NRMQM","软件开发工程师",{"categoryNo":145,"categoryName":146,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8C48JNVH0P83Z0KVKAQ4819","成果验证与价值评估",[137]]