Add comprehensive test suite with Vitest and Playwright

**Unit Tests (Vitest):**
- Test game logic: inventory management, barrel calculations
- Test whale hunting mechanics: fuel consumption, oil rewards, health system
- Test mobile detection patterns
- Test crosshair bounds and scene transitions
- 21 unit tests covering core game logic
- Fast execution with jsdom environment

**E2E Tests (Playwright):**
- Test complete game flows from intro to hunting
- Test scene navigation and transitions
- Test whale hunting interaction
- Test mobile compatibility and touch interactions
- Test desktop scaling on various viewports
- Run on both desktop (Chrome) and mobile (iPhone 12) configurations

**Test Scripts:**
- npm test - Run unit tests
- npm run test:ui - Run unit tests with UI
- npm run test:coverage - Run with coverage report
- npm run test:e2e - Run E2E tests
- npm run test:e2e:ui - Run E2E tests with UI
- npm run test:all - Run all tests

**Configuration:**
- Vitest configured with jsdom for fast unit testing
- Playwright configured with automatic dev server startup
- Test coverage reporting enabled
- Separate unit and E2E test directories

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Thomas Richter
2025-12-18 06:48:02 +01:00
parent dc28c9f6eb
commit b52cdb0685
6 changed files with 2164 additions and 4 deletions

View File

@@ -6,15 +6,30 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
"preview": "vite preview",
"test": "vitest",
"test:ui": "vitest --ui",
"test:coverage": "vitest --coverage",
"test:e2e": "playwright test",
"test:e2e:ui": "playwright test --ui",
"test:all": "npm run test && npm run test:e2e"
},
"keywords": ["game", "phaser", "adventure", "point-and-click"],
"keywords": [
"game",
"phaser",
"adventure",
"point-and-click"
],
"author": "",
"license": "MIT",
"dependencies": {
"phaser": "^3.80.1"
},
"devDependencies": {
"vite": "^5.0.0"
"@playwright/test": "^1.57.0",
"@vitest/ui": "^4.0.16",
"jsdom": "^27.3.0",
"vite": "^5.0.0",
"vitest": "^4.0.16"
}
}