arbret/scripts/e2e.sh

42 lines
623 B
Bash
Raw Normal View History

2025-12-18 21:48:41 +01:00
#!/bin/bash
set -e
cd "$(dirname "$0")/.."
2025-12-18 23:33:32 +01:00
# Load environment variables if .env exists
if [ -f .env ]; then
set -a
source .env
set +a
fi
2025-12-18 21:48:41 +01:00
# Kill any existing backend
pkill -f "uvicorn main:app" 2>/dev/null || true
sleep 1
2025-12-18 23:33:32 +01:00
# Seed the database with roles and test users
cd backend
echo "Seeding database..."
uv run python seed.py
cd ..
2025-12-18 22:24:46 +01:00
# Start backend (SECRET_KEY should be set via .envrc or environment)
2025-12-18 21:48:41 +01:00
cd backend
uv run uvicorn main:app --port 8000 &
PID=$!
cd ..
# Wait for backend
sleep 2
# Run tests
cd frontend
npm run test:e2e
EXIT_CODE=$?
# Cleanup
kill $PID 2>/dev/null || true
exit $EXIT_CODE