This document outlines the testing strategy and procedures for FoxCloud.
Located in src/test/, these tests verify individual components:
- Core handler functionality
- Subscription service generation
- Utility functions
- Network component helpers
Tests that verify the interaction between components:
- End-to-end request handling
- WebSocket connection establishment
- Environment variable processing
- Configuration generation
Tests that verify the deployment process:
- Build process validation
- Environment variable injection
- Worker deployment success
- Runtime functionality
npm run testThis runs the architecture tests which verify:
- Array utility functions
- Protocol constants
- Core component interactions
npm run dev
# Then manually test functionality- HTTP request handling
- WebSocket upgrade requests
- Subscription page generation
- VLESS configuration generation
- Error page rendering
- UUID validation
- PROXY_IP validation
- Multiple UUID handling
- Multiple PROXY_IP handling
- Missing environment variables
- WebSocket connection establishment
- Data transfer through WebSocket
- Proxy server connection
- Error handling in network operations
- Main page rendering
- Subscription page rendering
- Dark/light mode functionality
- Copy to clipboard functionality
- Responsive design on different screen sizes
- Deploy using each method:
- Pre-built worker.js
- Source build and deploy
- GitHub Actions deployment
- Verify deployment success in Cloudflare Dashboard
- Test access to main page
- Test access to subscription page
- Set single UUID and verify subscription page
- Set multiple UUIDs and verify subscription page
- Set single PROXY_IP and verify configuration
- Set multiple PROXY_IPs and verify configuration
- Test with invalid UUIDs (should handle gracefully)
- Test with invalid PROXY_IPs (should handle gracefully)
- Import VLESS configuration into V2Ray client
- Connect through proxy and verify functionality
- Test with different proxy IPs
- Test with different UUIDs
- Verify connection stability over time
- Test main page on desktop browser
- Test main page on mobile browser
- Test subscription page on desktop browser
- Test subscription page on mobile browser
- Verify dark mode functionality
- Verify light mode functionality
- Test copy button functionality
- Verify all links are working
- Measure response time for main page
- Measure response time for subscription page
- Measure WebSocket connection establishment time
- Measure data transfer latency
- Simultaneous request handling
- WebSocket connection limits
- Memory usage under load
- CPU usage under load
- Valid UUID access
- Invalid UUID rejection
- UUID rotation testing
- Access logging (if implemented)
- TLS encryption verification
- Data transfer integrity
- No sensitive data leakage
- Environment variable security
GitHub Actions workflows include:
- Build validation on each push
- Deployment testing (when credentials are available)
- Code quality checks
Aim for the following coverage targets:
- Unit tests: 80%+ coverage
- Integration tests: 70%+ coverage
- Critical path: 100% coverage
- Environment variables not set: Ensure all required variables are configured
- Network connectivity: Verify proxy servers are accessible
- Build failures: Check for TypeScript compilation errors
- Deployment errors: Verify Cloudflare credentials and permissions
- Check test logs for error messages
- Reproduce issue manually
- Isolate failing component
- Verify environment setup
- Check for external dependencies
- Review recent code changes
Use the following command to generate test UUIDs:
# Linux/macOS
cat /proc/sys/kernel/random/uuid
# Windows PowerShell
New-Guid
# Node.js
node -e "console.log(require('crypto').randomUUID())"Use known working proxy servers for testing:
- Document which IPs are used for testing
- Verify IPs are accessible before testing
- Have fallback IPs for redundancy
- Install dependencies:
npm install - Set environment variables in
wrangler.tomlor usingwrangler secret put - Start development server:
npm run dev
- Deploy to test subdomain
- Configure test environment variables
- Run full suite of tests
- Verify functionality before production deployment
Maintain records of:
- Test execution dates
- Test environment configurations
- Test results (pass/fail)
- Performance metrics
- Issues discovered and resolutions
Report issues through:
- GitHub Issues for code-related problems
- Documentation updates for procedure improvements
- Enhancement requests for new test scenarios
Regularly review and update:
- Test procedures based on new features
- Test coverage based on code changes
- Performance benchmarks
- Security testing procedures
- Client compatibility testing