Context
The adapter pipeline (pymat → mat-vis textures → to_threejs →
ocp_vscode → three-cad-viewer) is tested at the data level (field
names, base64 encoding). But there's no test that the rendered
output actually looks correct.
Architecture
Python test:
Material("stainless") → to_threejs() → ocp_vscode standalone
Playwright (headless Chrome):
→ navigate to localhost → three-cad-viewer renders with WebGL
→ captureCanvas() → screenshot PNG
CI:
compare to baseline → pass/fail
three-cad-viewer has built-in screenshot:
getImage("screenshot") in src/core/viewer.ts
captureCanvas() in src/ui/display.ts
ocp_vscode has standalone Flask server mode.
Proof-of-concept
tests/test_visual_regression.py exists with the framework:
TestVisualRegression — validates adapter JSON output
TestHeadlessScreenshot — placeholder for full Playwright wiring
Remaining work
Dependencies
pip install playwright ocp_vscode build123d
python -m playwright install chromium
Refs
tests/test_visual_regression.py — existing proof-of-concept
- three-cad-viewer screenshot API:
src/core/viewer.ts:4344
- ocp_vscode standalone:
ocp_vscode/standalone.py
Context
The adapter pipeline (pymat → mat-vis textures → to_threejs →
ocp_vscode → three-cad-viewer) is tested at the data level (field
names, base64 encoding). But there's no test that the rendered
output actually looks correct.
Architecture
three-cad-viewer has built-in screenshot:
getImage("screenshot")insrc/core/viewer.tscaptureCanvas()insrc/ui/display.tsocp_vscode has standalone Flask server mode.
Proof-of-concept
tests/test_visual_regression.pyexists with the framework:TestVisualRegression— validates adapter JSON outputTestHeadlessScreenshot— placeholder for full Playwright wiringRemaining work
show(shape)commandonAfterRender)textured vs scalar-only, KTX2 vs PNG (when available)
Dependencies
Refs
tests/test_visual_regression.py— existing proof-of-conceptsrc/core/viewer.ts:4344ocp_vscode/standalone.py