Client for automating YAZE GUI through gRPC. More...
#include <gui_automation_client.h>
Public Member Functions | |
GuiAutomationClient (const std::string &server_address) | |
Construct a new GUI automation client. | |
absl::Status | Connect () |
Connect to the test harness server. | |
absl::StatusOr< AutomationResult > | Ping (const std::string &message="ping") |
Check if the server is reachable and responsive. | |
absl::StatusOr< AutomationResult > | Click (const std::string &target, ClickType type=ClickType::kLeft) |
Click a GUI element. | |
absl::StatusOr< AutomationResult > | Type (const std::string &target, const std::string &text, bool clear_first=false) |
Type text into an input field. | |
absl::StatusOr< AutomationResult > | Wait (const std::string &condition, int timeout_ms=5000, int poll_interval_ms=100) |
Wait for a condition to be met. | |
absl::StatusOr< AutomationResult > | Assert (const std::string &condition) |
Assert a GUI state condition. | |
absl::StatusOr< AutomationResult > | Screenshot (const std::string ®ion="full", const std::string &format="PNG") |
Capture a screenshot. | |
absl::StatusOr< TestStatusDetails > | GetTestStatus (const std::string &test_id) |
Fetch the current execution status for a harness test. | |
absl::StatusOr< ListTestsResult > | ListTests (const std::string &category_filter="", int page_size=100, const std::string &page_token="") |
Enumerate harness tests with optional filtering. | |
absl::StatusOr< TestResultDetails > | GetTestResults (const std::string &test_id, bool include_logs=false) |
Retrieve detailed results for a harness test execution. | |
absl::StatusOr< DiscoverWidgetsResult > | DiscoverWidgets (const DiscoverWidgetsQuery &query) |
absl::StatusOr< ReplayTestResult > | ReplayTest (const std::string &script_path, bool ci_mode, const std::map< std::string, std::string > ¶meter_overrides={}) |
absl::StatusOr< StartRecordingResult > | StartRecording (const std::string &output_path, const std::string &session_name, const std::string &description) |
absl::StatusOr< StopRecordingResult > | StopRecording (const std::string &recording_id, bool discard=false) |
bool | IsConnected () const |
Check if client is connected. | |
const std::string & | ServerAddress () const |
Get the server address. | |
Private Attributes | |
std::string | server_address_ |
bool | connected_ = false |
Client for automating YAZE GUI through gRPC.
This client wraps the ImGuiTestHarness gRPC service and provides a C++ API for CLI commands to drive the YAZE GUI remotely.
Example usage:
Definition at line 242 of file gui_automation_client.h.
|
explicit |
Construct a new GUI automation client.
server_address | Address of the test harness server (e.g., "localhost:50052") |
Definition at line 77 of file gui_automation_client.cc.
absl::Status yaze::cli::GuiAutomationClient::Connect | ( | ) |
Connect to the test harness server.
Definition at line 80 of file gui_automation_client.cc.
References connected_, Ping(), and server_address_.
absl::StatusOr< AutomationResult > yaze::cli::GuiAutomationClient::Ping | ( | const std::string & | message = "ping" | ) |
Check if the server is reachable and responsive.
message | Optional message to send in ping |
Definition at line 109 of file gui_automation_client.cc.
References yaze::cli::AutomationResult::execution_time, yaze::cli::AutomationResult::message, yaze::cli::AutomationResult::success, and yaze::cli::AutomationResult::test_id.
Referenced by Connect().
absl::StatusOr< AutomationResult > yaze::cli::GuiAutomationClient::Click | ( | const std::string & | target, |
ClickType | type = ClickType::kLeft |
||
) |
Click a GUI element.
target | Target element (format: "button:Label" or "window:Name") |
type | Type of click (left, right, middle, double) |
Definition at line 261 of file gui_automation_client.cc.
References yaze::cli::AutomationResult::execution_time, yaze::cli::kDouble, yaze::cli::kLeft, yaze::cli::kMiddle, yaze::cli::kRight, yaze::cli::AutomationResult::message, yaze::cli::AutomationResult::success, and yaze::cli::AutomationResult::test_id.
Referenced by yaze::cli::ai::AIGUIController::ExecuteGRPCAction().
absl::StatusOr< AutomationResult > yaze::cli::GuiAutomationClient::Type | ( | const std::string & | target, |
const std::string & | text, | ||
bool | clear_first = false |
||
) |
Type text into an input field.
target | Target input field (format: "input:Label") |
text | Text to type |
clear_first | Whether to clear existing text before typing |
Definition at line 309 of file gui_automation_client.cc.
References yaze::cli::AutomationResult::execution_time, yaze::cli::AutomationResult::message, yaze::cli::AutomationResult::success, and yaze::cli::AutomationResult::test_id.
Referenced by yaze::cli::ai::AIGUIController::ExecuteGRPCAction().
absl::StatusOr< AutomationResult > yaze::cli::GuiAutomationClient::Wait | ( | const std::string & | condition, |
int | timeout_ms = 5000 , |
||
int | poll_interval_ms = 100 |
||
) |
Wait for a condition to be met.
condition | Condition to wait for (e.g., "window_visible:Editor") |
timeout_ms | Maximum time to wait in milliseconds |
poll_interval_ms | How often to check the condition |
Definition at line 344 of file gui_automation_client.cc.
References yaze::cli::AutomationResult::execution_time, yaze::cli::AutomationResult::message, yaze::cli::AutomationResult::success, and yaze::cli::AutomationResult::test_id.
Referenced by yaze::cli::ai::AIGUIController::ExecuteGRPCAction().
absl::StatusOr< AutomationResult > yaze::cli::GuiAutomationClient::Assert | ( | const std::string & | condition | ) |
Assert a GUI state condition.
condition | Condition to assert (e.g., "visible:Window Name") |
Definition at line 378 of file gui_automation_client.cc.
References yaze::cli::AutomationResult::actual_value, yaze::cli::AutomationResult::execution_time, yaze::cli::AutomationResult::expected_value, yaze::cli::AutomationResult::message, yaze::cli::AutomationResult::success, and yaze::cli::AutomationResult::test_id.
Referenced by yaze::cli::ai::AIGUIController::ExecuteGRPCAction().
absl::StatusOr< AutomationResult > yaze::cli::GuiAutomationClient::Screenshot | ( | const std::string & | region = "full" , |
const std::string & | format = "PNG" |
||
) |
Capture a screenshot.
region | Region to capture ("full", "window", "element") |
format | Image format ("PNG", "JPEG") |
Definition at line 412 of file gui_automation_client.cc.
References yaze::cli::AutomationResult::execution_time, yaze::cli::AutomationResult::message, yaze::cli::AutomationResult::success, and yaze::cli::AutomationResult::test_id.
absl::StatusOr< TestStatusDetails > yaze::cli::GuiAutomationClient::GetTestStatus | ( | const std::string & | test_id | ) |
Fetch the current execution status for a harness test.
Definition at line 447 of file gui_automation_client.cc.
References yaze::cli::TestStatusDetails::assertion_failures, yaze::cli::TestStatusDetails::completed_at, yaze::cli::TestStatusDetails::error_message, yaze::cli::TestStatusDetails::execution_time_ms, yaze::cli::TestStatusDetails::queued_at, yaze::cli::TestStatusDetails::started_at, yaze::cli::TestStatusDetails::status, and yaze::cli::TestStatusDetails::test_id.
absl::StatusOr< ListTestsResult > yaze::cli::GuiAutomationClient::ListTests | ( | const std::string & | category_filter = "" , |
int | page_size = 100 , |
||
const std::string & | page_token = "" |
||
) |
Enumerate harness tests with optional filtering.
Definition at line 484 of file gui_automation_client.cc.
References yaze::cli::HarnessTestSummary::average_duration_ms, yaze::cli::HarnessTestSummary::category, yaze::cli::HarnessTestSummary::fail_count, yaze::cli::HarnessTestSummary::last_run_at, yaze::cli::HarnessTestSummary::name, yaze::cli::ListTestsResult::next_page_token, yaze::cli::HarnessTestSummary::pass_count, yaze::cli::HarnessTestSummary::test_id, yaze::cli::ListTestsResult::tests, yaze::cli::ListTestsResult::total_count, and yaze::cli::HarnessTestSummary::total_runs.
absl::StatusOr< TestResultDetails > yaze::cli::GuiAutomationClient::GetTestResults | ( | const std::string & | test_id, |
bool | include_logs = false |
||
) |
Retrieve detailed results for a harness test execution.
Definition at line 539 of file gui_automation_client.cc.
References yaze::cli::AssertionOutcome::actual_value, yaze::cli::TestResultDetails::assertions, yaze::cli::TestResultDetails::category, yaze::cli::AssertionOutcome::description, yaze::cli::TestResultDetails::duration_ms, yaze::cli::AssertionOutcome::error_message, yaze::cli::TestResultDetails::executed_at, yaze::cli::AssertionOutcome::expected_value, yaze::cli::TestResultDetails::failure_context, yaze::cli::TestResultDetails::logs, yaze::cli::TestResultDetails::metrics, yaze::cli::AssertionOutcome::passed, yaze::cli::TestResultDetails::screenshot_path, yaze::cli::TestResultDetails::screenshot_size_bytes, yaze::cli::TestResultDetails::success, yaze::cli::TestResultDetails::test_id, yaze::cli::TestResultDetails::test_name, and yaze::cli::TestResultDetails::widget_state.
absl::StatusOr< DiscoverWidgetsResult > yaze::cli::GuiAutomationClient::DiscoverWidgets | ( | const DiscoverWidgetsQuery & | query | ) |
Definition at line 599 of file gui_automation_client.cc.
References yaze::cli::WidgetDescriptor::bounds, yaze::cli::WidgetDescriptor::description, yaze::cli::WidgetDescriptor::enabled, yaze::cli::DiscoverWidgetsResult::generated_at, yaze::cli::WidgetDescriptor::has_bounds, yaze::cli::DiscoverWidgetsQuery::include_disabled, yaze::cli::DiscoverWidgetsQuery::include_invisible, yaze::cli::WidgetDescriptor::label, yaze::cli::WidgetDescriptor::last_seen_at, yaze::cli::WidgetDescriptor::last_seen_frame, yaze::cli::WidgetBoundingBox::max_x, yaze::cli::WidgetBoundingBox::max_y, yaze::cli::WidgetBoundingBox::min_x, yaze::cli::WidgetBoundingBox::min_y, yaze::cli::DiscoveredWindowInfo::name, yaze::cli::WidgetDescriptor::path, yaze::cli::DiscoverWidgetsQuery::path_prefix, yaze::cli::WidgetDescriptor::stale, yaze::cli::WidgetDescriptor::suggested_action, yaze::cli::DiscoverWidgetsResult::total_widgets, yaze::cli::WidgetDescriptor::type, yaze::cli::DiscoverWidgetsQuery::type_filter, yaze::cli::WidgetDescriptor::visible, yaze::cli::DiscoveredWindowInfo::visible, yaze::cli::WidgetDescriptor::widget_id, yaze::cli::DiscoveredWindowInfo::widgets, yaze::cli::DiscoverWidgetsQuery::window_filter, and yaze::cli::DiscoverWidgetsResult::windows.
absl::StatusOr< ReplayTestResult > yaze::cli::GuiAutomationClient::ReplayTest | ( | const std::string & | script_path, |
bool | ci_mode, | ||
const std::map< std::string, std::string > & | parameter_overrides = {} |
||
) |
Definition at line 143 of file gui_automation_client.cc.
References yaze::cli::AssertionOutcome::actual_value, yaze::cli::ReplayTestResult::assertions, yaze::cli::AssertionOutcome::description, yaze::cli::AssertionOutcome::error_message, yaze::cli::AssertionOutcome::expected_value, yaze::cli::ReplayTestResult::logs, yaze::cli::ReplayTestResult::message, yaze::cli::AssertionOutcome::passed, yaze::cli::ReplayTestResult::replay_session_id, yaze::cli::ReplayTestResult::steps_executed, and yaze::cli::ReplayTestResult::success.
absl::StatusOr< StartRecordingResult > yaze::cli::GuiAutomationClient::StartRecording | ( | const std::string & | output_path, |
const std::string & | session_name, | ||
const std::string & | description | ||
) |
Definition at line 191 of file gui_automation_client.cc.
References yaze::cli::StartRecordingResult::message, yaze::cli::StartRecordingResult::recording_id, yaze::cli::StartRecordingResult::started_at, and yaze::cli::StartRecordingResult::success.
absl::StatusOr< StopRecordingResult > yaze::cli::GuiAutomationClient::StopRecording | ( | const std::string & | recording_id, |
bool | discard = false |
||
) |
|
inline |
Check if client is connected.
Definition at line 347 of file gui_automation_client.h.
References connected_.
|
inline |
Get the server address.
Definition at line 352 of file gui_automation_client.h.
References server_address_.
|
private |
Definition at line 358 of file gui_automation_client.h.
Referenced by Connect(), and ServerAddress().
|
private |
Definition at line 359 of file gui_automation_client.h.
Referenced by Connect(), and IsConnected().