This document explains how to test the plugin outputs using the included HTML test files.
The src/ directory contains two self-contained HTML test files for manually testing exported JSON files:
Tests fullscreen Advanced Dynamic Texture (ADT) exports.
Purpose: Load and render a complete BabylonJS ADT JSON file that represents an entire UI screen.
Usage:
- Export a frame from Figma using "Export Fullscreen ADT"
- Place the exported JSON file in the
src/directory - Update line 58 in the file:
let fileName="your-export.json"; - Open
fullscreenADTTest.htmlin a web browser - The UI should render over a 3D scene with a ground plane
What it tests:
- Full ADT serialization/deserialization
- Root container setup
- Width and height properties
- Overall layout and positioning
Tests individual control exports.
Purpose: Load and render a single BabylonJS GUI control JSON file.
Usage:
- Export a component/frame from Figma using "Export Control Only"
- Place the exported JSON file in the
src/directory - Update line 25 in the file:
let fileName = "your-control.json"; - Open
controlTest.htmlin a web browser - The control should render in the center of the screen
What it tests:
- Single control parsing
- Control.Parse() functionality
- Positioning and sizing of isolated controls
- Control hierarchy and children
- A modern web browser (Chrome, Firefox, Safari, Edge)
- A local web server (to avoid CORS issues)
Option 1: Python
cd src
python3 -m http.server 8000
# Then open http://localhost:8000/fullscreenADTTest.htmlOption 2: Node.js (http-server)
npm install -g http-server
cd src
http-server
# Then open http://localhost:8080/fullscreenADTTest.htmlOption 3: VS Code Live Server
- Install the "Live Server" extension
- Right-click on the HTML file
- Select "Open with Live Server" OR Right click the .html file and select "Show Preview"
Both test files include commented-out code to enable the BabylonJS Inspector/Debugger:
scene.debugLayer.show({
embedMode: true,
overlay: false,
});Uncomment this section to inspect:
- GUI hierarchy
- Control properties
- Positioning and sizing
- Scene objects and cameras
- Design in Figma: Create or modify your UI design
- Export: Use the plugin to export as ADT or Control
- Test: Load the JSON in the appropriate test file
- Inspect: Use the BabylonJS Inspector to verify properties
- Iterate: Fix issues in Figma and re-export
- Cause: CORS policy blocking local file access
- Solution: Use a local web server (see above)
- Cause: Control is positioned outside the visible area
- Solution: Check positioning in the Inspector or adjust camera
- Cause: Image paths are relative
- Solution: Ensure images are in the correct folder path (default:
./images/)
Automated tests are planned for future releases to validate export correctness programmatically.