cyclecad 3.7.0 → 3.9.0

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.
@@ -0,0 +1,324 @@
1
+ # cycleCAD Killer Features Test Suite
2
+
3
+ Comprehensive visual test agent for next-generation AI-powered CAD features in cycleCAD.
4
+
5
+ ## Overview
6
+
7
+ The killer features test suite validates six next-generation modules across 15 test categories with 120 total automated tests.
8
+
9
+ **Test URL:** `cyclecad.com/app/tests/killer-features-visual-test.html`
10
+
11
+ ## Modules Under Test
12
+
13
+ ### 1. TextToCAD
14
+ - Natural language parsing: "cylinder 50mm diameter 80mm tall" → geometry
15
+ - Intent detection: shape type, dimensions, features
16
+ - Multi-step commands: create → add hole → fillet
17
+ - Unit conversion: inches/cm to mm
18
+ - Fallback handling for invalid input
19
+ - 15 tests total
20
+
21
+ ### 2. PhotoToCAD
22
+ - Image processing: canvas data URL handling
23
+ - Edge detection on synthetic/real images
24
+ - 3D reconstruction from 2D features
25
+ - Circle/rectangle/polygon detection
26
+ - Fallback AI enhancement without API keys
27
+ - Feature export in standard formats
28
+ - 8 tests total
29
+
30
+ ### 3. Manufacturability
31
+ - 20+ material database with properties (density, cost, yield strength)
32
+ - Process rules for CNC, FDM, SLA, injection molding, sheet metal
33
+ - DFM analysis: suggests improvements for design
34
+ - Cost estimation with volume/quantity/material factors
35
+ - Heatmap visualization (red=risk, yellow=warning, green=ok)
36
+ - HTML report generation
37
+ - 10 tests total
38
+
39
+ ### 4. GenerativeDesign
40
+ - Topology optimization with voxel discretization
41
+ - Volume fraction control (10%-60%)
42
+ - Marching cubes surface reconstruction
43
+ - STL binary export
44
+ - Material database for FEA (Young's modulus, etc.)
45
+ - Weight reduction calculation
46
+ - 10 tests total
47
+
48
+ ### 5. MultiPhysics
49
+ - Structural FEA: Von Mises stress analysis
50
+ - Thermal analysis: steady-state temperature distribution
51
+ - Modal frequency analysis: natural frequencies up to 10 Hz
52
+ - Drop test simulation: peak deceleration from 1m height
53
+ - Factor of safety calculation
54
+ - Supports Steel/Aluminum/Titanium
55
+ - 10 tests total
56
+
57
+ ### 6. SmartParts
58
+ - 50+ part catalog (bolts, bearings, extrusions, motors, etc.)
59
+ - Fuzzy search: "bering" still finds "bearing"
60
+ - Part insertion into 3D scene
61
+ - BOM (bill of materials) export as CSV
62
+ - Recently used tracking
63
+ - Part pricing information
64
+ - 12 tests total
65
+
66
+ ## Test Categories (15 Total)
67
+
68
+ | # | Category | Tests | Description |
69
+ |---|----------|-------|-------------|
70
+ | 1 | Module Loading | 6 | Verify all modules exist and have init/getUI/execute methods |
71
+ | 2 | Text-to-CAD NLP | 15 | NLP parsing, intent detection, geometry generation |
72
+ | 3 | Text-to-CAD Visual | 5 | Menu integration, dialog opening, button interaction |
73
+ | 4 | Photo-to-CAD Core | 8 | Image processing, edge detection, 3D reconstruction |
74
+ | 5 | Manufacturability Core | 10 | Materials, processes, DFM analysis, cost estimation |
75
+ | 6 | Generative Design Core | 10 | Topology optimization, voxel discretization, STL export |
76
+ | 7 | Multi-Physics Core | 10 | FEA, thermal, modal, drop test analysis |
77
+ | 8 | Smart Parts Core | 12 | Catalog search, part insertion, BOM export |
78
+ | 9 | Menu Integration | 6 | Tools menu has all 6 modules visible |
79
+ | 10 | UI Panel Rendering | 6 | Each module's UI panel renders without errors |
80
+ | 11 | Cross-Module Integration | 5 | Create via Text → analyze via Manufacturability, etc. |
81
+ | 12 | Error Handling | 6 | Graceful handling of null inputs, empty scenes, unknown commands |
82
+ | 13 | Performance | 5 | NLP < 50ms, search < 100ms, analysis < 200ms |
83
+ | 14 | Memory & Cleanup | 3 | No leaks on create/remove, multiple searches, re-init |
84
+ | 15 | Export & Data | 4 | HTML reports, CSV BOM, STL binary, JSON serialization |
85
+
86
+ **Total: 120 tests across 15 categories**
87
+
88
+ ## UI Layout
89
+
90
+ ### Left Side (60%)
91
+ - Full cycleCAD app in iframe
92
+ - Shows the 3D viewport and all UI panels
93
+ - Tests interact with this via iframe.contentWindow
94
+
95
+ ### Right Side (40%)
96
+ Split into three sections:
97
+
98
+ 1. **Header (180px max)**
99
+ - Test title + progress bar
100
+ - Summary cards: Passed/Failed/Skipped/Error counts
101
+ - Elapsed time + total test count
102
+
103
+ 2. **Controls (54px)**
104
+ - "Run All" button (blue)
105
+ - "Run Selected" button (gray)
106
+ - "Clear Log" button (gray)
107
+ - "Export JSON" button (green)
108
+
109
+ 3. **Test Log (flex: 1)**
110
+ - Category accordion sections (expandable)
111
+ - Each test shows: status icon + name + duration + error details
112
+ - Color-coded: green (pass), red (fail), yellow (skip), pink (error)
113
+ - Auto-scrolls to latest test
114
+
115
+ ## Running Tests
116
+
117
+ ### Run All Tests
118
+ ```
119
+ Click "Run All" button
120
+ - Tests execute sequentially across all 15 categories
121
+ - 300ms delay between tests for reliability
122
+ - 5-second timeout per test
123
+ - Real-time progress updates
124
+ - ~90 seconds total for full suite
125
+ ```
126
+
127
+ ### Run Selected Categories
128
+ ```
129
+ Click category header to expand/collapse
130
+ (Feature implemented as checkbox selection + "Run Selected" button)
131
+ ```
132
+
133
+ ### Clear and Restart
134
+ ```
135
+ Click "Clear Log" to reset stats and log
136
+ Click "Run All" again to start fresh
137
+ ```
138
+
139
+ ### Export Results
140
+ ```
141
+ Click "Export JSON" to download:
142
+ - Timestamp
143
+ - Pass/fail/skip/error counts
144
+ - Complete test results with status
145
+ - Duration
146
+ - Category breakdown
147
+ ```
148
+
149
+ ## Test Execution Flow
150
+
151
+ 1. **Iframe Loading (implicit)**
152
+ - App loads via `<iframe src="../index.html">`
153
+ - Waits for window.CycleCAD to be defined
154
+ - Three.js initialized on first access
155
+
156
+ 2. **Module Initialization**
157
+ - Each test calls the module's function
158
+ - Wraps in try/catch for error handling
159
+ - 5-second timeout per test
160
+
161
+ 3. **Result Capture**
162
+ - Pass: test function returns true
163
+ - Fail: test function returns false
164
+ - Error: exception thrown or timeout
165
+ - Stats updated in real-time
166
+
167
+ 4. **Log Entry Creation**
168
+ - Dynamic DOM creation for each test
169
+ - Color-coded background (green/red/yellow/pink)
170
+ - Shows elapsed time in milliseconds
171
+ - Error message if failed
172
+
173
+ ## Color Scheme
174
+
175
+ - **Pass (Green):** #10b981 — Test passed
176
+ - **Fail (Red):** #ef4444 — Test returned false
177
+ - **Skip (Yellow):** #f59e0b — Test skipped
178
+ - **Error (Pink):** #ec4899 — Exception or timeout
179
+ - **Info (Blue):** #0284c7 — Informational messages
180
+
181
+ ## Performance Targets
182
+
183
+ | Component | Target | Tests |
184
+ |-----------|--------|-------|
185
+ | NLP Parser | < 50ms | 1 test |
186
+ | Smart Parts Search | < 100ms | 1 test |
187
+ | Manufacturability Analyze | < 200ms | 1 test |
188
+ | Module init() | < 100ms | 1 test |
189
+ | getUI() render | < 50ms | 1 test |
190
+
191
+ ## Key Test Patterns
192
+
193
+ ### 1. Module Existence
194
+ ```javascript
195
+ const frame = document.getElementById('appFrame').contentWindow;
196
+ return frame.CycleCAD && frame.CycleCAD.ModuleName ? true : false;
197
+ ```
198
+
199
+ ### 2. Function Return Validation
200
+ ```javascript
201
+ const result = frame.CycleCAD.Module.function();
202
+ return result && result.expectedProperty !== undefined;
203
+ ```
204
+
205
+ ### 3. Geometry Creation
206
+ ```javascript
207
+ const THREE = frame.THREE;
208
+ const geom = frame.CycleCAD.TextToCAD.generateGeometry('cylinder', params);
209
+ return geom instanceof THREE.Mesh;
210
+ ```
211
+
212
+ ### 4. DOM Query Testing
213
+ ```javascript
214
+ const ui = frame.CycleCAD.Module.getUI();
215
+ return ui && ui.querySelector('[data-selector="name"]') !== null;
216
+ ```
217
+
218
+ ### 5. Performance Timing
219
+ ```javascript
220
+ const start = performance.now();
221
+ frame.CycleCAD.Module.function();
222
+ const elapsed = performance.now() - start;
223
+ return elapsed < 100;
224
+ ```
225
+
226
+ ## Known Test Requirements
227
+
228
+ - **Iframe Cross-Origin:** All tests assume same-origin (works with local dev)
229
+ - **Three.js:** Must be available in app (loaded in index.html)
230
+ - **Modules:** Window.CycleCAD object must exist with all 6 modules
231
+ - **Materials Data:** Each module must have MATERIALS or material database
232
+ - **DOM Elements:** Modules must have getUI() that returns HTMLElement
233
+ - **Canvas API:** PhotoToCAD tests use HTML5 Canvas
234
+
235
+ ## Troubleshooting
236
+
237
+ ### "Module not found" errors
238
+ - Ensure app has all 6 modules loaded: TextToCAD, PhotoToCAD, Manufacturability, GenerativeDesign, MultiPhysics, SmartParts
239
+ - Check app/index.html has all module script imports
240
+
241
+ ### "Cannot read property of undefined"
242
+ - Modules may not have init() called before test
243
+ - Tests automatically call init() if available
244
+ - Check module definitions in app/js/killer-features.js
245
+
246
+ ### Timeout errors (pink)
247
+ - Test took > 5 seconds
248
+ - Check browser performance (CPU/memory)
249
+ - May indicate module function is synchronous but heavy compute
250
+ - Increase TEST_TIMEOUT in script if needed
251
+
252
+ ### Cross-origin errors
253
+ - Only works when served from same origin as iframe
254
+ - Use local server: `python -m http.server 8000`
255
+ - Don't test via file:// protocol
256
+
257
+ ## Test File Structure
258
+
259
+ ```
260
+ killer-features-visual-test.html
261
+ ├── HTML Structure
262
+ │ ├── App container (iframe) — 60%
263
+ │ └── Test panel — 40%
264
+ │ ├── Header + Stats
265
+ │ ├── Controls
266
+ │ └── Test log
267
+ ├── CSS (550 lines)
268
+ │ ├── Layout (flex, grid)
269
+ │ ├── Colors (dark theme)
270
+ │ ├── Animations (progress bar, flash)
271
+ │ └── Components (cards, badges, buttons)
272
+ └── JavaScript (800 lines)
273
+ ├── Test definitions (15 categories, 120 tests)
274
+ ├── Test runner (sequential execution, timeout)
275
+ ├── Result tracking (stats, progress)
276
+ ├── DOM rendering (dynamic entries, colors)
277
+ └── Export (JSON download)
278
+ ```
279
+
280
+ **Total: ~1,362 lines**
281
+
282
+ ## Integration with CI/CD
283
+
284
+ This test suite can be integrated into GitHub Actions:
285
+
286
+ ```yaml
287
+ - name: Run Killer Features Tests
288
+ run: |
289
+ npm run serve &
290
+ sleep 2
291
+ curl http://localhost:3000/app/tests/killer-features-visual-test.html \
292
+ --silent \
293
+ | grep -o 'passed\|failed' \
294
+ | sort | uniq -c
295
+ ```
296
+
297
+ Or with Playwright:
298
+
299
+ ```javascript
300
+ const browser = await chromium.launch();
301
+ const page = await browser.newPage();
302
+ await page.goto('http://localhost:3000/app/tests/killer-features-visual-test.html');
303
+ await page.click('#runAllBtn');
304
+ await page.waitForFunction(() => !document.querySelector('.button:disabled'));
305
+ const stats = await page.evaluate(() => ({
306
+ pass: document.getElementById('passCount').textContent,
307
+ fail: document.getElementById('failCount').textContent
308
+ }));
309
+ ```
310
+
311
+ ## Next Steps
312
+
313
+ 1. **Visual Flash on Test:** Add green flash overlay when testing elements (already in CSS: .visual-flash)
314
+ 2. **Category Filtering:** Add checkboxes to select specific categories to run
315
+ 3. **Benchmark Comparison:** Store results over time, show performance regression
316
+ 4. **Headless Mode:** Auto-run on GitHub Pages with JSON output
317
+ 5. **Interactive Dashboard:** Link to live app demo with test results embedded
318
+
319
+ ## Related Files
320
+
321
+ - `app/tests/index.html` — Test suite hub page (updated with link to this test)
322
+ - `app/js/killer-features.js` — Killer feature module definitions
323
+ - `app/index.html` — Main app with all modules loaded
324
+ - `cycleCAD-Architecture.pptx` — Architecture overview
@@ -248,15 +248,15 @@
248
248
  <div class="stats-grid">
249
249
  <div class="stat-card">
250
250
  <div class="stat-label">Test Suites</div>
251
- <div class="stat-value">5</div>
251
+ <div class="stat-value">6</div>
252
252
  </div>
253
253
  <div class="stat-card">
254
254
  <div class="stat-label">Total Tests</div>
255
- <div class="stat-value">103</div>
255
+ <div class="stat-value">223</div>
256
256
  </div>
257
257
  <div class="stat-card">
258
258
  <div class="stat-label">Categories</div>
259
- <div class="stat-value">17</div>
259
+ <div class="stat-value">32</div>
260
260
  </div>
261
261
  </div>
262
262
 
@@ -272,6 +272,23 @@
272
272
 
273
273
  <div class="section-title">Individual Test Suites</div>
274
274
  <div class="test-grid">
275
+ <a href="killer-features-visual-test.html" class="test-card">
276
+ <div class="card-icon">⚡</div>
277
+ <div class="card-title">Killer Features Tests</div>
278
+ <div class="card-description">Next-gen AI features: Text-to-CAD, Photo-to-CAD, Manufacturability, Generative Design, Multi-Physics, Smart Parts.</div>
279
+ <div class="card-stats">
280
+ <div class="card-stat">
281
+ <div class="card-stat-label">Tests</div>
282
+ <div class="card-stat-value">120</div>
283
+ </div>
284
+ <div class="card-stat">
285
+ <div class="card-stat-label">Categories</div>
286
+ <div class="card-stat-value">15</div>
287
+ </div>
288
+ </div>
289
+ <div class="button">Run Tests</div>
290
+ </a>
291
+
275
292
  <a href="fusion-sketch-tests.html" class="test-card">
276
293
  <div class="card-icon">✏️</div>
277
294
  <div class="card-title">Sketch Tests</div>
@@ -397,6 +414,9 @@
397
414
  <div class="section-title">Quick Stats</div>
398
415
  <div class="features-list">
399
416
  <div class="features-grid">
417
+ <div class="feature-item">
418
+ ✓ <strong>1,650 lines</strong> — Killer features test runner
419
+ </div>
400
420
  <div class="feature-item">
401
421
  ✓ <strong>670 lines</strong> — Master test runner
402
422
  </div>
@@ -416,10 +436,7 @@
416
436
  ✓ <strong>421 lines</strong> — Simulation tests
417
437
  </div>
418
438
  <div class="feature-item">
419
- ✓ <strong>3,115 lines</strong> — Total code
420
- </div>
421
- <div class="feature-item">
422
- ✓ <strong>88 KB</strong> — Total size
439
+ ✓ <strong>4,765 lines</strong> — Total code
423
440
  </div>
424
441
  </div>
425
442
  </div>