feat: Implement gRPC support for CLI Agent Test Command and enhance build configuration
This commit is contained in:
@@ -92,44 +92,31 @@ Historical documentation (design decisions, phase completions, technical notes)
|
||||
|
||||
**See**: [IT-01-QUICKSTART.md](IT-01-QUICKSTART.md) for usage examples
|
||||
|
||||
### ✅ IT-02: CLI Agent Test Command (COMPLETE) 🎉
|
||||
### ✅ IT-02: CLI Agent Test Command (IMPLEMENTATION COMPLETE) 🎉
|
||||
**Implementation Complete**: Natural language → automated GUI testing
|
||||
**Time Invested**: 4 hours (design + implementation + documentation)
|
||||
**Status**: Ready for validation
|
||||
**Time Invested**: 6 hours (design + implementation + build fixes)
|
||||
**Status**: Build successful, runtime issue discovered
|
||||
|
||||
**Components**:
|
||||
- **GuiAutomationClient**: gRPC wrapper for CLI usage (6 RPC methods)
|
||||
- **TestWorkflowGenerator**: Natural language prompt parser (4 pattern types)
|
||||
- **`z3ed agent test`**: End-to-end automation command
|
||||
**See**: [IMPLEMENTATION_STATUS_OCT2_PM.md](IMPLEMENTATION_STATUS_OCT2_PM.md) for complete details
|
||||
|
||||
**Supported Prompts**:
|
||||
1. "Open Overworld editor" → Click + Wait
|
||||
2. "Open Dungeon editor and verify it loads" → Click + Wait + Assert
|
||||
3. "Type 'zelda3.sfc' in filename input" → Click + Type
|
||||
4. "Click Open ROM button" → Single click
|
||||
**Components Completed**:
|
||||
- ✅ GuiAutomationClient: gRPC wrapper for CLI usage (6 RPC methods)
|
||||
- ✅ TestWorkflowGenerator: Natural language prompt parser (4 pattern types)
|
||||
- ✅ `z3ed agent test`: End-to-end automation command
|
||||
- ✅ Build system integration (gRPC proto generation, includes, linking)
|
||||
- ✅ Conditional compilation guards for optional gRPC features
|
||||
|
||||
**Example Usage**:
|
||||
```bash
|
||||
# Start YAZE with test harness
|
||||
./build-grpc-test/bin/yaze.app/Contents/MacOS/yaze \
|
||||
--enable_test_harness \
|
||||
--test_harness_port=50052 \
|
||||
--rom_file=assets/zelda3.sfc &
|
||||
**Known Issue**:
|
||||
- ImGuiTestEngine assertion failure during test cleanup
|
||||
- Root cause: Synchronous test execution + immediate unregister violates engine assumptions
|
||||
- Solution: Refactor to use async test queue (see status document)
|
||||
|
||||
# Run automated test
|
||||
./build-grpc-test/bin/z3ed agent test \
|
||||
--prompt "Open Overworld editor"
|
||||
### 📋 Priority 1: Fix Runtime Issue (NEXT) 🔄
|
||||
**Goal**: Resolve ImGuiTestEngine test lifecycle issue
|
||||
**Time Estimate**: 2-3 hours
|
||||
**Status**: Ready to implement
|
||||
|
||||
# Output:
|
||||
# === GUI Automation Test ===
|
||||
# Prompt: Open Overworld editor
|
||||
# ...
|
||||
# [1/2] Click(button:Overworld) ... ✓ (125ms)
|
||||
# [2/2] Wait(window_visible:Overworld Editor, 5000ms) ... ✓ (1250ms)
|
||||
# ✅ Test passed in 1375ms
|
||||
```
|
||||
|
||||
**See**: [IMPLEMENTATION_PROGRESS_OCT2.md](IMPLEMENTATION_PROGRESS_OCT2.md) for complete details
|
||||
**Approach**: Refactor RPC handlers to use asynchronous test queue instead of synchronous execution
|
||||
|
||||
### 📋 Priority 1: End-to-End Workflow Validation (NEXT)
|
||||
**Goal**: Test complete proposal lifecycle with real GUI and widgets
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
#include "cli/service/proposal_registry.h"
|
||||
#include "cli/service/resource_catalog.h"
|
||||
#include "cli/service/rom_sandbox_manager.h"
|
||||
#ifdef YAZE_WITH_GRPC
|
||||
#include "cli/service/gui_automation_client.h"
|
||||
#include "cli/service/test_workflow_generator.h"
|
||||
#endif
|
||||
#include "util/macro.h"
|
||||
|
||||
#include "absl/flags/declare.h"
|
||||
|
||||
@@ -62,7 +62,7 @@ absl::StatusOr<AutomationResult> GuiAutomationClient::Ping(
|
||||
|
||||
AutomationResult result;
|
||||
result.success = true;
|
||||
result.message = absl::StrFormat("Server version: %s (timestamp: %s)",
|
||||
result.message = absl::StrFormat("Server version: %s (timestamp: %lld)",
|
||||
response.yaze_version(),
|
||||
response.timestamp_ms());
|
||||
result.execution_time = std::chrono::milliseconds(0);
|
||||
@@ -111,7 +111,7 @@ absl::StatusOr<AutomationResult> GuiAutomationClient::Click(
|
||||
result.success = response.success();
|
||||
result.message = response.message();
|
||||
result.execution_time = std::chrono::milliseconds(
|
||||
std::stoll(response.execution_time_ms()));
|
||||
response.execution_time_ms());
|
||||
return result;
|
||||
#else
|
||||
return absl::UnimplementedError("gRPC not available");
|
||||
@@ -144,7 +144,7 @@ absl::StatusOr<AutomationResult> GuiAutomationClient::Type(
|
||||
result.success = response.success();
|
||||
result.message = response.message();
|
||||
result.execution_time = std::chrono::milliseconds(
|
||||
std::stoll(response.execution_time_ms()));
|
||||
response.execution_time_ms());
|
||||
return result;
|
||||
#else
|
||||
return absl::UnimplementedError("gRPC not available");
|
||||
@@ -177,7 +177,7 @@ absl::StatusOr<AutomationResult> GuiAutomationClient::Wait(
|
||||
result.success = response.success();
|
||||
result.message = response.message();
|
||||
result.execution_time = std::chrono::milliseconds(
|
||||
std::stoll(response.elapsed_ms()));
|
||||
response.elapsed_ms());
|
||||
return result;
|
||||
#else
|
||||
return absl::UnimplementedError("gRPC not available");
|
||||
@@ -224,8 +224,9 @@ absl::StatusOr<AutomationResult> GuiAutomationClient::Screenshot(
|
||||
}
|
||||
|
||||
yaze::test::ScreenshotRequest request;
|
||||
request.set_region(region);
|
||||
request.set_format(format);
|
||||
request.set_window_title(""); // Empty = main window
|
||||
request.set_output_path("/tmp/yaze_screenshot.png"); // Default path
|
||||
request.set_format(yaze::test::ScreenshotRequest::PNG); // Always PNG for now
|
||||
|
||||
yaze::test::ScreenshotResponse response;
|
||||
grpc::ClientContext context;
|
||||
|
||||
@@ -98,3 +98,29 @@ target_link_libraries(
|
||||
ImGuiTestEngine
|
||||
ImGui
|
||||
)
|
||||
|
||||
# ============================================================================
|
||||
# Optional gRPC Support for CLI Agent Test Command
|
||||
# ============================================================================
|
||||
if(YAZE_WITH_GRPC)
|
||||
message(STATUS "Adding gRPC support to z3ed CLI")
|
||||
|
||||
# Generate C++ code from .proto using the helper function from cmake/grpc.cmake
|
||||
target_add_protobuf(z3ed
|
||||
${CMAKE_SOURCE_DIR}/src/app/core/proto/imgui_test_harness.proto)
|
||||
|
||||
# Add CLI gRPC service sources
|
||||
target_sources(z3ed PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/src/cli/service/gui_automation_client.cc
|
||||
${CMAKE_SOURCE_DIR}/src/cli/service/gui_automation_client.h
|
||||
${CMAKE_SOURCE_DIR}/src/cli/service/test_workflow_generator.cc
|
||||
${CMAKE_SOURCE_DIR}/src/cli/service/test_workflow_generator.h)
|
||||
|
||||
# Link gRPC libraries
|
||||
target_link_libraries(z3ed PRIVATE
|
||||
grpc++
|
||||
grpc++_reflection
|
||||
libprotobuf)
|
||||
|
||||
message(STATUS "✓ gRPC CLI automation integrated")
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user