oneie 3.6.6 → 3.6.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/.claude/agents/agent-backend.md +83 -0
  2. package/.claude/agents/agent-designer.md +97 -0
  3. package/.claude/agents/agent-director.md +118 -7
  4. package/.claude/agents/agent-documenter.md +93 -0
  5. package/.claude/agents/agent-frontend.md +96 -0
  6. package/.claude/agents/agent-ops.md +182 -25
  7. package/.claude/agents/agent-problem-solver.md +166 -0
  8. package/.claude/agents/agent-quality.md +127 -0
  9. package/.claude/commands/build.md +293 -0
  10. package/.claude/commands/cascade.md +231 -127
  11. package/.claude/commands/mcp-toggle.md +93 -0
  12. package/.claude/commands/onboard.md +179 -0
  13. package/.claude/commands/one.md +236 -516
  14. package/.claude/commands/plan.md +394 -80
  15. package/.claude/commands/release.md +41 -19
  16. package/.claude/commands/server.md +335 -0
  17. package/.claude/hooks/root-cleanup.py +75 -0
  18. package/.claude/skills/INDEX.md +523 -0
  19. package/.claude/skills/REGISTRY.md +529 -0
  20. package/.claude/skills/agent-backend-create-mutation.md +319 -0
  21. package/.claude/skills/agent-designer-create-wireframe.md +341 -0
  22. package/.claude/skills/agent-frontend-create-page.md +413 -0
  23. package/.claude/skills/agents/README.md +238 -0
  24. package/dist/clone-web.js +1 -1
  25. package/dist/clone-web.js.map +1 -1
  26. package/folders.yaml +1 -1
  27. package/one/.obsidian/workspace.json +38 -38
  28. package/one/connections/api/queries-reference.md +842 -0
  29. package/one/connections/api-reference.md +1011 -0
  30. package/one/connections/integration-examples.md +875 -0
  31. package/one/connections/integration-guide.md +869 -0
  32. package/one/connections/integration-phase2.md +736 -0
  33. package/one/events/API_ROUTES_FIXES_SUMMARY.md +262 -0
  34. package/one/events/ASTRO-INTEGRATION-EXAMPLES.md +636 -0
  35. package/one/events/BEFORE_AFTER_COMPARISON.md +960 -0
  36. package/one/events/CONNECTIONS_DEMO.md +501 -0
  37. package/one/events/DELIVERABLES.md +432 -0
  38. package/one/events/DEMO-GROUPS-PAGE.md +392 -0
  39. package/one/events/DEMO-TESTING-SUMMARY.md +518 -0
  40. package/one/events/DEMO_COMPONENTS.md +487 -0
  41. package/one/events/DEMO_HOOKS_INDEX.md +334 -0
  42. package/one/events/DEMO_INFRASTRUCTURE.md +905 -0
  43. package/one/events/DEMO_INFRASTRUCTURE_SUMMARY.md +570 -0
  44. package/one/events/DEMO_INTEGRATION_CHECKLIST.md +431 -0
  45. package/one/events/DEMO_QUICK_REFERENCE.md +441 -0
  46. package/one/events/DEMO_SETUP.md +476 -0
  47. package/one/events/EFFECT_TS_API_PATTERN.md +478 -0
  48. package/one/events/GROUPS_DEMO_IMPLEMENTATION.md +414 -0
  49. package/one/events/HOOKS-DEMO.md +441 -0
  50. package/one/events/ONTOLOGY-HOOKS-README.md +700 -0
  51. package/one/events/ONTOLOGY-INTEGRATION-MANIFEST.md +365 -0
  52. package/one/events/QA-CHECKLIST.md +674 -0
  53. package/one/events/QUICK-START-ONTOLOGY.md +408 -0
  54. package/one/events/SEARCH_DEMO_CODE_REFERENCE.md +639 -0
  55. package/one/events/SEARCH_DEMO_DELIVERY.md +415 -0
  56. package/one/events/SEARCH_DEMO_SUMMARY.md +303 -0
  57. package/one/events/SEARCH_DEMO_VISUAL_GUIDE.md +381 -0
  58. package/one/events/TEST-PLAN-INDEX.md +346 -0
  59. package/one/events/TEST-PLAN.md +1417 -0
  60. package/one/events/TESTING-DELIVERY.txt +372 -0
  61. package/one/events/TRANSITIONS-QUICK-START.md +141 -0
  62. package/one/events/TYPESCRIPT_FIXES.md +152 -0
  63. package/one/events/TYPESCRIPT_FIXES_COMPLETE.txt +412 -0
  64. package/one/events/TYPESCRIPT_FIXES_INDEX.md +341 -0
  65. package/one/events/VIEW-TRANSITIONS.md +428 -0
  66. package/one/events/backend-integration-tests.md +606 -0
  67. package/one/events/backend-structure-diagram.txt +393 -0
  68. package/one/events/backend-structure-summary.txt +269 -0
  69. package/one/events/cloudflare-pages-infrastructure-setup.md +264 -0
  70. package/one/events/convex-analysis-index.md +304 -0
  71. package/one/events/convex-structure-analysis.md +700 -0
  72. package/one/events/design-spec-complete.md +208 -0
  73. package/one/events/ontology-test-examples.md +562 -0
  74. package/one/events/phase1-backend-implementation-complete.md +518 -0
  75. package/one/events/test-dashboard.md +345 -0
  76. package/one/events/test-index.md +361 -0
  77. package/one/events/test-report-ontology.md +582 -0
  78. package/one/events/testing-summary.md +344 -0
  79. package/one/groups/features.md +2878 -0
  80. package/one/groups/strategy copy.md +869 -0
  81. package/one/knowledge/backend-api-reference.md +710 -0
  82. package/one/knowledge/documentation-summary.md +285 -0
  83. package/one/knowledge/lessons-learned.md +294 -4
  84. package/one/knowledge/ontology-visual-guide.md +360 -0
  85. package/one/knowledge/ontology.md +9 -17
  86. package/one/things/demo-accessibility-animations.md +999 -0
  87. package/one/things/demo-components.md +1304 -0
  88. package/one/things/demo-design-summary.md +629 -0
  89. package/one/things/demo-design-system.md +919 -0
  90. package/one/things/demo-page-layouts.md +989 -0
  91. package/one/things/designs/accessibility-audit.md +790 -0
  92. package/one/things/designs/component-specifications.md +757 -0
  93. package/one/things/designs/design-overview.md +318 -0
  94. package/one/things/designs/design-tokens.md +414 -0
  95. package/one/things/designs/wireframes-dashboard.md +653 -0
  96. package/one/things/docs/api-requests.md +923 -0
  97. package/one/things/features/0 All Features.md +2 -0
  98. package/one/things/implementation/backend-guide.md +412 -0
  99. package/one/things/plans/2-backend-agnostic-frontend.md +11 -8
  100. package/one/things/plans/ai-elements.md +1259 -0
  101. package/one/things/plans/ai-integration.md +947 -0
  102. package/one/things/plans/ai-sdk.md +761 -0
  103. package/one/things/plans/app.md +1 -1
  104. package/one/things/plans/architecture-summary.md +283 -0
  105. package/one/things/plans/async-ai-agents.md +215 -0
  106. package/one/things/plans/backend-agnostic-frontend.md +11 -6
  107. package/one/things/plans/backend-cleanup-quickstart.md +346 -0
  108. package/one/things/plans/backend-ontology-conformance.md +416 -0
  109. package/one/things/plans/backend-status.md +541 -0
  110. package/one/things/plans/backend-structure.md +799 -0
  111. package/one/things/plans/backend-target-structure.md +438 -0
  112. package/one/things/plans/backend.md +1133 -0
  113. package/one/things/plans/better-auth-any-backend.md +11 -11
  114. package/one/things/plans/cli-updates-required.md +280 -0
  115. package/one/things/plans/complete-step-by-step.md +1302 -0
  116. package/one/things/plans/convex-agents.md +1005 -0
  117. package/one/things/plans/deployment-architecture.md +426 -0
  118. package/one/things/plans/development-plan.md +1220 -0
  119. package/one/things/plans/effect.md +808 -48
  120. package/one/things/plans/integrate-frontend-and-backend.md +579 -0
  121. package/one/things/plans/mcp-clear-context-prompt.md +60 -0
  122. package/one/things/plans/mcp-simple.md +228 -0
  123. package/one/things/plans/one.md +8 -7
  124. package/one/things/plans/ontology-6-dimensions.md +20 -14
  125. package/one/things/plans/quick-wins.md +1273 -0
  126. package/one/things/plans/readme-backend-cleanup.md +361 -0
  127. package/one/things/plans/separate-demo.md +830 -0
  128. package/one/things/plans/separate.md +3 -3
  129. package/one/things/plans/sequence.md +1897 -0
  130. package/one/things/plans/sync-checklist.md +321 -0
  131. package/one/things/plans/unified-implementation-plan.md +3 -3
  132. package/one/things/plans/update-demos.md +513 -0
  133. package/package.json +1 -1
  134. package/.claude/agents/backend-specialist.md +0 -169
  135. package/.claude/agents/designer.md +0 -216
  136. package/.claude/agents/frontend-specialist.md +0 -236
  137. package/.claude/commands/done.md +0 -35
  138. package/.claude/commands/infer.md +0 -138
  139. package/.claude/commands/next.md +0 -53
  140. package/.claude/commands/one copy.md +0 -565
  141. package/.claude/commands/one-template.md +0 -106
  142. package/.claude/commands/one-v1.md +0 -609
  143. package/.claude/hooks/__pycache__/knowledge-post.cpython-313.pyc +0 -0
  144. package/.claude/hooks/__pycache__/knowledge-pre.cpython-313.pyc +0 -0
  145. package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
  146. package/one/groups/nine-padel-customers.md +0 -138
  147. package/one/groups/nine-padel-data-structure.md +0 -167
  148. package/one/groups/nine-padel-ontology-specification.md +0 -359
  149. package/one/groups/nine-padel-ontology.md +0 -143
  150. package/one/groups/nine-padel-strategy.md +0 -234
  151. package/one/groups/nine-padel.md +0 -211
  152. package/one/groups/nine-padle-contents.baked.md +0 -1252
  153. package/one/groups/nine-padle-contents.md +0 -6
  154. package/one/things/features/1-1-agent-prompts/design.md +0 -470
  155. package/one/things/features/1-1-agent-prompts/tests.md +0 -264
  156. package/one/things/features/1-2-yaml-orchestrator/design.md +0 -497
  157. package/one/things/features/1-2-yaml-orchestrator/tests.md +0 -227
  158. package/one/things/features/1-3-event-coordination/design.md +0 -544
  159. package/one/things/features/1-3-event-coordination/tests.md +0 -223
  160. package/one/things/features/1-4-knowledge-management/design.md +0 -609
  161. package/one/things/features/1-4-knowledge-management/tests.md +0 -195
  162. package/one/things/features/1-5-quality-loops/design.md +0 -797
  163. package/one/things/features/1-5-quality-loops/tests.md +0 -212
  164. package/one/things/features/1-6-numbering-structure/design.md +0 -610
  165. package/one/things/features/1-6-numbering-structure/tests.md +0 -213
  166. package/one/things/features/dataprovider-interface/1-tests.md +0 -1522
@@ -0,0 +1,1417 @@
1
+ # Demo Testing Plan - Infer 15-20
2
+
3
+ **Status:** Test Definition Phase
4
+ **Target:** Beautiful, Interactive 6-Dimension Demos
5
+ **Quality Gate:** 80%+ Coverage, All Acceptance Criteria Met
6
+
7
+ ---
8
+
9
+ ## 1. Test Overview
10
+
11
+ ### Purpose
12
+ Comprehensive testing strategy for 6-dimension ontology demo pages, ensuring complete backend-agnostic integration with real Convex API or mock providers.
13
+
14
+ ### Scope
15
+ - **Frontend Pages:** `/demo/index`, `/demo/groups`, `/demo/people`, `/demo/things`, `/demo/connections`, `/demo/events`, `/demo/search`
16
+ - **React Components:** `HooksDemo`, `SearchDemo`, `PeopleDemo` + all dimension-specific demos
17
+ - **Backend Connection:** Convex API at `https://shocking-falcon-870.convex.cloud`
18
+ - **Data Model:** 6-Dimension Ontology (groups, people, things, connections, events, knowledge)
19
+
20
+ ### Success Criteria
21
+ - All demo pages load with correct data
22
+ - Interactive CRUD operations work end-to-end
23
+ - Backend connection status properly displayed
24
+ - Error states handled gracefully
25
+ - Loading states visible during async operations
26
+ - All hooks execute without errors
27
+ - Performance targets met (< 1s page load, < 200ms API calls)
28
+ - Accessibility standards met (WCAG 2.1 AA)
29
+ - Cross-browser compatibility verified
30
+
31
+ ---
32
+
33
+ ## 2. Test Architecture
34
+
35
+ ### Test Framework Stack
36
+ ```
37
+ Vitest → Unit & Integration tests (already configured)
38
+ Playwright → E2E tests (install as dev dependency)
39
+ Testing Library → Component testing utilities
40
+ ```
41
+
42
+ ### Installation
43
+ ```bash
44
+ # Already installed
45
+ bun add -d vitest @vitest/ui @testing-library/react @testing-library/dom
46
+
47
+ # Add for E2E tests
48
+ bun add -d @playwright/test
49
+ ```
50
+
51
+ ### Test Structure
52
+ ```
53
+ tests/
54
+ ├── demo/
55
+ │ ├── e2e/ # End-to-end tests
56
+ │ │ ├── demo.spec.ts
57
+ │ │ ├── dimensions/
58
+ │ │ │ ├── groups.spec.ts
59
+ │ │ │ ├── people.spec.ts
60
+ │ │ │ ├── things.spec.ts
61
+ │ │ │ ├── connections.spec.ts
62
+ │ │ │ ├── events.spec.ts
63
+ │ │ │ └── search.spec.ts
64
+ │ │ └── features/
65
+ │ │ ├── backend-connection.spec.ts
66
+ │ │ ├── crud-operations.spec.ts
67
+ │ │ ├── error-handling.spec.ts
68
+ │ │ └── loading-states.spec.ts
69
+ │ ├── unit/ # Component & hook tests
70
+ │ │ ├── components/
71
+ │ │ │ ├── HooksDemo.test.tsx
72
+ │ │ │ ├── SearchDemo.test.tsx
73
+ │ │ │ ├── PeopleDemo.test.tsx
74
+ │ │ │ └── DemoContainer.test.tsx
75
+ │ │ └── hooks/
76
+ │ │ ├── useProvider.test.ts
77
+ │ │ ├── useGroups.test.ts
78
+ │ │ ├── useThings.test.ts
79
+ │ │ ├── useConnections.test.ts
80
+ │ │ ├── useEvents.test.ts
81
+ │ │ ├── useSearch.test.ts
82
+ │ │ └── useLabels.test.ts
83
+ │ ├── integration/ # Component integration tests
84
+ │ │ ├── demo-data-flow.test.ts
85
+ │ │ ├── provider-switching.test.ts
86
+ │ │ └── ontology-operations.test.ts
87
+ │ └── visual/ # Visual regression tests
88
+ │ ├── demo-layouts.test.ts
89
+ │ ├── dark-mode.test.ts
90
+ │ └── responsive.test.ts
91
+ └── fixtures/
92
+ ├── demo-data.ts # Test data setup
93
+ ├── mock-providers.ts # Mock provider implementations
94
+ └── seed-database.ts # Database seeding for integration tests
95
+ ```
96
+
97
+ ---
98
+
99
+ ## 3. Test Specifications (Gherkin Format)
100
+
101
+ ### 3.1 E2E Tests: Demo Index Page
102
+
103
+ **File:** `tests/demo/e2e/demo.spec.ts`
104
+
105
+ ```gherkin
106
+ Feature: Demo Index Page
107
+ As a user
108
+ I want to see the demo hub
109
+ So that I can navigate to dimension-specific demos
110
+
111
+ Background:
112
+ Given the demo index page is navigable at "/demo"
113
+ And the page title is "Demo - Frontend-Backend Integration"
114
+
115
+ Scenario: Page loads successfully
116
+ When I visit "/demo"
117
+ Then the page should load in less than 1 second
118
+ And I should see the hero section with title "Demo: Frontend-Backend Integration"
119
+ And I should see 4 status badges: "Production Ready", "Full Type Safe", "Backend Agnostic"
120
+
121
+ Scenario: Navigation cards are visible
122
+ When I visit "/demo"
123
+ Then I should see navigation cards for all 6 dimensions:
124
+ | Dimension | Icon | Description |
125
+ | Groups | 👥 | Multi-tenant isolation |
126
+ | People | 👤 | Authorization & roles |
127
+ | Things | 📦 | Entities & objects |
128
+ | Connections | 🔗 | Relationships |
129
+ | Events | 📊 | Audit trail |
130
+ | Search | 🔍 | Semantic search |
131
+ And each card should link to correct route
132
+ And cards should have hover effects
133
+
134
+ Scenario: Statistics panel displays correctly
135
+ Given backend connection is available
136
+ When I visit "/demo"
137
+ Then I should see statistics showing:
138
+ | Statistic | Data Point |
139
+ | Total Groups | Count of groups |
140
+ | Total Things | Count of things |
141
+ | Active Events | Count of events |
142
+
143
+ Scenario: Backend connection status displayed
144
+ When I visit "/demo"
145
+ And I wait for provider check (< 200ms)
146
+ Then I should see connection status indicator:
147
+ | Backend Status | Indicator Color | Message |
148
+ | Connected | Green | "Backend Ready" |
149
+ | Disconnected | Red | "Mock Data Mode"|
150
+
151
+ Scenario: Error handling on failed load
152
+ Given backend API returns error
153
+ When I visit "/demo"
154
+ Then I should see error alert with message
155
+ And I should see graceful fallback to mock data
156
+ And navigation cards should still be accessible
157
+ ```
158
+
159
+ ### 3.2 E2E Tests: Dimension Pages (Groups, People, Things, etc.)
160
+
161
+ **File:** `tests/demo/e2e/dimensions/groups.spec.ts` (pattern for all dimensions)
162
+
163
+ ```gherkin
164
+ Feature: Groups Dimension Demo
165
+ As a developer
166
+ I want to interact with groups data
167
+ So that I can understand the multi-tenant model
168
+
169
+ Background:
170
+ Given I am on "/demo/groups"
171
+ And backend provider is initialized
172
+
173
+ Scenario: Groups page loads with data
174
+ When I visit "/demo/groups"
175
+ Then page should load in less than 1 second
176
+ And I should see heading "Groups: Multi-Tenant Isolation"
177
+ And I should see list of groups from backend
178
+
179
+ Scenario: Create new group (CRUD: Create)
180
+ When I visit "/demo/groups"
181
+ And I fill in the create group form:
182
+ | Field | Value |
183
+ | Name | "Test Group" |
184
+ | Type | "organization" |
185
+ | Description | "Demo group" |
186
+ And I click "Create Group"
187
+ Then I should see success message
188
+ And new group should appear in list within 500ms
189
+ And new group connection event should be logged
190
+
191
+ Scenario: Read group details
192
+ Given groups exist in database
193
+ When I visit "/demo/groups"
194
+ And I click on a group in the list
195
+ Then I should see group details panel:
196
+ - Group name
197
+ - Group type (organization, business, community, etc.)
198
+ - Parent group (if applicable)
199
+ - Member count
200
+ - Created date
201
+ And the panel should load within 300ms
202
+
203
+ Scenario: Update group properties
204
+ Given a group is selected
205
+ When I click "Edit" button
206
+ And I update group name from "Old Name" to "New Name"
207
+ And I click "Save"
208
+ Then I should see success notification
209
+ And group name should update in list within 500ms
210
+ And event_updated event should be logged
211
+
212
+ Scenario: Delete/Archive group
213
+ Given a test group exists
214
+ When I click "Delete" on the group
215
+ And I confirm the deletion
216
+ Then group should be archived (not deleted)
217
+ And group should disappear from active list
218
+ And deletion event should be logged
219
+
220
+ Scenario: Error handling for invalid operations
221
+ When I try to create group without name
222
+ Then I should see validation error: "Name is required"
223
+ And form should not submit
224
+ And no event should be logged
225
+
226
+ Scenario: Hierarchical groups display
227
+ Given parent and child groups exist
228
+ When I visit "/demo/groups"
229
+ Then I should see hierarchical structure:
230
+ - Parent group expanded
231
+ - Child groups indented under parent
232
+ - Can collapse/expand parent
233
+
234
+ Scenario: Performance: List 100 groups efficiently
235
+ Given database has 100+ groups
236
+ When I visit "/demo/groups"
237
+ Then page should load within 1 second
238
+ And pagination should show 10 groups per page
239
+ And page transitions should complete within 300ms
240
+ ```
241
+
242
+ ### 3.3 E2E Tests: Things Dimension
243
+
244
+ **File:** `tests/demo/e2e/dimensions/things.spec.ts`
245
+
246
+ ```gherkin
247
+ Feature: Things Dimension Demo
248
+ As a developer
249
+ I want to interact with things (entities)
250
+ So that I can understand the entity model
251
+
252
+ Scenario: Things page loads with filters
253
+ When I visit "/demo/things"
254
+ Then I should see filter options:
255
+ | Filter Type | Options |
256
+ | Type | course, blog_post... |
257
+ | Status | draft, active, etc |
258
+ | Created | last week, etc |
259
+
260
+ Scenario: Filter things by type
261
+ When I visit "/demo/things"
262
+ And I select filter "type: course"
263
+ Then list should update within 300ms
264
+ And all visible things should have type "course"
265
+
266
+ Scenario: Search things by name
267
+ When I visit "/demo/things"
268
+ And I type "React" in search box
269
+ And I wait 300ms for debounce
270
+ Then results should show things matching "React"
271
+ And search should complete within 500ms
272
+
273
+ Scenario: Create thing with properties
274
+ When I click "Create Thing" button
275
+ And I fill in the form:
276
+ | Field | Value |
277
+ | Type | "course" |
278
+ | Name | "React Fundamentals" |
279
+ | Properties | {description, price} |
280
+ And I click "Create"
281
+ Then thing should appear in list
282
+ And thing_created event should be logged
283
+ And connection to creator should be created
284
+
285
+ Scenario: View thing details
286
+ Given things exist in list
287
+ When I click on a thing
288
+ Then I should see detail panel with:
289
+ - Thing name and type
290
+ - Full properties object
291
+ - All connections (incoming and outgoing)
292
+ - Activity timeline (events)
293
+
294
+ Scenario: Update thing properties
295
+ Given a thing detail panel is open
296
+ When I click "Edit"
297
+ And I update property "price" from "99" to "149"
298
+ And I click "Save"
299
+ Then thing should update in list
300
+ And thing_updated event should be logged
301
+
302
+ Scenario: Performance: Search 500 things
303
+ Given database has 500+ things
304
+ When I type search query
305
+ Then search should complete within 500ms
306
+ And results should be paginated
307
+ ```
308
+
309
+ ### 3.4 E2E Tests: Connections Dimension
310
+
311
+ **File:** `tests/demo/e2e/dimensions/connections.spec.ts`
312
+
313
+ ```gherkin
314
+ Feature: Connections Dimension Demo
315
+ As a developer
316
+ I want to see relationships between entities
317
+ So that I can understand the connection model
318
+
319
+ Scenario: Connections graph displays
320
+ When I visit "/demo/connections"
321
+ Then I should see force-directed graph showing:
322
+ - Nodes for each thing
323
+ - Edges showing connections
324
+ - Labels for connection types (authored, owns, etc.)
325
+
326
+ Scenario: Create connection between things
327
+ When I visit "/demo/connections"
328
+ And I select source thing "Alice"
329
+ And I select target thing "React Course"
330
+ And I choose relationship type "authored"
331
+ And I click "Create Connection"
332
+ Then connection should appear on graph
333
+ And connection_created event should be logged
334
+
335
+ Scenario: Filter connections by type
336
+ When I visit "/demo/connections"
337
+ And I select relationship type filter "owns"
338
+ Then graph should show only "owns" connections
339
+ And count should update to show filtered total
340
+
341
+ Scenario: Connection metadata display
342
+ When I click on a connection edge
343
+ Then I should see metadata panel:
344
+ - From entity: [name, type]
345
+ - To entity: [name, type]
346
+ - Relationship type
347
+ - Created date
348
+ - Custom metadata (if any)
349
+
350
+ Scenario: Delete connection
351
+ Given a connection is selected
352
+ When I click "Delete" button
353
+ And I confirm
354
+ Then connection should be removed from graph
355
+ And connection_deleted event should be logged
356
+ ```
357
+
358
+ ### 3.5 E2E Tests: Events Dimension
359
+
360
+ **File:** `tests/demo/e2e/dimensions/events.spec.ts`
361
+
362
+ ```gherkin
363
+ Feature: Events Dimension Demo (Audit Trail)
364
+ As a developer
365
+ I want to see activity timeline
366
+ So that I can understand event logging
367
+
368
+ Scenario: Events timeline displays correctly
369
+ When I visit "/demo/events"
370
+ Then I should see timeline with events sorted by:
371
+ - Most recent first
372
+ - Event type badge (color-coded)
373
+ - Timestamp
374
+ - Actor information
375
+ - Event details
376
+
377
+ Scenario: Filter events by type
378
+ When I visit "/demo/events"
379
+ And I select event type filter "thing_created"
380
+ Then timeline should show only creation events
381
+ And count should update
382
+
383
+ Scenario: Filter events by date range
384
+ When I visit "/demo/events"
385
+ And I select date range "Last 7 days"
386
+ Then timeline should show only events from that period
387
+ And count should update within 300ms
388
+
389
+ Scenario: Event detail view
390
+ When I click on an event in timeline
391
+ Then I should see detail panel:
392
+ - Full event data (JSON)
393
+ - Event type
394
+ - Actor (who triggered event)
395
+ - Target (what was affected)
396
+ - Timestamp (with timezone)
397
+ - Metadata
398
+
399
+ Scenario: Performance: Load 1000 events
400
+ Given database has 1000+ events
401
+ When I visit "/demo/events"
402
+ Then page should load within 1 second
403
+ And timeline should use virtualization (show < 50 DOM nodes)
404
+ And scrolling should be smooth (60 FPS)
405
+ ```
406
+
407
+ ### 3.6 E2E Tests: Search Dimension
408
+
409
+ **File:** `tests/demo/e2e/dimensions/search.spec.ts`
410
+
411
+ ```gherkin
412
+ Feature: Search Dimension Demo (Semantic Search)
413
+ As a developer
414
+ I want to search across all entities
415
+ So that I can understand semantic search
416
+
417
+ Scenario: Search returns results
418
+ When I visit "/demo/search"
419
+ And I type "React hooks" in search box
420
+ And I wait for results (< 500ms)
421
+ Then I should see results grouped by type:
422
+ | Type | Count |
423
+ | things | N |
424
+ | events | N |
425
+ | knowledge | N |
426
+ And results should be ranked by relevance
427
+
428
+ Scenario: Search filters by dimension
429
+ When I search for "React"
430
+ And I select filter "Things only"
431
+ Then results should show only things
432
+ And no events or knowledge should appear
433
+
434
+ Scenario: Search performance
435
+ When I type multi-word query
436
+ Then results should appear within 500ms
437
+ And search should handle 10,000+ entities
438
+
439
+ Scenario: Search with no results
440
+ When I search for "zxcvbnmasdfghjkl" (nonsense)
441
+ Then I should see message: "No results found"
442
+ And I should see suggestions: "Try different keywords"
443
+ ```
444
+
445
+ ### 3.7 E2E Tests: Backend Connection & Error Handling
446
+
447
+ **File:** `tests/demo/e2e/features/backend-connection.spec.ts`
448
+
449
+ ```gherkin
450
+ Feature: Backend Connection Status
451
+ As a user
452
+ I want to know if backend is connected
453
+ So that I understand whether I'm using real or mock data
454
+
455
+ Scenario: Connected to backend
456
+ Given Convex API is available
457
+ When I load any demo page
458
+ Then I should see connection indicator "green" near title
459
+ And indicator should show "Connected to Convex"
460
+ And data should come from real backend
461
+
462
+ Scenario: Backend disconnected - graceful fallback
463
+ Given Convex API is not available
464
+ When I load any demo page
465
+ Then I should see connection indicator "red"
466
+ And I should see message: "Using mock data"
467
+ And page should still be fully functional
468
+ And operations should use in-memory mock provider
469
+
470
+ Scenario: Connection check performance
471
+ When I load any demo page
472
+ Then provider check should complete in < 200ms
473
+ And page should show loading skeleton during check
474
+ And no blocking waits for backend
475
+
476
+ Scenario: Error handling - Failed mutation
477
+ Given I am creating a thing
478
+ And backend returns HTTP 500 error
479
+ When I click "Create"
480
+ Then I should see error toast: "Failed to create thing"
481
+ And form should remain populated
482
+ And I should be able to retry
483
+
484
+ Scenario: Error handling - Network timeout
485
+ Given backend takes > 10 seconds to respond
486
+ When I make a request
487
+ Then request should timeout after 5 seconds
488
+ And I should see error message: "Request timeout"
489
+ And page should remain usable
490
+ ```
491
+
492
+ ### 3.8 E2E Tests: Performance Benchmarks
493
+
494
+ **File:** `tests/demo/e2e/features/performance.spec.ts`
495
+
496
+ ```gherkin
497
+ Feature: Performance Targets
498
+ As a platform architect
499
+ I want performance to meet standards
500
+ So that users have fast experience
501
+
502
+ Scenario: Demo index page loads < 1 second
503
+ When I navigate to "/demo"
504
+ Then page should be interactive within 1000ms
505
+ And First Contentful Paint (FCP) < 800ms
506
+ And Largest Contentful Paint (LCP) < 1200ms
507
+
508
+ Scenario: API calls complete < 200ms
509
+ When I perform any CRUD operation
510
+ Then API response time should be < 200ms
511
+ And UI should update immediately after response
512
+
513
+ Scenario: Pagination loads quickly
514
+ Given list has 1000+ items
515
+ When I navigate to page 2
516
+ Then page should load within 300ms
517
+ And no jank or visual stuttering
518
+
519
+ Scenario: Large list rendering efficient
520
+ Given I have 500 items in list
521
+ When I scroll through list
522
+ Then frame rate should be 60+ FPS
523
+ And memory usage should not increase > 50MB
524
+ And DOM should have < 100 visible nodes (virtualized)
525
+
526
+ Scenario: Search debounce working
527
+ When I type "React hooks" character by character
528
+ Then only final search should execute
529
+ And search should NOT execute on every keystroke
530
+ And search should complete within 500ms
531
+
532
+ Scenario: Lighthouse scores
533
+ When I audit any demo page with Lighthouse
534
+ Then scores should be >= 95 in all categories:
535
+ | Category | Target |
536
+ | Performance| 95+ |
537
+ | Accessibility| 95+ |
538
+ | Best Practices| 95+|
539
+ | SEO | 95+ |
540
+ ```
541
+
542
+ ### 3.9 E2E Tests: Accessibility
543
+
544
+ **File:** `tests/demo/e2e/features/accessibility.spec.ts`
545
+
546
+ ```gherkin
547
+ Feature: Accessibility Compliance (WCAG 2.1 AA)
548
+ As a user with accessibility needs
549
+ I want all demo pages to be accessible
550
+ So that everyone can use the platform
551
+
552
+ Scenario: Keyboard navigation works
553
+ When I navigate demo pages using only Tab and Enter keys
554
+ Then I should be able to:
555
+ - Tab through all interactive elements
556
+ - Activate buttons with Enter
557
+ - Navigate lists with arrow keys
558
+ - Close modals with Escape
559
+ And focus should be visible (high contrast outline)
560
+
561
+ Scenario: Screen reader compatibility
562
+ When I use screen reader to navigate
563
+ Then I should hear:
564
+ - Page title
565
+ - Navigation landmarks (nav, main, etc.)
566
+ - Button names and states
567
+ - Form labels
568
+ - Table headers and cell relationships
569
+
570
+ Scenario: Color contrast meets AA standard
571
+ When I check all text elements
572
+ Then contrast ratio should be >= 4.5:1 for normal text
573
+ And >= 3:1 for large text (18px+ or 14px+ bold)
574
+
575
+ Scenario: Images have alt text
576
+ When I inspect all images
577
+ Then each image should have:
578
+ - Meaningful alt text (not "image" or "photo")
579
+ - OR be marked as decorative with alt=""
580
+
581
+ Scenario: Form error messages accessible
582
+ When I submit invalid form
583
+ Then error messages should:
584
+ - Be clearly visible
585
+ - Associate with form field
586
+ - Be announced by screen reader
587
+ - Suggest how to fix
588
+
589
+ Scenario: Loading states announced
590
+ When I trigger async operation
591
+ Then aria-busy should be set to true
592
+ And aria-label should announce "Loading..."
593
+ And screen reader should announce completion when done
594
+ ```
595
+
596
+ ---
597
+
598
+ ## 4. Unit & Component Tests
599
+
600
+ ### 4.1 Hook Tests
601
+
602
+ **File:** `tests/demo/unit/hooks/useProvider.test.ts`
603
+
604
+ ```typescript
605
+ import { describe, it, expect, beforeEach, vi } from 'vitest';
606
+ import { renderHook, waitFor } from '@testing-library/react';
607
+ import { useProvider, useIsProviderAvailable } from '@/hooks/ontology';
608
+
609
+ describe('useProvider Hook', () => {
610
+ beforeEach(() => {
611
+ // Clear any mocks
612
+ vi.clearAllMocks();
613
+ });
614
+
615
+ it('should return provider when available', async () => {
616
+ const { result } = renderHook(() => useProvider());
617
+
618
+ expect(result.current).toBeDefined();
619
+ expect(result.current).toHaveProperty('groups');
620
+ expect(result.current).toHaveProperty('things');
621
+ expect(result.current).toHaveProperty('connections');
622
+ });
623
+
624
+ it('should check provider availability', async () => {
625
+ const { result } = renderHook(() => useIsProviderAvailable());
626
+
627
+ await waitFor(() => {
628
+ expect(typeof result.current).toBe('boolean');
629
+ });
630
+ });
631
+
632
+ it('should handle provider errors gracefully', async () => {
633
+ const { result } = renderHook(() => useProvider());
634
+
635
+ // Provider should still be available even if backend fails
636
+ expect(result.current).toBeDefined();
637
+ });
638
+
639
+ it('should use same provider instance', () => {
640
+ const { result: result1 } = renderHook(() => useProvider());
641
+ const { result: result2 } = renderHook(() => useProvider());
642
+
643
+ expect(result1.current).toBe(result2.current);
644
+ });
645
+ });
646
+ ```
647
+
648
+ **File:** `tests/demo/unit/hooks/useGroups.test.ts`
649
+
650
+ ```typescript
651
+ describe('useGroups Hook', () => {
652
+ it('should list groups successfully', async () => {
653
+ const { result } = renderHook(() => useGroups());
654
+
655
+ await waitFor(() => {
656
+ expect(result.current.groups).toBeDefined();
657
+ expect(Array.isArray(result.current.groups)).toBe(true);
658
+ });
659
+ });
660
+
661
+ it('should handle loading state', () => {
662
+ const { result } = renderHook(() => useGroups());
663
+
664
+ // Should start with loading: false (assuming cache)
665
+ expect(result.current.loading).toBeFalse();
666
+ });
667
+
668
+ it('should handle error state', async () => {
669
+ // Mock provider to fail
670
+ vi.mock('@/lib/ontology/factory', () => ({
671
+ getProvider: () => ({
672
+ groups: { list: () => Promise.reject(new Error('Failed')) }
673
+ })
674
+ }));
675
+
676
+ const { result } = renderHook(() => useGroups());
677
+
678
+ await waitFor(() => {
679
+ expect(result.current.error).toBeDefined();
680
+ });
681
+ });
682
+
683
+ it('should cache results', async () => {
684
+ const { result: result1 } = renderHook(() => useGroups());
685
+ const { result: result2 } = renderHook(() => useGroups());
686
+
687
+ await waitFor(() => {
688
+ expect(result1.current.groups).toEqual(result2.current.groups);
689
+ });
690
+ });
691
+ });
692
+ ```
693
+
694
+ Similar tests for:
695
+ - `useThings()` - Thing CRUD operations
696
+ - `useConnections()` - Connection queries
697
+ - `useEvents()` - Event timeline
698
+ - `useSearch()` - Semantic search
699
+ - `useLabels()` - Knowledge labels
700
+
701
+ ### 4.2 Component Tests
702
+
703
+ **File:** `tests/demo/unit/components/HooksDemo.test.tsx`
704
+
705
+ ```typescript
706
+ import { describe, it, expect, beforeEach, vi } from 'vitest';
707
+ import { render, screen, fireEvent, waitFor } from '@testing-library/react';
708
+ import userEvent from '@testing-library/user-event';
709
+ import { HooksDemo } from '@/components/demo/HooksDemo';
710
+ import { MockProvider } from '@/__mocks__/providers';
711
+
712
+ describe('HooksDemo Component', () => {
713
+ beforeEach(() => {
714
+ // Mock provider
715
+ vi.mock('@/hooks/ontology', () => ({
716
+ useProvider: () => new MockProvider(),
717
+ useIsProviderAvailable: () => true,
718
+ }));
719
+ });
720
+
721
+ it('should render demo buttons for each hook', () => {
722
+ render(<HooksDemo />);
723
+
724
+ expect(screen.getByText('useProvider')).toBeInTheDocument();
725
+ expect(screen.getByText('useGroups')).toBeInTheDocument();
726
+ expect(screen.getByText('useThings')).toBeInTheDocument();
727
+ expect(screen.getByText('useConnections')).toBeInTheDocument();
728
+ expect(screen.getByText('useEvents')).toBeInTheDocument();
729
+ expect(screen.getByText('useSearch')).toBeInTheDocument();
730
+ });
731
+
732
+ it('should execute hook when button clicked', async () => {
733
+ const user = userEvent.setup();
734
+ render(<HooksDemo />);
735
+
736
+ const button = screen.getByText(/useProvider/i).closest('button');
737
+ await user.click(button!);
738
+
739
+ await waitFor(() => {
740
+ expect(screen.getByText(/Provider Status/i)).toBeInTheDocument();
741
+ });
742
+ });
743
+
744
+ it('should display loading state during execution', async () => {
745
+ const user = userEvent.setup();
746
+ render(<HooksDemo />);
747
+
748
+ const button = screen.getByText(/useGroups/i).closest('button');
749
+ await user.click(button!);
750
+
751
+ // Button should show loading state
752
+ expect(button).toHaveAttribute('disabled');
753
+ expect(button).toHaveTextContent('Loading...');
754
+ });
755
+
756
+ it('should show results in JSON format', async () => {
757
+ const user = userEvent.setup();
758
+ render(<HooksDemo />);
759
+
760
+ const button = screen.getByText(/useGroups/i).closest('button');
761
+ await user.click(button!);
762
+
763
+ await waitFor(() => {
764
+ const jsonDisplay = screen.getByRole('code');
765
+ expect(jsonDisplay).toBeInTheDocument();
766
+ expect(jsonDisplay.textContent).toContain('groups');
767
+ });
768
+ });
769
+
770
+ it('should handle provider unavailable gracefully', () => {
771
+ vi.mock('@/hooks/ontology', () => ({
772
+ useIsProviderAvailable: () => false,
773
+ }));
774
+
775
+ render(<HooksDemo />);
776
+
777
+ expect(screen.getByText(/Using mock data/i)).toBeInTheDocument();
778
+ });
779
+
780
+ it('should be accessible', () => {
781
+ render(<HooksDemo />);
782
+
783
+ // All buttons should be keyboard accessible
784
+ const buttons = screen.getAllByRole('button');
785
+ buttons.forEach(button => {
786
+ expect(button).toHaveProperty('disabled', false);
787
+ });
788
+ });
789
+ });
790
+ ```
791
+
792
+ **File:** `tests/demo/unit/components/SearchDemo.test.tsx`
793
+
794
+ ```typescript
795
+ describe('SearchDemo Component', () => {
796
+ it('should render search input', () => {
797
+ render(<SearchDemo />);
798
+ expect(screen.getByPlaceholderText(/search/i)).toBeInTheDocument();
799
+ });
800
+
801
+ it('should debounce search input', async () => {
802
+ const user = userEvent.setup();
803
+ render(<SearchDemo />);
804
+
805
+ const input = screen.getByPlaceholderText(/search/i);
806
+
807
+ // Type quickly
808
+ await user.type(input, 'React');
809
+
810
+ // Should NOT call search until debounce expires
811
+ expect(screen.queryByText(/searching/i)).not.toBeInTheDocument();
812
+
813
+ // Wait for debounce
814
+ await waitFor(() => {
815
+ expect(screen.getByText(/results for/i)).toBeInTheDocument();
816
+ }, { timeout: 1000 });
817
+ });
818
+
819
+ it('should display search results', async () => {
820
+ const user = userEvent.setup();
821
+ render(<SearchDemo />);
822
+
823
+ const input = screen.getByPlaceholderText(/search/i);
824
+ await user.type(input, 'React');
825
+
826
+ await waitFor(() => {
827
+ expect(screen.getByText(/React Hooks Masterclass/i)).toBeInTheDocument();
828
+ });
829
+ });
830
+
831
+ it('should show no results message', async () => {
832
+ const user = userEvent.setup();
833
+ render(<SearchDemo />);
834
+
835
+ const input = screen.getByPlaceholderText(/search/i);
836
+ await user.type(input, 'zxcvbnm');
837
+
838
+ await waitFor(() => {
839
+ expect(screen.getByText(/no results found/i)).toBeInTheDocument();
840
+ });
841
+ });
842
+ });
843
+ ```
844
+
845
+ ---
846
+
847
+ ## 5. Integration Tests
848
+
849
+ **File:** `tests/demo/integration/demo-data-flow.test.ts`
850
+
851
+ ```typescript
852
+ import { describe, it, expect, beforeAll, afterAll } from 'vitest';
853
+ import { ConvexHttpClient } from 'convex/browser';
854
+ import { getProvider } from '@/lib/ontology/factory';
855
+
856
+ describe('Demo Data Flow Integration', () => {
857
+ let provider: any;
858
+ let testGroupId: string;
859
+
860
+ beforeAll(async () => {
861
+ provider = await getProvider();
862
+ // Create test group
863
+ testGroupId = await provider.groups.create({
864
+ name: 'Demo Integration Test',
865
+ type: 'organization',
866
+ });
867
+ });
868
+
869
+ afterAll(async () => {
870
+ // Cleanup
871
+ if (testGroupId) {
872
+ await provider.groups.delete(testGroupId);
873
+ }
874
+ });
875
+
876
+ it('should create and retrieve group', async () => {
877
+ const group = await provider.groups.getById(testGroupId);
878
+ expect(group).toBeDefined();
879
+ expect(group.name).toBe('Demo Integration Test');
880
+ });
881
+
882
+ it('should create thing in group', async () => {
883
+ const thing = await provider.things.create({
884
+ groupId: testGroupId,
885
+ type: 'course',
886
+ name: 'Integration Test Course',
887
+ });
888
+
889
+ expect(thing).toBeDefined();
890
+ expect(thing._id).toBeDefined();
891
+ });
892
+
893
+ it('should create connection between entities', async () => {
894
+ const creator = await provider.things.create({
895
+ groupId: testGroupId,
896
+ type: 'creator',
897
+ name: 'Test Creator',
898
+ });
899
+
900
+ const course = await provider.things.create({
901
+ groupId: testGroupId,
902
+ type: 'course',
903
+ name: 'Test Course',
904
+ });
905
+
906
+ const connection = await provider.connections.create({
907
+ groupId: testGroupId,
908
+ fromThingId: creator._id,
909
+ toThingId: course._id,
910
+ relationshipType: 'authored',
911
+ });
912
+
913
+ expect(connection).toBeDefined();
914
+ expect(connection.fromThingId).toBe(creator._id);
915
+ expect(connection.toThingId).toBe(course._id);
916
+ });
917
+
918
+ it('should log events for all operations', async () => {
919
+ const events = await provider.events.list({
920
+ groupId: testGroupId,
921
+ });
922
+
923
+ expect(Array.isArray(events)).toBe(true);
924
+ expect(events.length).toBeGreaterThan(0);
925
+ });
926
+
927
+ it('should search things across all groups', async () => {
928
+ const results = await provider.search('Test', {
929
+ types: ['course', 'creator'],
930
+ limit: 10,
931
+ });
932
+
933
+ expect(Array.isArray(results)).toBe(true);
934
+ });
935
+ });
936
+ ```
937
+
938
+ ---
939
+
940
+ ## 6. Test Data & Fixtures
941
+
942
+ **File:** `tests/fixtures/demo-data.ts`
943
+
944
+ ```typescript
945
+ export const DEMO_GROUPS = [
946
+ {
947
+ _id: 'group_1',
948
+ name: 'Acme Corporation',
949
+ type: 'organization',
950
+ description: 'Demo organization',
951
+ properties: { plan: 'enterprise' },
952
+ status: 'active',
953
+ createdAt: Date.now(),
954
+ },
955
+ {
956
+ _id: 'group_2',
957
+ name: 'Engineering Team',
958
+ type: 'business',
959
+ description: 'Product engineering team',
960
+ parentGroupId: 'group_1',
961
+ status: 'active',
962
+ createdAt: Date.now(),
963
+ },
964
+ ];
965
+
966
+ export const DEMO_THINGS = [
967
+ {
968
+ _id: 'thing_1',
969
+ groupId: 'group_1',
970
+ type: 'creator',
971
+ name: 'Alice Johnson',
972
+ properties: { role: 'org_owner', email: 'alice@acme.com' },
973
+ status: 'active',
974
+ createdAt: Date.now(),
975
+ },
976
+ {
977
+ _id: 'thing_2',
978
+ groupId: 'group_1',
979
+ type: 'course',
980
+ name: 'React Fundamentals',
981
+ properties: { description: 'Learn React basics', price: 99, duration: 4 },
982
+ status: 'active',
983
+ createdAt: Date.now(),
984
+ },
985
+ ];
986
+
987
+ export const DEMO_CONNECTIONS = [
988
+ {
989
+ _id: 'connection_1',
990
+ groupId: 'group_1',
991
+ fromThingId: 'thing_1',
992
+ toThingId: 'thing_2',
993
+ relationshipType: 'authored',
994
+ metadata: { role: 'primary_author' },
995
+ createdAt: Date.now(),
996
+ },
997
+ ];
998
+
999
+ export const DEMO_EVENTS = [
1000
+ {
1001
+ _id: 'event_1',
1002
+ groupId: 'group_1',
1003
+ type: 'thing_created',
1004
+ actorId: 'thing_1',
1005
+ targetId: 'thing_2',
1006
+ timestamp: Date.now() - 3600000,
1007
+ metadata: { entityType: 'course' },
1008
+ },
1009
+ ];
1010
+
1011
+ export async function seedDemoDatabase(provider: any, groupId: string) {
1012
+ // Create things
1013
+ const things = await Promise.all(
1014
+ DEMO_THINGS.map(thing =>
1015
+ provider.things.create({ ...thing, groupId })
1016
+ )
1017
+ );
1018
+
1019
+ // Create connections
1020
+ await Promise.all(
1021
+ DEMO_CONNECTIONS.map(conn =>
1022
+ provider.connections.create({
1023
+ ...conn,
1024
+ groupId,
1025
+ fromThingId: things[0]._id,
1026
+ toThingId: things[1]._id,
1027
+ })
1028
+ )
1029
+ );
1030
+
1031
+ return things;
1032
+ }
1033
+ ```
1034
+
1035
+ **File:** `tests/fixtures/mock-providers.ts`
1036
+
1037
+ ```typescript
1038
+ export class MockProvider implements Provider {
1039
+ private groups: Map<string, Group> = new Map();
1040
+ private things: Map<string, Thing> = new Map();
1041
+ private connections: Map<string, Connection> = new Map();
1042
+ private events: Map<string, Event> = new Map();
1043
+
1044
+ groups = {
1045
+ list: async () => Array.from(this.groups.values()),
1046
+ getById: async (id: string) => this.groups.get(id),
1047
+ create: async (data: any) => {
1048
+ const id = 'mock_' + Math.random().toString(36);
1049
+ const group = { _id: id, ...data, createdAt: Date.now() };
1050
+ this.groups.set(id, group);
1051
+ return id;
1052
+ },
1053
+ };
1054
+
1055
+ things = {
1056
+ list: async (options?: any) => Array.from(this.things.values()).slice(0, options?.limit || 100),
1057
+ create: async (data: any) => {
1058
+ const id = 'mock_' + Math.random().toString(36);
1059
+ const thing = { _id: id, ...data, createdAt: Date.now() };
1060
+ this.things.set(id, thing);
1061
+ return thing;
1062
+ },
1063
+ };
1064
+
1065
+ // ... implement all methods
1066
+ }
1067
+ ```
1068
+
1069
+ ---
1070
+
1071
+ ## 7. Performance Testing
1072
+
1073
+ **File:** `tests/demo/e2e/performance.spec.ts` (with Playwright)
1074
+
1075
+ ```typescript
1076
+ import { test, expect } from '@playwright/test';
1077
+
1078
+ test.describe('Demo Performance', () => {
1079
+ test('demo index loads in < 1 second', async ({ page }) => {
1080
+ const startTime = Date.now();
1081
+
1082
+ await page.goto('http://localhost:4321/demo');
1083
+ await page.waitForLoadState('networkidle');
1084
+
1085
+ const duration = Date.now() - startTime;
1086
+ expect(duration).toBeLessThan(1000);
1087
+ });
1088
+
1089
+ test('API calls complete < 200ms', async ({ page }) => {
1090
+ await page.goto('http://localhost:4321/demo/groups');
1091
+
1092
+ // Intercept network requests
1093
+ const times: number[] = [];
1094
+
1095
+ page.on('response', response => {
1096
+ if (response.url().includes('/api/')) {
1097
+ times.push(response.timing()!.responseEnd);
1098
+ }
1099
+ });
1100
+
1101
+ // Trigger operation
1102
+ await page.click('button:has-text("Create Group")');
1103
+
1104
+ await page.waitForTimeout(500);
1105
+
1106
+ times.forEach(time => {
1107
+ expect(time).toBeLessThan(200);
1108
+ });
1109
+ });
1110
+
1111
+ test('Lighthouse scores > 95', async ({ page }) => {
1112
+ await page.goto('http://localhost:4321/demo');
1113
+
1114
+ // Would need lighthouse integration
1115
+ // This is a placeholder
1116
+ expect(true).toBe(true);
1117
+ });
1118
+ });
1119
+ ```
1120
+
1121
+ ---
1122
+
1123
+ ## 8. Visual Regression Tests
1124
+
1125
+ **File:** `tests/demo/visual/demo-layouts.test.ts`
1126
+
1127
+ ```typescript
1128
+ import { test, expect } from '@playwright/test';
1129
+
1130
+ test.describe('Visual Regression', () => {
1131
+ test('demo index matches desktop snapshot', async ({ page }) => {
1132
+ await page.goto('http://localhost:4321/demo');
1133
+ await page.waitForLoadState('networkidle');
1134
+
1135
+ expect(await page.screenshot()).toMatchSnapshot('demo-index-desktop.png');
1136
+ });
1137
+
1138
+ test('demo groups mobile layout matches snapshot', async ({ page }) => {
1139
+ await page.setViewportSize({ width: 375, height: 667 });
1140
+ await page.goto('http://localhost:4321/demo/groups');
1141
+
1142
+ expect(await page.screenshot()).toMatchSnapshot('demo-groups-mobile.png');
1143
+ });
1144
+
1145
+ test('dark mode rendering matches snapshot', async ({ page }) => {
1146
+ // Enable dark mode
1147
+ await page.evaluate(() => {
1148
+ document.documentElement.classList.add('dark');
1149
+ localStorage.setItem('theme', 'dark');
1150
+ });
1151
+
1152
+ await page.goto('http://localhost:4321/demo');
1153
+ expect(await page.screenshot()).toMatchSnapshot('demo-dark-mode.png');
1154
+ });
1155
+ });
1156
+ ```
1157
+
1158
+ ---
1159
+
1160
+ ## 9. Test Configuration
1161
+
1162
+ **File:** `vitest.config.ts`
1163
+
1164
+ ```typescript
1165
+ import { defineConfig } from 'vitest/config';
1166
+ import react from '@vitejs/plugin-react';
1167
+ import path from 'path';
1168
+
1169
+ export default defineConfig({
1170
+ plugins: [react()],
1171
+ test: {
1172
+ globals: true,
1173
+ environment: 'jsdom',
1174
+ setupFiles: ['./tests/setup.ts'],
1175
+ coverage: {
1176
+ provider: 'v8',
1177
+ reporter: ['text', 'json', 'html'],
1178
+ exclude: [
1179
+ 'node_modules/',
1180
+ 'tests/',
1181
+ '**/*.test.ts',
1182
+ '**/*.spec.ts',
1183
+ ],
1184
+ lines: 80,
1185
+ functions: 80,
1186
+ branches: 80,
1187
+ statements: 80,
1188
+ },
1189
+ testTimeout: 10000,
1190
+ },
1191
+ resolve: {
1192
+ alias: {
1193
+ '@': path.resolve(__dirname, './src'),
1194
+ '@components': path.resolve(__dirname, './src/components'),
1195
+ '@hooks': path.resolve(__dirname, './src/hooks'),
1196
+ '@/__mocks__': path.resolve(__dirname, './tests/__mocks__'),
1197
+ },
1198
+ },
1199
+ });
1200
+ ```
1201
+
1202
+ **File:** `playwright.config.ts`
1203
+
1204
+ ```typescript
1205
+ import { defineConfig, devices } from '@playwright/test';
1206
+
1207
+ export default defineConfig({
1208
+ testDir: './tests/demo/e2e',
1209
+ fullyParallel: true,
1210
+ forbidOnly: !!process.env.CI,
1211
+ retries: process.env.CI ? 2 : 0,
1212
+ workers: process.env.CI ? 1 : undefined,
1213
+ reporter: 'html',
1214
+ use: {
1215
+ baseURL: 'http://localhost:4321',
1216
+ trace: 'on-first-retry',
1217
+ },
1218
+
1219
+ projects: [
1220
+ {
1221
+ name: 'chromium',
1222
+ use: { ...devices['Desktop Chrome'] },
1223
+ },
1224
+ {
1225
+ name: 'firefox',
1226
+ use: { ...devices['Desktop Firefox'] },
1227
+ },
1228
+ {
1229
+ name: 'webkit',
1230
+ use: { ...devices['Desktop Safari'] },
1231
+ },
1232
+ {
1233
+ name: 'Mobile Chrome',
1234
+ use: { ...devices['Pixel 5'] },
1235
+ },
1236
+ ],
1237
+
1238
+ webServer: {
1239
+ command: 'bun run dev',
1240
+ url: 'http://localhost:4321',
1241
+ reuseExistingServer: !process.env.CI,
1242
+ },
1243
+ });
1244
+ ```
1245
+
1246
+ ---
1247
+
1248
+ ## 10. Test Execution Strategy
1249
+
1250
+ ### Sequential Testing Flow
1251
+
1252
+ ```bash
1253
+ # 1. Unit tests (fast, no backend needed)
1254
+ bun test tests/demo/unit
1255
+
1256
+ # 2. Integration tests (needs backend or mocks)
1257
+ bun test tests/demo/integration
1258
+
1259
+ # 3. E2E tests (full system, with Playwright)
1260
+ bun run test:e2e
1261
+
1262
+ # 4. Visual regression tests
1263
+ bun run test:visual
1264
+
1265
+ # 5. Performance tests
1266
+ bun run test:performance
1267
+
1268
+ # 6. Full test suite with coverage
1269
+ bun test -- --coverage
1270
+
1271
+ # 7. Watch mode for development
1272
+ bun test:watch tests/demo
1273
+ ```
1274
+
1275
+ ### CI/CD Pipeline
1276
+
1277
+ ```yaml
1278
+ # .github/workflows/demo-tests.yml
1279
+ name: Demo Tests
1280
+
1281
+ on: [push, pull_request]
1282
+
1283
+ jobs:
1284
+ test:
1285
+ runs-on: ubuntu-latest
1286
+
1287
+ steps:
1288
+ - uses: actions/checkout@v3
1289
+ - uses: oven-sh/setup-bun@v1
1290
+
1291
+ - name: Install dependencies
1292
+ run: bun install
1293
+
1294
+ - name: Run unit tests
1295
+ run: bun test tests/demo/unit
1296
+
1297
+ - name: Run integration tests
1298
+ run: bun test tests/demo/integration
1299
+
1300
+ - name: Run E2E tests
1301
+ run: bun run test:e2e
1302
+
1303
+ - name: Upload coverage
1304
+ uses: codecov/codecov-action@v3
1305
+ ```
1306
+
1307
+ ---
1308
+
1309
+ ## 11. Quality Metrics & Gates
1310
+
1311
+ ### Coverage Targets
1312
+
1313
+ | Category | Target | Current |
1314
+ |----------|--------|---------|
1315
+ | Statements | 80% | - |
1316
+ | Branches | 80% | - |
1317
+ | Functions | 80% | - |
1318
+ | Lines | 80% | - |
1319
+
1320
+ ### Pass Rate Targets
1321
+
1322
+ | Test Suite | Target | Status |
1323
+ |-----------|--------|--------|
1324
+ | Unit Tests | 100% | |
1325
+ | Integration Tests | 100% | |
1326
+ | E2E Tests | 100% | |
1327
+ | Visual Regression | 100% | |
1328
+ | Accessibility | 100% | |
1329
+ | Performance | 100% | |
1330
+
1331
+ ### Performance Targets
1332
+
1333
+ | Metric | Target | Status |
1334
+ |--------|--------|--------|
1335
+ | Page Load (FCP) | < 800ms | |
1336
+ | Page Load (LCP) | < 1200ms | |
1337
+ | API Response Time | < 200ms | |
1338
+ | Time to Interactive | < 1s | |
1339
+ | Lighthouse Score | >= 95 | |
1340
+
1341
+ ---
1342
+
1343
+ ## 12. Test Execution Checklist (Pre-Production)
1344
+
1345
+ - [ ] All unit tests pass (100%)
1346
+ - [ ] All integration tests pass (100%)
1347
+ - [ ] All E2E tests pass (100%)
1348
+ - [ ] Coverage meets 80% threshold across all dimensions
1349
+ - [ ] No flaky tests (all tests pass consistently)
1350
+ - [ ] Performance benchmarks met (page load < 1s, API < 200ms)
1351
+ - [ ] Accessibility audit passes (WCAG 2.1 AA)
1352
+ - [ ] Cross-browser testing passes (Chrome, Firefox, Safari, Edge)
1353
+ - [ ] Mobile testing passes (iOS Safari, Chrome Mobile)
1354
+ - [ ] Visual regression tests pass (no unexpected changes)
1355
+ - [ ] Error scenarios tested (backend down, network timeout, invalid data)
1356
+ - [ ] Load testing done (1000+ concurrent users)
1357
+ - [ ] Security testing done (XSS, CSRF, injection)
1358
+ - [ ] Documentation updated with test coverage
1359
+ - [ ] QA sign-off obtained
1360
+
1361
+ ---
1362
+
1363
+ ## 13. Test Maintenance
1364
+
1365
+ ### Regular Updates
1366
+ - Weekly: Add new test cases for new features
1367
+ - Monthly: Update snapshots and baselines
1368
+ - Quarterly: Review and refactor test suite
1369
+ - Quarterly: Update test dependencies
1370
+
1371
+ ### Failure Response
1372
+ - **Flaky test**: Investigate and stabilize within 24 hours
1373
+ - **Regression**: Bisect to find breaking commit, fix immediately
1374
+ - **Performance regression**: Profile and optimize
1375
+ - **Accessibility regression**: Fix and document fix
1376
+
1377
+ ### Test Reporting
1378
+ - Run coverage reports in CI/CD
1379
+ - Generate HTML coverage reports
1380
+ - Track metrics over time (spreadsheet/dashboard)
1381
+ - Alert on regression (coverage drops > 5%)
1382
+
1383
+ ---
1384
+
1385
+ ## 14. Deliverables Checklist
1386
+
1387
+ - [x] E2E test specifications (Gherkin format)
1388
+ - [x] Component test specifications (Jest/Vitest)
1389
+ - [x] Integration test specifications
1390
+ - [x] Performance test specifications
1391
+ - [x] Accessibility test specifications
1392
+ - [x] Visual regression test approach
1393
+ - [x] Test data & fixtures
1394
+ - [x] Mock provider implementations
1395
+ - [x] Test configuration files
1396
+ - [x] CI/CD pipeline setup
1397
+ - [x] Test execution checklist
1398
+ - [x] Coverage targets & metrics
1399
+ - [x] Maintenance plan
1400
+
1401
+ ---
1402
+
1403
+ ## Summary
1404
+
1405
+ This comprehensive test plan provides:
1406
+
1407
+ 1. **Coverage**: All 6 dimensions (groups, people, things, connections, events, knowledge) + search
1408
+ 2. **Test Types**: E2E, integration, unit, component, visual, performance, accessibility
1409
+ 3. **Quality Gates**: 80% code coverage, 100% test pass rate, performance targets, accessibility compliance
1410
+ 4. **Ontology Alignment**: Tests validate 6-dimension ontology operations (create, read, update, delete, connections, events)
1411
+ 5. **Specifications**: Gherkin-format user flows for non-technical stakeholders
1412
+ 6. **Automation**: Full CI/CD pipeline for continuous testing
1413
+ 7. **Maintenance**: Processes for keeping tests current and reliable
1414
+ 8. **Reporting**: Metrics and dashboards for quality tracking
1415
+
1416
+ **Ready to hand to QA team for implementation.**
1417
+