Comprehensive testing framework for the Vibe Stats browser extension, including API endpoint testing, visual component validation, and interactive test viewer.
# Run all tests
npm test
# Run specific test types
npm run test:api # Test API endpoints only
npm run test:visual # Test icons and badges only
npm run test:viewer # Open interactive test viewer
tests/
├── api-tester.js # API endpoint testing module
├── visual-tester.js # Visual component testing module
├── test-runner.js # Main test runner and CLI
├── test-viewer.html # Interactive web-based test interface
├── simple-server.js # HTTP server for web testing
├── package.json # Test dependencies and scripts
└── README.md # This documentation
api-tester.js
)const APITester = require('./api-tester');
const tester = new APITester();
const results = await tester.runAllTests();
Features:
visual-tester.js
)const VisualTester = require('./visual-tester');
const tester = new VisualTester();
const results = await tester.runAllTests();
Features:
test-runner.js
)# Run all tests with export and viewer
node test-runner.js --export --viewer
# Run specific test types
node test-runner.js --api
node test-runner.js --visual
Features:
The test-viewer.html
provides a rich web interface for testing:
# Option 1: Direct file access
open tests/test-viewer.html
# Option 2: Via npm script
npm run test:viewer
# Option 3: HTTP server (for advanced testing)
cd tests && npm run serve
# Then open http://localhost:3000
Tests provide colored console output with:
Results can be exported to test-results.json
:
{
"timestamp": "2024-01-01T12:00:00.000Z",
"duration": 5.23,
"results": {
"api": { /* API test results */ },
"visual": { /* Visual test results */ }
},
"summary": {
"overallSuccess": true,
"testsRun": { "api": true, "visual": true }
}
}
https://status.anthropic.com/api/v2/status.json
https://status.anthropic.com/api/v2/incidents.json
https://status.anthropic.com/api/v2/summary.json
https://www.githubstatus.com/api/v2/status.json
https://www.githubstatus.com/api/v2/incidents.json
https://www.githubstatus.com/api/v2/summary.json
icons/ai-vibe-16.png
(16x16px)icons/ai-vibe-32.png
(32x32px)icons/ai-vibe-48.png
(48x48px)icons/ai-vibe-128.png
(128x128px)# Check internet connection and API availability
curl -s https://status.anthropic.com/api/v2/status.json
curl -s https://www.githubstatus.com/api/v2/status.json
# Verify icon files exist
ls -la icons/ai-vibe-*.png
# Try manual opening
open tests/test-viewer.html
# Or use HTTP server
cd tests && node simple-server.js
# Then open http://localhost:3000
# Make test runner executable (Unix-like systems)
chmod +x tests/test-runner.js
Run tests with detailed logging:
NODE_ENV=development npm test
Tests are designed to mirror the extension’s actual logic:
background.js
For development workflows:
# Quick validation before building
npm run validate && npm test
# Full pre-release testing
npm run prepare-release && npm test
# Visual testing during development
npm run test:viewer # Keep open for quick visual checks
npm test && npm run build
npm run test:viewer
node test-runner.js --export
Made with ❤️ for robust extension development