Version: 1.0.0
Last Updated: 2025-12-21
This guide explains how to test all CDN mappings configured in the Axion framework before committing the deletion of local JavaScript and CSS files.
./run_cdn_tests.sh
This will:
./run_cdn_tests.sh --mapping-only
This tests the CDN mapping logic without making network requests (~3 seconds).
./run_cdn_tests.sh --accessibility
This tests that all CDN URLs are accessible (~20 seconds with network).
./run_cdn_tests.sh --quick
This tests only the most critical libraries (ACE, Bootstrap, Chart.js, Mermaid, DOMPurify).
test_WebObject_CDN.py)17 tests covering:
load_cdn_mappings() method functionalityExample:
pytest resource.test/pytests/factory.core/test_WebObject_CDN.py -v
Results:
✓ 17 passed in 3.09s
test_CDN_accessibility.py)71+ parametrized tests covering:
Example:
pytest resource.test/pytests/factory.core/test_CDN_accessibility.py -v
Results:
Total URLs tested: 71
Passed: 71 ✓
Failed: 0 ✗
| Provider | Resources | Percentage |
|---|---|---|
| Cloudflare (cdnjs) | 38 | 53.5% |
| jsDelivr | 25 | 35.2% |
| DataTables CDN | 8 | 11.3% |
✅ ACE Editor - Code editor components
ace/ace.js → https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ace.js✅ Bootstrap - UI framework
bootstrap.min.js → https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js✅ Chart.js - Data visualization
chart.js → https://cdn.jsdelivr.net/npm/chart.js✅ Mermaid - Diagram generation
✅ DOMPurify - XSS protection
dompurify.min.js → https://cdnjs.cloudflare.com/ajax/libs/dompurify/3.0.6/purify.min.js✅ ApexCharts - Advanced charting
✅ Cytoscape - Graph visualization
✅ DataTables - Interactive tables
# Run all tests
./run_cdn_tests.sh
# Run mapping tests only (fast)
./run_cdn_tests.sh --mapping-only
# Run accessibility tests only
./run_cdn_tests.sh --accessibility
# Run quick critical libraries test
./run_cdn_tests.sh --quick
# Show CDN statistics
./run_cdn_tests.sh --summary
# Verbose output
./run_cdn_tests.sh --verbose
# All CDN mapping tests
pytest resource.test/pytests/factory.core/test_WebObject_CDN.py -v
# All accessibility tests
pytest resource.test/pytests/factory.core/test_CDN_accessibility.py -v
# Specific test class
pytest resource.test/pytests/factory.core/test_CDN_accessibility.py::TestSpecificCDNLibraries -v
# Bulk test with output
pytest resource.test/pytests/factory.core/test_CDN_accessibility.py::TestBulkAccessibility -v -s
# Statistics
pytest resource.test/pytests/factory.core/test_CDN_accessibility.py::TestCDNStatistics -v -s
resource.test/pytests/factory.core/test_WebObject_CDN.py
resource.test/pytests/factory.core/test_CDN_accessibility.py
factory.web/WebObject.yaml
run_cdn_tests.sh
factory.web/WebObject.yamlresources:
cdn_mappings:
paths:
"ace/ace.js": "https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ace.js"
aliases:
"@ace-editor": "https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ace.js"
Loading: WebObject.load_cdn_mappings() loads and caches mappings
Replacement: Objects.add_resource_script() transparently replaces local paths with CDN URLs
Testing: Test suites validate configuration and accessibility
run_cdn_tests.sh
↓
1. Check pytest installed
↓
2. Run mapping tests (test_WebObject_CDN.py)
- Validate configuration
- Test caching
- Check YAML structure
↓
3. Run accessibility tests (test_CDN_accessibility.py)
- Test each CDN URL
- Validate HTTP 200
- Check content validity
↓
4. Report results
- Summary statistics
- Failed URLs (if any)
- Provider breakdown
Solution:
# Activate virtual environment
source dev-env/bin/activate
# Or install pytest
pip install pytest
Possible causes:
Solution:
Steps:
This is normal. Some URLs are mapped both as paths and aliases:
ace/ace.js → CDN URL@ace-editor → Same CDN URLThis provides flexibility in how resources are referenced.
Before committing the deletion of local JavaScript/CSS files:
./run_cdn_tests.sh successfullyname: CDN Tests
on: [push, pull_request]
jobs:
cdn-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m venv dev-env
source dev-env/bin/activate
pip install pytest PyYAML
- name: Run CDN tests
run: ./run_cdn_tests.sh
cdn-tests:
image: python:3.12
script:
- python -m venv dev-env
- source dev-env/bin/activate
- pip install pytest PyYAML
- ./run_cdn_tests.sh
After switching to CDN:
| Test Type | Duration | Network Required |
|---|---|---|
| Mapping tests | ~3 seconds | No |
| Accessibility tests | ~20 seconds | Yes |
| Quick tests | ~3 seconds | Yes |
| All tests | ~23 seconds | Yes |
For issues or questions:
Last Test Run: All 71 CDN URLs accessible ✓
Test Success Rate: 100%
Ready for Production: ✓