Add Playwright E2E testing with recorded workflows

- Add @playwright/test as dev dependency
- Create playwright.config.ts with Chrome-only testing config
- Add npm scripts: test:record, test:e2e, test:replay
- Create 13 test recordings covering:
  - 2-player and 3-player games
  - 8-ball, 9-ball, and 10-ball game types
  - Various race-to values (1, 3, 5, 7, 9) and "endlos" mode
  - Both wechselbreak (alternating) and winnerbreak rules
- Fix Infinity handling in gameService.ts and NewGameScreen.tsx
  - Parse "endlos" and "Infinity" strings as Infinity number
  - Properly serialize Infinity as string in form data
- Increase GameDetail score font size from 20vh to 40vh
- Update README.md with testing documentation:
  - Quick start guide for recording and running tests
  - Move E2E testing from "Future Improvements" (now implemented)
- Add comprehensive tests/recordings/README.md documentation

Purpose: Establishes browser automation testing infrastructure with
real workflow recordings, enabling regression testing and interaction
documentation for all game configuration combinations.
This commit is contained in:
Frank Schwenk
2025-10-31 14:41:36 +01:00
parent 9175d505c2
commit 65aaa92359
22 changed files with 757 additions and 12 deletions

View File

@@ -77,8 +77,42 @@ npm run dev
npm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
npm run test:record # Record browser interactions with Playwright
npm run test:e2e # Run all recorded browser automation scripts
```
## 🧪 Testing
The project uses **Playwright** for browser automation and recording. This allows you to record interactions once and replay them anytime, making it easy to test repetitive workflows.
### Quick Start
**Recording interactions:**
```bash
# Terminal 1: Start dev server
npm run dev
# Terminal 2: Start recording
npm run test:record
```
**Running recordings:**
```bash
npm run test:e2e
```
### Features
- **Record interactions**: Use Playwright codegen to capture clicks, form fills, and navigation
- **Replay scripts**: Run recorded scripts automatically
- **Duplicate & modify**: Copy any script and modify it (e.g., change the last step from clicking 'z' to clicking 'a')
- **Full scripting power**: Edit generated TypeScript files directly for custom automation
### Documentation
For detailed instructions on recording, modifying, and running scripts, see:
- **[tests/recordings/README.md](tests/recordings/README.md)** - Complete workflow documentation
## 📁 Project Structure
### **Core Components**
@@ -199,8 +233,7 @@ The application includes PWA features:
## 📈 Future Improvements
- Unit and integration testing with Vitest
- E2E testing with Playwright
- Unit and integration testing (if needed)
- Internationalization (i18n) support
- Advanced game statistics and analytics
- Real-time multiplayer support