This test framework validates import and export round-trips for OpenMapEditor. For each file format, it:
- Imports the test file
- Validates that imported features match expected data
- Exports the imported data to GeoJSON
- Validates that exported features match expected data
Results are displayed side-by-side showing both import and export validation.
-
Start OpenMapEditor web server:
cd /path/to/openmapeditor python3 -m http.server 5500Alternatively, use VS Code Live Server extension (port 5500 by default)
-
Start test server:
cd /path/to/openmapeditor-test-data python3 -m http.server 8000 -
Open in browser:
http://localhost:8000/automated-tests/(Note: Use your actual server address and ports if different)
-
Verify the server URL in the configuration matches your OpenMapEditor server
-
Click "Run All Tests"
automated-tests/
├── index.html # Main test page
├── README.md # This file
├── css/
│ └── test-styles.css # Styles for the test UI
├── js/
│ ├── export-capture.js # Captures export output for testing
│ ├── test-validators.js # Feature validation logic
│ ├── test-ui.js # UI rendering functions
│ └── test-runner.js # Test orchestration
└── test-files/
└── 01-standard-shapes/ # First test suite
├── test-config.json # Test configuration
├── test-standard.geojson
├── test-standard.gpx
├── test-standard.kml
└── test-standard.kmz
Each test suite is a folder in test-files/ containing:
- test-config.json - Defines expected features and which files to test
- Test files - One file per format to test
{
"name": "Standard Shapes",
"description": "Tests basic marker, path, and polygon with standard colors",
"expectedFeatures": {
"Test Marker": { "type": "Point", "color": "Red" },
"Test Path": { "type": "LineString", "color": "Blue" },
"Test Polygon": { "type": "Polygon", "color": "Green" }
},
"files": ["test-standard.geojson", "test-standard.gpx", "test-standard.kml", "test-standard.kmz"]
}- Feature count matches expected
- Feature names are correct
- Geometry types are correct (with GPX polygon-as-LineString exception)
- Colors are preserved
- All imported features are present in export
- Geometry types are correct in GeoJSON output
- Colors are preserved through round-trip
- Create a new folder in
test-files/(e.g.,02-elevation-data/) - Add a
test-config.jsonwith expected features - Add test files for each format you want to test
- Update
discoverTestSuites()intest-runner.jsto include the new suite
- GPX Polygons: GPX format doesn't support native polygons. They are represented as closed LineStrings, so the import validation allows this type mismatch.
- Export Format: Currently all exports are validated as GeoJSON (the canonical format). Cross-format export testing (e.g., import GPX → export GPX) is not yet implemented.