#!/bin/bash # # Test Drag-and-Drop - Visual Workflow Builder # # Ce script vérifie que le drag-and-drop est bien implémenté # SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # Colors GREEN='\033[0;32m' RED='\033[0;31m' YELLOW='\033[1;33m' BLUE='\033[0;34m' NC='\033[0m' echo "==========================================" echo "Test Drag-and-Drop Implementation" echo "==========================================" echo "" # Check if files exist echo -e "${BLUE}Checking implementation files...${NC}" FILES_TO_CHECK=( "frontend/src/components/Palette/index.tsx" "frontend/src/components/Canvas/index.tsx" "frontend/src/App.tsx" ) ALL_OK=true for file in "${FILES_TO_CHECK[@]}"; do if [ -f "$SCRIPT_DIR/$file" ]; then echo -e "${GREEN}✓${NC} $file exists" else echo -e "${RED}✗${NC} $file missing" ALL_OK=false fi done echo "" echo -e "${BLUE}Checking drag-and-drop handlers...${NC}" # Check Palette has drag handlers if grep -q "handleDragStart" "$SCRIPT_DIR/frontend/src/components/Palette/index.tsx"; then echo -e "${GREEN}✓${NC} Palette has handleDragStart" else echo -e "${RED}✗${NC} Palette missing handleDragStart" ALL_OK=false fi if grep -q "draggable" "$SCRIPT_DIR/frontend/src/components/Palette/index.tsx"; then echo -e "${GREEN}✓${NC} Palette has draggable attribute" else echo -e "${RED}✗${NC} Palette missing draggable attribute" ALL_OK=false fi # Check Canvas has drop handlers if grep -q "handleDrop" "$SCRIPT_DIR/frontend/src/components/Canvas/index.tsx"; then echo -e "${GREEN}✓${NC} Canvas has handleDrop" else echo -e "${RED}✗${NC} Canvas missing handleDrop" ALL_OK=false fi if grep -q "handleDragOver" "$SCRIPT_DIR/frontend/src/components/Canvas/index.tsx"; then echo -e "${GREEN}✓${NC} Canvas has handleDragOver" else echo -e "${RED}✗${NC} Canvas missing handleDragOver" ALL_OK=false fi if grep -q "onDrop={handleDrop}" "$SCRIPT_DIR/frontend/src/components/Canvas/index.tsx"; then echo -e "${GREEN}✓${NC} Canvas ReactFlow has onDrop prop" else echo -e "${RED}✗${NC} Canvas ReactFlow missing onDrop prop" ALL_OK=false fi if grep -q "onDragOver={handleDragOver}" "$SCRIPT_DIR/frontend/src/components/Canvas/index.tsx"; then echo -e "${GREEN}✓${NC} Canvas ReactFlow has onDragOver prop" else echo -e "${RED}✗${NC} Canvas ReactFlow missing onDragOver prop" ALL_OK=false fi # Check App.tsx passes onNodeAdd if grep -q "onNodeAdd={handleNodeAdd}" "$SCRIPT_DIR/frontend/src/App.tsx"; then echo -e "${GREEN}✓${NC} App.tsx passes onNodeAdd to Canvas" else echo -e "${RED}✗${NC} App.tsx missing onNodeAdd prop" ALL_OK=false fi echo "" echo -e "${BLUE}Checking TypeScript compilation...${NC}" cd "$SCRIPT_DIR/frontend" if npm run type-check > /dev/null 2>&1; then echo -e "${GREEN}✓${NC} TypeScript compilation successful" else echo -e "${RED}✗${NC} TypeScript compilation failed" ALL_OK=false fi echo "" echo "==========================================" if [ "$ALL_OK" = true ]; then echo -e "${GREEN}✓ All checks passed!${NC}" echo "" echo "Drag-and-drop is fully implemented!" echo "" echo "To test it:" echo "1. Run: ./start.sh" echo "2. Open: http://localhost:3000" echo "3. Drag a node from the palette to the canvas" echo "" echo "See DRAG_DROP_GUIDE.md for detailed instructions." else echo -e "${RED}✗ Some checks failed${NC}" echo "" echo "Please review the errors above." fi echo "=========================================="