feat: Implement gRPC support for CLI Agent Test Command and enhance build configuration
This commit is contained in:
@@ -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