#!/bin/bash # Test script for headless editor mode echo "=== AeThex Headless Editor Mode Test ===" echo "" # Check if binary exists if [ ! -f "engine/bin/aethex.linuxbsd.editor.x86_64" ]; then echo "โŒ Engine binary not found!" echo "Build it first: cd engine && scons platform=linuxbsd target=editor -j2" exit 1 fi echo "โœ… Engine binary found" echo "" # Start engine in background echo "๐Ÿš€ Starting engine in headless mode..." cd engine ./bin/aethex.linuxbsd.editor.x86_64 --headless-editor > ../headless.log 2>&1 & ENGINE_PID=$! cd .. echo " Engine PID: $ENGINE_PID" echo " Log file: headless.log" echo "" # Wait for engine to start echo "โณ Waiting 5 seconds for engine to initialize..." sleep 5 # Check if process is still running if ! ps -p $ENGINE_PID > /dev/null; then echo "โŒ Engine process died!" echo "" echo "Last 20 lines of log:" tail -20 headless.log exit 1 fi echo "โœ… Engine process running" echo "" # Test API echo "๐Ÿ“ก Testing StudioBridge API..." echo "" # Test 1: Get all node types echo "Test 1: getAllNodeTypes" RESULT=$(curl -s -X POST http://localhost:6007/rpc \ -H "Content-Type: application/json" \ -d '{"method":"getAllNodeTypes","params":{}}') if [[ $RESULT == *"success"* ]]; then echo "โœ… getAllNodeTypes - SUCCESS" echo " Response: ${RESULT:0:100}..." else echo "โŒ getAllNodeTypes - FAILED" echo " Response: $RESULT" fi echo "" # Test 2: Get scene tree echo "Test 2: getSceneTree" RESULT=$(curl -s -X POST http://localhost:6007/rpc \ -H "Content-Type: application/json" \ -d '{"method":"getSceneTree","params":{}}') if [[ $RESULT == *"success"* ]]; then echo "โœ… getSceneTree - SUCCESS" echo " Response: ${RESULT:0:100}..." else echo "โŒ getSceneTree - FAILED" echo " Response: $RESULT" fi echo "" # Test 3: Create a node echo "Test 3: createNode (Node2D)" RESULT=$(curl -s -X POST http://localhost:6007/rpc \ -H "Content-Type: application/json" \ -d '{"method":"createNode","params":{"type":"Node2D","name":"TestNode","parent":""}}') if [[ $RESULT == *"success"* ]]; then echo "โœ… createNode - SUCCESS" echo " Response: ${RESULT:0:100}..." else echo "โŒ createNode - FAILED" echo " Response: $RESULT" fi echo "" # Test 4: List directory echo "Test 4: listDirectory" RESULT=$(curl -s -X POST http://localhost:6007/rpc \ -H "Content-Type: application/json" \ -d '{"method":"listDirectory","params":{"path":"res://"}}') if [[ $RESULT == *"success"* ]]; then echo "โœ… listDirectory - SUCCESS" echo " Response: ${RESULT:0:100}..." else echo "โŒ listDirectory - FAILED" echo " Response: $RESULT" fi echo "" # Cleanup echo "๐Ÿงน Cleaning up..." kill $ENGINE_PID 2>/dev/null wait $ENGINE_PID 2>/dev/null echo " Engine process terminated" echo "" echo "=== All Tests Complete ===" echo "" echo "Log saved to: headless.log" echo "Review it for any errors or warnings." echo "" echo "Next steps:" echo "1. Review the API responses above" echo "2. Start Studio: cd aethex-studio && npm run dev" echo "3. Connect Studio to engine on localhost:6007" echo ""