yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
test_workflow_generator.h
Go to the documentation of this file.
1// test_workflow_generator.h
2// Converts natural language prompts into GUI automation workflows
3
4#ifndef YAZE_CLI_SERVICE_TEST_WORKFLOW_GENERATOR_H
5#define YAZE_CLI_SERVICE_TEST_WORKFLOW_GENERATOR_H
6
7#include "absl/status/statusor.h"
8
9#include <string>
10#include <vector>
11
12namespace yaze {
13namespace cli {
14
18enum class TestStepType {
19 kClick, // Click a button or element
20 kType, // Type text into an input
21 kWait, // Wait for a condition
22 kAssert, // Assert a condition is true
23 kScreenshot // Capture a screenshot
24};
25
29struct TestStep {
31 std::string target; // Widget/element target (e.g., "button:Overworld")
32 std::string text; // Text to type (for kType steps)
33 std::string condition; // Condition to wait for or assert
34 int timeout_ms = 5000; // Timeout for wait operations
35 bool clear_first = false; // Clear text before typing
36
37 std::string ToString() const;
38};
39
44 std::string description;
45 std::vector<TestStep> steps;
46
47 std::string ToString() const;
48};
49
73 public:
75
81 absl::StatusOr<TestWorkflow> GenerateWorkflow(const std::string& prompt);
82
83 private:
84 // Pattern matchers for different prompt types
85 bool MatchesOpenEditor(const std::string& prompt, std::string* editor_name);
86 bool MatchesOpenAndVerify(const std::string& prompt, std::string* editor_name);
87 bool MatchesTypeInput(const std::string& prompt, std::string* input_name,
88 std::string* text);
89 bool MatchesClickButton(const std::string& prompt, std::string* button_name);
90 bool MatchesMultiStep(const std::string& prompt);
91
92 // Workflow builders
93 TestWorkflow BuildOpenEditorWorkflow(const std::string& editor_name);
94 TestWorkflow BuildOpenAndVerifyWorkflow(const std::string& editor_name);
95 TestWorkflow BuildTypeInputWorkflow(const std::string& input_name,
96 const std::string& text);
97 TestWorkflow BuildClickButtonWorkflow(const std::string& button_name);
98
99 // Helper to normalize editor names (e.g., "overworld" → "Overworld Editor")
100 std::string NormalizeEditorName(const std::string& name);
101};
102
103} // namespace cli
104} // namespace yaze
105
106#endif // YAZE_CLI_SERVICE_TEST_WORKFLOW_GENERATOR_H
Generates GUI test workflows from natural language prompts.
bool MatchesClickButton(const std::string &prompt, std::string *button_name)
bool MatchesTypeInput(const std::string &prompt, std::string *input_name, std::string *text)
bool MatchesOpenEditor(const std::string &prompt, std::string *editor_name)
bool MatchesMultiStep(const std::string &prompt)
TestWorkflow BuildOpenEditorWorkflow(const std::string &editor_name)
TestWorkflow BuildTypeInputWorkflow(const std::string &input_name, const std::string &text)
TestWorkflow BuildClickButtonWorkflow(const std::string &button_name)
bool MatchesOpenAndVerify(const std::string &prompt, std::string *editor_name)
std::string NormalizeEditorName(const std::string &name)
TestWorkflow BuildOpenAndVerifyWorkflow(const std::string &editor_name)
absl::StatusOr< TestWorkflow > GenerateWorkflow(const std::string &prompt)
Generate a test workflow from a natural language prompt.
TestStepType
Type of test step to execute.
Main namespace for the application.
A single step in a GUI test workflow.
std::string ToString() const
A complete GUI test workflow.
std::vector< TestStep > steps
std::string ToString() const