Implement GUI Automation Test Commands and Refactor AsarWrapper Usage

- Added new test commands for GUI automation in `test_commands.cc`, including handling test runs, statuses, listings, and results.
- Refactored instances of `app::core::AsarWrapper` to `core::AsarWrapper` across multiple files for consistency.
- Updated CMake configuration to include new test command files.
- Modified integration and unit tests to reflect the changes in AsarWrapper usage.
- Ensured proper error handling and output formatting for test commands.
This commit is contained in:
scawful
2025-10-02 19:33:05 -04:00
parent d8f863a9ce
commit 6b13c2ea0a
38 changed files with 2096 additions and 1795 deletions

View File

@@ -236,14 +236,14 @@ if(YAZE_WITH_GRPC)
# Add service implementation sources
target_sources(yaze PRIVATE
${CMAKE_SOURCE_DIR}/src/app/core/imgui_test_harness_service.cc
${CMAKE_SOURCE_DIR}/src/app/core/imgui_test_harness_service.h
${CMAKE_SOURCE_DIR}/src/app/core/test_recorder.cc
${CMAKE_SOURCE_DIR}/src/app/core/test_recorder.h
${CMAKE_SOURCE_DIR}/src/app/core/test_script_parser.cc
${CMAKE_SOURCE_DIR}/src/app/core/test_script_parser.h
${CMAKE_SOURCE_DIR}/src/app/core/widget_discovery_service.cc
${CMAKE_SOURCE_DIR}/src/app/core/widget_discovery_service.h)
${CMAKE_SOURCE_DIR}/src/app/core/service/imgui_test_harness_service.cc
${CMAKE_SOURCE_DIR}/src/app/core/service/imgui_test_harness_service.h
${CMAKE_SOURCE_DIR}/src/app/core/service/widget_discovery_service.cc
${CMAKE_SOURCE_DIR}/src/app/core/service/widget_discovery_service.h
${CMAKE_SOURCE_DIR}/src/app/core/testing/test_recorder.cc
${CMAKE_SOURCE_DIR}/src/app/core/testing/test_recorder.h
${CMAKE_SOURCE_DIR}/src/app/core/testing/test_script_parser.cc
${CMAKE_SOURCE_DIR}/src/app/core/testing/test_script_parser.h)
target_include_directories(yaze PRIVATE
${CMAKE_SOURCE_DIR}/third_party/json/include)

View File

@@ -12,7 +12,6 @@
#include "asar-dll-bindings/c/asar.h"
namespace yaze {
namespace app {
namespace core {
AsarWrapper::AsarWrapper() : initialized_(false) {}
@@ -293,5 +292,4 @@ AsarSymbol AsarWrapper::ConvertAsarSymbol(const void* asar_symbol_data) const {
}
} // namespace core
} // namespace app
} // namespace yaze

View File

@@ -11,7 +11,6 @@
#include "absl/status/statusor.h"
namespace yaze {
namespace app {
namespace core {
/**
@@ -206,7 +205,6 @@ class AsarWrapper {
};
} // namespace core
} // namespace app
} // namespace yaze
#endif // YAZE_APP_CORE_ASAR_WRAPPER_H

View File

@@ -3,7 +3,7 @@ syntax = "proto3";
package yaze.test;
// ImGuiTestHarness service for remote GUI testing
// This service allows z3ed CLI to interact with YAZE's GUI for automated testing
// Allows z3ed CLI to interact with YAZE's GUI for automated testing
service ImGuiTestHarness {
// Health check - verifies the service is running
rpc Ping(PingRequest) returns (PingResponse);

View File

@@ -1,4 +1,4 @@
#include "app/core/imgui_test_harness_service.h"
#include "app/core/service/imgui_test_harness_service.h"
#ifdef YAZE_WITH_GRPC
@@ -21,7 +21,7 @@
#include "absl/time/time.h"
#include "app/core/proto/imgui_test_harness.grpc.pb.h"
#include "app/core/proto/imgui_test_harness.pb.h"
#include "app/core/test_script_parser.h"
#include "app/core/testing/test_script_parser.h"
#include "app/test/test_manager.h"
#include "yaze.h" // For YAZE_VERSION_STRING

View File

@@ -1,5 +1,5 @@
#ifndef YAZE_APP_CORE_IMGUI_TEST_HARNESS_SERVICE_H_
#define YAZE_APP_CORE_IMGUI_TEST_HARNESS_SERVICE_H_
#ifndef YAZE_APP_CORE_SERVICE_IMGUI_TEST_HARNESS_SERVICE_H_
#define YAZE_APP_CORE_SERVICE_IMGUI_TEST_HARNESS_SERVICE_H_
#ifdef YAZE_WITH_GRPC
@@ -8,8 +8,8 @@
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "app/core/test_recorder.h"
#include "app/core/widget_discovery_service.h"
#include "app/core/service/widget_discovery_service.h"
#include "app/core/testing/test_recorder.h"
// Include grpcpp headers for unique_ptr<Server> in member variable
#include <grpcpp/server.h>
@@ -153,4 +153,4 @@ class ImGuiTestHarnessServer {
} // namespace yaze
#endif // YAZE_WITH_GRPC
#endif // YAZE_APP_CORE_IMGUI_TEST_HARNESS_SERVICE_H_
#endif // YAZE_APP_CORE_SERVICE_IMGUI_TEST_HARNESS_SERVICE_H_

View File

@@ -1,4 +1,4 @@
#include "app/core/widget_discovery_service.h"
#include "app/core/service/widget_discovery_service.h"
#include <algorithm>
#include <map>

View File

@@ -1,5 +1,5 @@
#ifndef YAZE_APP_CORE_WIDGET_DISCOVERY_SERVICE_H_
#define YAZE_APP_CORE_WIDGET_DISCOVERY_SERVICE_H_
#ifndef YAZE_APP_CORE_SERVICE_WIDGET_DISCOVERY_SERVICE_H_
#define YAZE_APP_CORE_SERVICE_WIDGET_DISCOVERY_SERVICE_H_
#include <string>
#include <vector>
@@ -44,4 +44,4 @@ class WidgetDiscoveryService {
} // namespace test
} // namespace yaze
#endif // YAZE_APP_CORE_WIDGET_DISCOVERY_SERVICE_H_
#endif // YAZE_APP_CORE_SERVICE_WIDGET_DISCOVERY_SERVICE_H_

View File

@@ -1,4 +1,4 @@
#include "app/core/test_recorder.h"
#include "app/core/testing/test_recorder.h"
#include <utility>
@@ -7,7 +7,7 @@
#include "absl/strings/str_format.h"
#include "absl/time/clock.h"
#include "absl/time/time.h"
#include "app/core/test_script_parser.h"
#include "app/core/testing/test_script_parser.h"
#include "app/test/test_manager.h"
namespace yaze {

View File

@@ -1,5 +1,5 @@
#ifndef YAZE_APP_CORE_TEST_RECORDER_H_
#define YAZE_APP_CORE_TEST_RECORDER_H_
#ifndef YAZE_APP_CORE_TESTING_TEST_RECORDER_H_
#define YAZE_APP_CORE_TESTING_TEST_RECORDER_H_
#include <map>
#include <string>
@@ -52,7 +52,7 @@ class TestRecorder {
std::vector<std::string> assertion_failures;
std::string expected_value;
std::string actual_value;
HarnessTestStatus final_status = HarnessTestStatus::kUnspecified;
HarnessTestStatus final_status = HarnessTestStatus::kUnspecified;
std::string final_error_message;
std::map<std::string, int32_t> metrics;
absl::Time captured_at = absl::InfinitePast();
@@ -118,4 +118,4 @@ class TestRecorder {
} // namespace test
} // namespace yaze
#endif // YAZE_APP_CORE_TEST_RECORDER_H_
#endif // YAZE_APP_CORE_TESTING_TEST_RECORDER_H_

View File

@@ -1,4 +1,4 @@
#include "app/core/test_script_parser.h"
#include "app/core/testing/test_script_parser.h"
#include <filesystem>
#include <fstream>

View File

@@ -1,5 +1,5 @@
#ifndef YAZE_APP_CORE_TEST_SCRIPT_PARSER_H_
#define YAZE_APP_CORE_TEST_SCRIPT_PARSER_H_
#ifndef YAZE_APP_CORE_TESTING_TEST_SCRIPT_PARSER_H_
#define YAZE_APP_CORE_TESTING_TEST_SCRIPT_PARSER_H_
#include <map>
#include <string>
@@ -50,4 +50,4 @@ class TestScriptParser {
} // namespace test
} // namespace yaze
#endif // YAZE_APP_CORE_TEST_SCRIPT_PARSER_H_
#endif // YAZE_APP_CORE_TESTING_TEST_SCRIPT_PARSER_H_

View File

@@ -3584,7 +3584,7 @@ absl::Status OverworldEditor::ApplyZSCustomOverworldASM(int target_version) {
util::logf("Applying ZSCustomOverworld ASM v%d to ROM...", target_version);
// Initialize Asar wrapper
auto asar_wrapper = std::make_unique<app::core::AsarWrapper>();
auto asar_wrapper = std::make_unique<core::AsarWrapper>();
RETURN_IF_ERROR(asar_wrapper->Initialize());
// Create backup of ROM data

View File

@@ -11,7 +11,7 @@
#include "util/log.h"
#ifdef YAZE_WITH_GRPC
#include "app/core/imgui_test_harness_service.h"
#include "app/core/service/imgui_test_harness_service.h"
#include "app/test/test_manager.h"
#endif