Till Tomczak 27e1b2d82c Füge Cypress Konfiguration und Testumgebung hinzu
- Fügt cypress.config.ts für E2E und Komponenten Tests hinzu
- Fügt Cypress Testskripte und Docker-Compose Konfiguration hinzu
- Ermöglicht automatische E2E-Tests mit separater Testumgebung

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-03-28 10:40:15 +01:00

73 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
# Script to stop the test environment
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PARENT_DIR="$(dirname "$SCRIPT_DIR")"
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
echo -e "${YELLOW}Stopping MYP test environment...${NC}"
# Check if running in container
IN_CONTAINER=false
if [ -f /.dockerenv ]; then
IN_CONTAINER=true
fi
# Check if Docker is available and if we need sudo
NEED_SUDO=false
if [ "$IN_CONTAINER" = false ]; then
if ! docker ps &> /dev/null; then
if sudo docker ps &> /dev/null; then
echo -e "${YELLOW}Warning: Docker daemon requires sudo access. Will use sudo for all Docker commands.${NC}"
NEED_SUDO=true
fi
fi
fi
# Function to run docker compose (handles both docker-compose and docker compose syntax)
run_docker_compose() {
if [ "$NEED_SUDO" = true ]; then
if command -v docker-compose &> /dev/null; then
sudo docker-compose "$@"
else
sudo docker compose "$@"
fi
else
if command -v docker-compose &> /dev/null; then
docker-compose "$@"
else
docker compose "$@"
fi
fi
}
# Stop the backend container
echo "Stopping backend containers..."
cd "$SCRIPT_DIR"
run_docker_compose -f docker-compose.test.yml down
# Stop the frontend development server if we started it
if [ -f "$SCRIPT_DIR/frontend.pid" ]; then
FRONTEND_PID=$(cat "$SCRIPT_DIR/frontend.pid")
echo "Stopping frontend development server (PID: $FRONTEND_PID)..."
if kill -0 $FRONTEND_PID 2>/dev/null; then
kill $FRONTEND_PID
echo "Frontend development server stopped"
else
echo "Frontend development server is not running with PID $FRONTEND_PID"
fi
rm -f "$SCRIPT_DIR/frontend.pid"
rm -f "$SCRIPT_DIR/frontend.log"
else
echo "No frontend PID file found, assuming it was started externally"
fi
echo -e "${GREEN}Test environment has been stopped${NC}"