testdriverai 4.1.30 → 4.1.33
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 +1 -17
- package/agent.js +10 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -55,19 +55,9 @@ Install testdriverai via NPM. This will make testdriverai available as a global
|
|
|
55
55
|
npm install testdriverai -g
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
## Set up the project
|
|
59
|
-
|
|
60
|
-
In the root of the project you want to test, run `testdriverai init`. This will authorize you to communicate with our API and set up example GitHub runner workflows.
|
|
61
|
-
|
|
62
|
-
```sh
|
|
63
|
-
testdriverai init
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
You're almost ready to deploy your first test!
|
|
67
|
-
|
|
68
58
|
## Teach TestDriver a test
|
|
69
59
|
|
|
70
|
-
|
|
60
|
+
Let's show TestDriver what we want to test. Run the following command:
|
|
71
61
|
|
|
72
62
|
```sh
|
|
73
63
|
testdriverai .testdriver/test.yml
|
|
@@ -79,8 +69,6 @@ TestDriver best practice is to start instructing TestDriver with your app in it'
|
|
|
79
69
|
|
|
80
70
|
If you have multiple monitors, make sure you do this on your primary display.
|
|
81
71
|
|
|
82
|
-
> When deploying, the TestDriver GitHub action executes tests on ephemeral VMs. You can use a prerun script to reach this initial state automatically.
|
|
83
|
-
|
|
84
72
|
## Instruct TestDriver
|
|
85
73
|
|
|
86
74
|
Now, just tell TestDriver what you want it to do. For now, stick with single commands like "click sign up" and "scroll down."
|
|
@@ -136,10 +124,6 @@ Feel free to ask TestDriver to perform some more tasks. Every time you prompt Te
|
|
|
136
124
|
> select august 8
|
|
137
125
|
```
|
|
138
126
|
|
|
139
|
-
## Save the test
|
|
140
|
-
|
|
141
|
-
If everything worked perfectly, use the `/save` command to save the test script to the current file.
|
|
142
|
-
|
|
143
127
|
If something didn't work, you can use `/undo` to remove all of the test steps added since the last prompt.
|
|
144
128
|
|
|
145
129
|
## Test the test locally
|
package/agent.js
CHANGED
|
@@ -220,13 +220,12 @@ const dieOnFatal = async (error) => {
|
|
|
220
220
|
log.log("info", chalk.red("Fatal Error") + `\n${error.message}`);
|
|
221
221
|
await summarize(error.message);
|
|
222
222
|
return await exit(true);
|
|
223
|
-
}
|
|
223
|
+
};
|
|
224
224
|
|
|
225
225
|
// creates a new "thread" in which the AI is given an error
|
|
226
226
|
// and responds. notice `actOnMarkdown` which will continue
|
|
227
227
|
// the thread until there are no more codeblocks to execute
|
|
228
228
|
const haveAIResolveError = async (error, markdown, depth = 0, undo = true) => {
|
|
229
|
-
|
|
230
229
|
if (thisCommand == "run" || error.fatal) {
|
|
231
230
|
return await dieOnFatal(error);
|
|
232
231
|
}
|
|
@@ -271,10 +270,12 @@ const haveAIResolveError = async (error, markdown, depth = 0, undo = true) => {
|
|
|
271
270
|
|
|
272
271
|
const mdStream = log.createMarkdownStreamLogger();
|
|
273
272
|
|
|
274
|
-
let response = await sdk.req(
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
273
|
+
let response = await sdk.req(
|
|
274
|
+
"error",
|
|
275
|
+
{
|
|
276
|
+
description: eMessage,
|
|
277
|
+
markdown,
|
|
278
|
+
image,
|
|
278
279
|
},
|
|
279
280
|
(chunk) => {
|
|
280
281
|
if (chunk.type === "data") {
|
|
@@ -506,7 +507,6 @@ const humanInput = async (currentTask, validateAndLoop = false) => {
|
|
|
506
507
|
image: lastScreenshot,
|
|
507
508
|
},
|
|
508
509
|
(chunk) => {
|
|
509
|
-
|
|
510
510
|
if (chunk.type === "data") {
|
|
511
511
|
mdStream.log(chunk.data);
|
|
512
512
|
}
|
|
@@ -558,6 +558,8 @@ const generate = async (type, count) => {
|
|
|
558
558
|
sanitizeFilename(testPrompt.headings[0])
|
|
559
559
|
.trim()
|
|
560
560
|
.replace(/ /g, "-")
|
|
561
|
+
.replace(/['"`]/g, "")
|
|
562
|
+
.replace(/[^a-zA-Z0-9-]/g, "") // remove any non-alphanumeric chars except hyphens
|
|
561
563
|
.toLowerCase() + ".md";
|
|
562
564
|
let path1 = path.join(process.cwd(), "testdriver", "generate", fileName);
|
|
563
565
|
|
|
@@ -739,7 +741,6 @@ New commands will be appended.
|
|
|
739
741
|
};
|
|
740
742
|
|
|
741
743
|
let setTerminalWindowTransparency = async (hide) => {
|
|
742
|
-
|
|
743
744
|
if (hide) {
|
|
744
745
|
try {
|
|
745
746
|
http
|
|
@@ -766,7 +767,6 @@ let setTerminalWindowTransparency = async (hide) => {
|
|
|
766
767
|
return;
|
|
767
768
|
}
|
|
768
769
|
|
|
769
|
-
|
|
770
770
|
try {
|
|
771
771
|
if (hide) {
|
|
772
772
|
if (terminalApp) {
|
|
@@ -952,7 +952,6 @@ const promptUser = () => {
|
|
|
952
952
|
};
|
|
953
953
|
|
|
954
954
|
const setTerminalApp = async (win) => {
|
|
955
|
-
|
|
956
955
|
if (terminalApp) return;
|
|
957
956
|
if (process.platform === "win32") {
|
|
958
957
|
terminalApp = win?.title || "";
|
|
@@ -1014,7 +1013,6 @@ const embed = async (file, depth) => {
|
|
|
1014
1013
|
};
|
|
1015
1014
|
|
|
1016
1015
|
const start = async () => {
|
|
1017
|
-
|
|
1018
1016
|
// console.log(await system.getPrimaryDisplay());
|
|
1019
1017
|
|
|
1020
1018
|
// @todo add-auth
|
|
@@ -1058,7 +1056,6 @@ const start = async () => {
|
|
|
1058
1056
|
console.log("");
|
|
1059
1057
|
}
|
|
1060
1058
|
|
|
1061
|
-
|
|
1062
1059
|
// should be start of new session
|
|
1063
1060
|
const sessionRes = await sdk.req("session/start", {
|
|
1064
1061
|
systemInformationOsInfo: await system.getSystemInformationOsInfo(),
|
|
@@ -1096,5 +1093,5 @@ process.on("unhandledRejection", async (reason, promise) => {
|
|
|
1096
1093
|
|
|
1097
1094
|
module.exports = {
|
|
1098
1095
|
setTerminalApp,
|
|
1099
|
-
start
|
|
1096
|
+
start,
|
|
1100
1097
|
};
|