yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::cli::GuiAutomationClient Class Reference

Client for automating YAZE GUI through gRPC. More...

#include <gui_automation_client.h>

Inheritance diagram for yaze::cli::GuiAutomationClient:

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< AutomationResultPing (const std::string &message="ping")
 Check if the server is reachable and responsive.
 
absl::StatusOr< AutomationResultClick (const std::string &target, ClickType type=ClickType::kLeft)
 Click a GUI element.
 
absl::StatusOr< AutomationResultType (const std::string &target, const std::string &text, bool clear_first=false)
 Type text into an input field.
 
absl::StatusOr< AutomationResultWait (const std::string &condition, int timeout_ms=5000, int poll_interval_ms=100)
 Wait for a condition to be met.
 
absl::StatusOr< AutomationResultAssert (const std::string &condition)
 Assert a GUI state condition.
 
absl::StatusOr< AutomationResultScreenshot (const std::string &region="full", const std::string &format="PNG")
 Capture a screenshot.
 
absl::StatusOr< TestStatusDetailsGetTestStatus (const std::string &test_id)
 Fetch the current execution status for a harness test.
 
absl::StatusOr< ListTestsResultListTests (const std::string &category_filter="", int page_size=100, const std::string &page_token="")
 Enumerate harness tests with optional filtering.
 
absl::StatusOr< TestResultDetailsGetTestResults (const std::string &test_id, bool include_logs=false)
 Retrieve detailed results for a harness test execution.
 
absl::StatusOr< DiscoverWidgetsResultDiscoverWidgets (const DiscoverWidgetsQuery &query)
 
absl::StatusOr< ReplayTestResultReplayTest (const std::string &script_path, bool ci_mode, const std::map< std::string, std::string > &parameter_overrides={})
 
absl::StatusOr< StartRecordingResultStartRecording (const std::string &output_path, const std::string &session_name, const std::string &description)
 
absl::StatusOr< StopRecordingResultStopRecording (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
 

Detailed Description

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:

GuiAutomationClient client("localhost:50052");
RETURN_IF_ERROR(client.Connect());
auto result = client.Click("button:Overworld", ClickType::kLeft);
if (!result.ok()) return result.status();
if (!result->success) {
return absl::InternalError(result->message);
}
Client for automating YAZE GUI through gRPC.
#define RETURN_IF_ERROR(expression)
Definition macro.h:53

Definition at line 242 of file gui_automation_client.h.

Constructor & Destructor Documentation

◆ GuiAutomationClient()

yaze::cli::GuiAutomationClient::GuiAutomationClient ( const std::string &  server_address)
explicit

Construct a new GUI automation client.

Parameters
server_addressAddress of the test harness server (e.g., "localhost:50052")

Definition at line 77 of file gui_automation_client.cc.

Member Function Documentation

◆ Connect()

absl::Status yaze::cli::GuiAutomationClient::Connect ( )

Connect to the test harness server.

Returns
Status indicating success or failure

Definition at line 80 of file gui_automation_client.cc.

References connected_, Ping(), and server_address_.

Here is the call graph for this function:

◆ Ping()

absl::StatusOr< AutomationResult > yaze::cli::GuiAutomationClient::Ping ( const std::string &  message = "ping")

Check if the server is reachable and responsive.

Parameters
messageOptional message to send in ping
Returns
Result with server version and timestamp

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().

◆ Click()

absl::StatusOr< AutomationResult > yaze::cli::GuiAutomationClient::Click ( const std::string &  target,
ClickType  type = ClickType::kLeft 
)

Click a GUI element.

Parameters
targetTarget element (format: "button:Label" or "window:Name")
typeType of click (left, right, middle, double)
Returns
Result indicating success/failure and execution time

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().

◆ Type()

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.

Parameters
targetTarget input field (format: "input:Label")
textText to type
clear_firstWhether to clear existing text before typing
Returns
Result indicating success/failure and execution time

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().

◆ Wait()

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.

Parameters
conditionCondition to wait for (e.g., "window_visible:Editor")
timeout_msMaximum time to wait in milliseconds
poll_interval_msHow often to check the condition
Returns
Result indicating whether condition was met

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().

◆ Assert()

absl::StatusOr< AutomationResult > yaze::cli::GuiAutomationClient::Assert ( const std::string &  condition)

Assert a GUI state condition.

Parameters
conditionCondition to assert (e.g., "visible:Window Name")
Returns
Result with actual vs expected values

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().

◆ Screenshot()

absl::StatusOr< AutomationResult > yaze::cli::GuiAutomationClient::Screenshot ( const std::string &  region = "full",
const std::string &  format = "PNG" 
)

Capture a screenshot.

Parameters
regionRegion to capture ("full", "window", "element")
formatImage format ("PNG", "JPEG")
Returns
Result with file path if successful

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.

◆ GetTestStatus()

◆ ListTests()

◆ GetTestResults()

◆ DiscoverWidgets()

◆ ReplayTest()

◆ StartRecording()

absl::StatusOr< StartRecordingResult > yaze::cli::GuiAutomationClient::StartRecording ( const std::string &  output_path,
const std::string &  session_name,
const std::string &  description 
)

◆ StopRecording()

absl::StatusOr< StopRecordingResult > yaze::cli::GuiAutomationClient::StopRecording ( const std::string &  recording_id,
bool  discard = false 
)

◆ IsConnected()

bool yaze::cli::GuiAutomationClient::IsConnected ( ) const
inline

Check if client is connected.

Definition at line 347 of file gui_automation_client.h.

References connected_.

◆ ServerAddress()

const std::string & yaze::cli::GuiAutomationClient::ServerAddress ( ) const
inline

Get the server address.

Definition at line 352 of file gui_automation_client.h.

References server_address_.

Member Data Documentation

◆ server_address_

std::string yaze::cli::GuiAutomationClient::server_address_
private

Definition at line 358 of file gui_automation_client.h.

Referenced by Connect(), and ServerAddress().

◆ connected_

bool yaze::cli::GuiAutomationClient::connected_ = false
private

Definition at line 359 of file gui_automation_client.h.

Referenced by Connect(), and IsConnected().


The documentation for this class was generated from the following files: