8ed402bbe0
- Add tutor message guardrail to prevent rapid-fire messages - Track last message by move index - Wait for both player and opponent moves before speaking - Speak immediately when player deviates from theory - Add deviation dialog with three options: - Continue Playing (Start Game) - transitions to game mode - Undo & Return to Opening - returns to theory - Explore This Variation - continues off-book practice - Implement smooth game mode transition: - Pass opening context from trainer to game - Tutor welcomes player with context about their study - Computer makes first move if needed in starting position - Fix generate-test-fixtures script: - Add safety check to prevent overwriting real data - Restore full opening database (12,379 openings) - Rebuild move index (12,377 sequences) - Add clear warnings about test fixtures - Update ChessGame to accept openingContext prop - Update Tutor to display contextual greeting in game mode 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
36 lines
1012 B
TypeScript
36 lines
1012 B
TypeScript
import fs from 'fs';
|
|
import path from 'path';
|
|
|
|
/**
|
|
* Global setup for Playwright e2e tests
|
|
* Copies test fixtures to public directory before tests run
|
|
*/
|
|
export default function globalSetup() {
|
|
console.log('🔧 Setting up e2e test environment...');
|
|
|
|
const fixturesDir = path.join(__dirname, 'fixtures/openings');
|
|
const targetDir = path.join(__dirname, '../public/openings');
|
|
|
|
// Ensure target directory exists
|
|
if (!fs.existsSync(targetDir)) {
|
|
fs.mkdirSync(targetDir, { recursive: true });
|
|
}
|
|
|
|
// Copy fixture files
|
|
const files = ['ecoA.json', 'ecoB.json', 'ecoC.json', 'ecoD.json', 'ecoE.json', 'moveIndex.json'];
|
|
|
|
for (const file of files) {
|
|
const source = path.join(fixturesDir, file);
|
|
const target = path.join(targetDir, file);
|
|
|
|
if (fs.existsSync(source)) {
|
|
fs.copyFileSync(source, target);
|
|
console.log(` ✓ Copied ${file}`);
|
|
} else {
|
|
console.warn(` ⚠️ Fixture not found: ${file}`);
|
|
}
|
|
}
|
|
|
|
console.log('✅ Test fixtures ready\n');
|
|
}
|