testdriverai 1.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,134 @@
1
+ # TestDriver AI Agent
2
+
3
+
4
+ ## Workflow
5
+
6
+ Everything will be saved when SigInt is called
7
+
8
+ ### Editing and naming
9
+
10
+ ```sh
11
+ node index.js edit testdriver.yml
12
+ node index.js testdriver.yml
13
+ ```
14
+
15
+ ### Running
16
+
17
+ ```sh
18
+ node index.js run testdriver.yml
19
+ ```
20
+
21
+ ## Internal Commands Docs
22
+
23
+ ### `/summarize`
24
+
25
+ Writes a summary to `/tmp/oiResult.log` for GitHub and such.
26
+
27
+ ### `/save`
28
+
29
+ Writes yml instructions from memory to save file
30
+
31
+ ### `/run`
32
+
33
+ Execute a `/save`
34
+
35
+ ### `/summarize`
36
+
37
+ Generate a text summary of the test.
38
+
39
+ ### `/quit`
40
+
41
+ Exits the application.
42
+
43
+ ### `/undo`
44
+
45
+ Undo the last thing appended to the save file.
46
+
47
+ ### `/manual`
48
+
49
+ Generates the yml and runs it as if it were created from AI.
50
+
51
+ `/manual command=click x=10 y=20`
52
+ `/manual command=match-image path=sort.png`
53
+ `/manual command=wait-for-image path=sort.png seconds=10`
54
+ `/manual command=wait-for-text text='see detatils'`
55
+ `/manual command=embed file=open.yml`
56
+
57
+ # Old
58
+
59
+ ## Installation
60
+ ```sh
61
+ npm install
62
+ ```
63
+
64
+ ### Potential problems
65
+
66
+ #### Node GYP
67
+ FYI robotjs might require extra steps to install, due to `node-gyp`, so you have to:
68
+
69
+ ```sh
70
+ brew install python-setuptools
71
+ ```
72
+
73
+ or whatever accomplishes the same on your OS distro.
74
+
75
+ ## Running
76
+
77
+ ```
78
+ npm run dev
79
+ ```
80
+
81
+ ## Running as `testdriver`
82
+
83
+ Run `npm link` and the agent will be available globally as `testdriver`.
84
+
85
+ ```
86
+ npm link
87
+ testdriver
88
+ ```
89
+ ## Example of saving and restoring AI memory
90
+
91
+ Let's say I want to test the `/save` and `/summarize` call. It would be annoying to wait for an entire test to run to test the function once. Here's how you do it.
92
+
93
+ So let's say I just ran this test:
94
+
95
+ ```md
96
+ > open google chrome
97
+ > navigate to youtube.com
98
+ > search for 'cat videos'
99
+ > click the first one
100
+ ```
101
+
102
+ I would call `/savechat` to save the history JSON into the `/.chats` directory.
103
+
104
+ Then, I can make changes and spawn a new process. At that point I could run `/loadchat` to restore the agent memory
105
+ as if I had never exited the process:
106
+
107
+ ```sh
108
+ # load an old chat history to test saving
109
+ /loadchat .chats/1713391070500.json
110
+ ```
111
+
112
+ That will allow me to test things like `/save` and `/summarize` over and over again without running more tests.
113
+
114
+ ```sh
115
+ # save the test plan to markdown
116
+ /save
117
+ ```
118
+
119
+ ## Turning an exploratory test into a regression test
120
+
121
+ Ok so we've run our test. TestDriver will automatically save a regression to `./saves`. This saved regression will
122
+ contain the codeblocks the AI generated and ran in linear order.
123
+
124
+ Any invalid codeblocks (invalid yml) should not be written here. However, codeblocks that contain spelling errors or invalid paramers
125
+ will be written.
126
+
127
+ Any `yml` block that spawns a subrouteine (at depth 1 or higher) will invoke a REAL ai agent that will make decisions. This is also
128
+ an opportunity for it to go off the rails.
129
+
130
+ So for example, `click-text` does NOT hardcode the x/y coordinates. It is evaluated at run time, the AI is given a screenshot and the
131
+ `click-text` process starts from scratch. The AI *should* choose the same text every time, but it may not.
132
+
133
+ Same for `click-image`. We think that this will be more reliable than x,y coords or sub-image matching, as it allows the AI to adapt to
134
+ a changing application. No selectors!