#!/bin/bash # 🎭 Playwright E2E Test Setup Script echo "🎭 Setting up Playwright for E2E testing..." # Check if we're in the right directory if [[ ! -f "package.json" ]]; then echo "❌ Error: Must be run from project root directory" exit 1 fi # Install Playwright if not already installed echo "📦 Installing Playwright..." if command -v bun &> /dev/null; then bun add -D @playwright/test else npm install -D @playwright/test fi # Install browser binaries echo "🌐 Installing browser binaries..." bunx playwright install # Install system dependencies (Linux) if [[ "$OSTYPE" == "linux-gnu"* ]]; then echo "🐧 Installing system dependencies for Linux..." bunx playwright install-deps fi # Create .gitignore entries for Playwright echo "📝 Updating .gitignore for Playwright artifacts..." if ! grep -q "test-results" .gitignore; then echo "" >> .gitignore echo "# Playwright artifacts" >> .gitignore echo "test-results/" >> .gitignore echo "playwright-report/" >> .gitignore echo "playwright/.cache/" >> .gitignore fi # Verify installation echo "✅ Verifying Playwright installation..." bunx playwright --version echo "" echo "🎉 Playwright setup complete!" echo "" echo "📋 Quick start commands:" echo " bun run test:e2e # Run all E2E tests" echo " bun run test:e2e:ui # Run tests in UI mode" echo " bun run test:e2e:debug # Debug tests" echo " bun run test:e2e:report # View test report" echo "" echo "📚 Documentation: tests/e2e/README.md" echo "⚙️ Configuration: playwright.config.ts"