**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>
33 lines
690 B
JavaScript
33 lines
690 B
JavaScript
import { defineConfig, devices } from '@playwright/test';
|
|
|
|
export default defineConfig({
|
|
testDir: './tests/e2e',
|
|
fullyParallel: true,
|
|
forbidOnly: !!process.env.CI,
|
|
retries: process.env.CI ? 2 : 0,
|
|
workers: process.env.CI ? 1 : undefined,
|
|
reporter: 'html',
|
|
use: {
|
|
baseURL: 'http://localhost:5173',
|
|
trace: 'on-first-retry',
|
|
screenshot: 'only-on-failure',
|
|
},
|
|
|
|
projects: [
|
|
{
|
|
name: 'chromium',
|
|
use: { ...devices['Desktop Chrome'] },
|
|
},
|
|
{
|
|
name: 'mobile',
|
|
use: { ...devices['iPhone 12'] },
|
|
},
|
|
],
|
|
|
|
webServer: {
|
|
command: 'npm run dev',
|
|
url: 'http://localhost:5173',
|
|
reuseExistingServer: !process.env.CI,
|
|
},
|
|
});
|