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 <string>
8#include <vector>
9
10#include "absl/status/statusor.h"
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,
87 std::string* editor_name);
88 bool MatchesTypeInput(const std::string& prompt, std::string* input_name,
89 std::string* text);
90 bool MatchesClickButton(const std::string& prompt, std::string* button_name);
91 bool MatchesMultiStep(const std::string& prompt);
92
93 // Workflow builders
94 TestWorkflow BuildOpenEditorWorkflow(const std::string& editor_name);
95 TestWorkflow BuildOpenAndVerifyWorkflow(const std::string& editor_name);
96 TestWorkflow BuildTypeInputWorkflow(const std::string& input_name,
97 const std::string& text);
98 TestWorkflow BuildClickButtonWorkflow(const std::string& button_name);
99
100 // Helper to normalize editor names (e.g., "overworld" → "Overworld Editor")
101 std::string NormalizeEditorName(const std::string& name);
102};
103
104} // namespace cli
105} // namespace yaze
106
107#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.
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