Integration Testing
BulletBuzz includes comprehensive integration testing to ensure all systems work together correctly.
๐งช Test Categories
Deployment Integration Tests
- GitHub Pages Deployment: Verifies game and docs are accessible
- Documentation Integration: Tests links between game and docs
- Logo Integration: Verifies logo displays correctly across all pages
- Mermaid Diagram Integration: Tests architecture diagram rendering
Game Integration Tests
- End-to-End Game Flow: Complete game session testing
- UI Integration: Shop, game over, and HUD functionality
- System Integration: Collision, spawning, and level progression
- Performance Integration: Memory and performance monitoring
๐ Running Integration Tests
# Run all integration tests
npm run test:all
# Run specific integration tests
npm run test:github-pages # Deployment testing
npm run test:documentation # Documentation testing
npm run test:game-content # Game functionality testing
npm run test:readme-docs # README link testing
npm run test:game-doc-link # Game-to-docs link testing
npm run test:docs-logo-size # Logo integration testing
npm run test:mermaid-diagram # Diagram rendering testing
๐ Test Coverage
Deployment Integration
- โ Game loads correctly on GitHub Pages
- โ Documentation site is accessible
- โ All assets (JS, CSS, images) load properly
- โ Navigation links work correctly
- โ Logo displays with correct size
- โ Mermaid diagrams render properly
Game System Integration
- โ Player movement and AI integration
- โ Enemy spawning and AI integration
- โ Combat system integration
- โ Pickup system integration
- โ Level progression integration
- โ Shop system integration
UI Integration
- โ Game canvas rendering
- โ Shop modal functionality
- โ Game over screen display
- โ HUD elements (health, XP, level)
- โ Range visualization
- โ Performance metrics display
๐ง Test Implementation
Playwright Integration Testing
// advanced-screenshots.js
class ScreenshotTaker {
async testGameContent() {
// Load game page
await this.page.goto('https://tjsingleton.github.io/bulletbuzz/game/');
// Wait for game to load
await this.page.waitForSelector('#gameCanvas');
// Verify game is running
const canvas = await this.page.locator('#gameCanvas');
const isVisible = await canvas.isVisible();
// Check for game elements
const hasPlayer = await this.page.locator('.player').count() > 0;
const hasEnemies = await this.page.locator('.enemy').count() > 0;
return isVisible && hasPlayer && hasEnemies;
}
}
Error Detection Integration
// Monitor all types of errors
page.on('console', msg => {
if (msg.type() === 'error') {
console.log(`โ Console Error: ${msg.text()}`);
}
});
page.on('response', response => {
if (!response.ok()) {
console.log(`โ Network Error: ${response.url()} - ${response.status()}`);
}
});
page.on('pageerror', error => {
console.log(`โ Page Error: ${error.message}`);
});
๐ Test Scenarios
1. Complete Game Session
async testCompleteGameSession() {
// Start game
await this.page.goto('https://tjsingleton.github.io/bulletbuzz/game/');
await this.page.waitForSelector('#gameCanvas');
// Wait for game to run
await this.page.waitForTimeout(5000);
// Check game state
const gameState = await this.page.evaluate(() => {
return window.game?.getGameState();
});
// Verify game is running
expect(gameState.isRunning).toBe(true);
expect(gameState.player.health).toBeGreaterThan(0);
}
2. Documentation Integration
async testDocumentationIntegration() {
// Test game-to-docs link
await this.page.goto('https://tjsingleton.github.io/bulletbuzz/game/');
const docLink = await this.page.locator('a[href="../"]');
await docLink.click();
// Verify we're on docs page
const currentUrl = this.page.url();
expect(currentUrl).toContain('tjsingleton.github.io/bulletbuzz');
expect(currentUrl).not.toContain('/game/');
}
3. Logo Integration Test
async testLogoIntegration() {
// Test logo on docs page
await this.page.goto('https://tjsingleton.github.io/bulletbuzz/');
const logo = await this.page.locator('img[alt*="BulletBuzz Logo"]');
// Verify logo size
const logoWidth = await logo.evaluate(el => el.getBoundingClientRect().width);
expect(logoWidth).toBeGreaterThan(80);
expect(logoWidth).toBeLessThan(120);
}
๐ Common Integration Issues
Deployment Issues
- 404 Errors: Game files not deployed to GitHub Pages
- Asset Loading: CSS/JS files not loading correctly
- Path Issues: Incorrect relative paths in deployed files
Game Integration Issues
- Canvas Not Loading: Game not initializing properly
- AI Not Working: Player or enemy AI not functioning
- Systems Not Connected: Collision or spawning not working
Documentation Issues
- Links Broken: Navigation links not working
- Logo Not Displaying: Image paths incorrect
- Mermaid Not Rendering: JavaScript not loading
๐ Test Results
Success Criteria
- โ All pages load without errors
- โ Game runs smoothly
- โ Documentation is accessible
- โ All links work correctly
- โ Assets load properly
- โ No console or network errors
Failure Indicators
- โ 404 errors for game files
- โ Console errors in browser
- โ Game not loading or running
- โ Broken navigation links
- โ Missing or incorrect assets
๐ Continuous Integration
Integration tests run: - On every deployment - Before merging pull requests - During development for quick feedback - As part of the CI/CD pipeline
The integration testing ensures all systems work together correctly and provides immediate feedback on any issues.