testdriverai 6.0.16-canary.ea858d7.0 → 6.0.16-canary.f0eefe0.0
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/agent/events.js +1 -1
- package/agent/index.js +29 -24
- package/agent/lib/commander.js +25 -16
- package/agent/lib/commands.js +23 -19
- package/package.json +1 -1
package/agent/events.js
CHANGED
|
@@ -33,7 +33,6 @@ const events = {
|
|
|
33
33
|
vm: {
|
|
34
34
|
show: "vm:show",
|
|
35
35
|
},
|
|
36
|
-
narration: "narration",
|
|
37
36
|
status: "status",
|
|
38
37
|
log: {
|
|
39
38
|
markdown: {
|
|
@@ -45,6 +44,7 @@ const events = {
|
|
|
45
44
|
log: "log:log",
|
|
46
45
|
warn: "log:warn",
|
|
47
46
|
debug: "log:debug",
|
|
47
|
+
narration: "log:narration",
|
|
48
48
|
},
|
|
49
49
|
command: {
|
|
50
50
|
start: "command:start",
|
package/agent/index.js
CHANGED
|
@@ -158,7 +158,7 @@ class TestDriverAgent extends EventEmitter2 {
|
|
|
158
158
|
// single function to handle all program exits
|
|
159
159
|
// allows us to save the current state, run lifecycle hooks, and track analytics
|
|
160
160
|
async exit(failed = true, shouldSave = false, shouldRunPostrun = false) {
|
|
161
|
-
this.emitter.emit(events.log.
|
|
161
|
+
this.emitter.emit(events.log.narration, theme.dim("exiting..."), true);
|
|
162
162
|
|
|
163
163
|
// Clean up redraw interval
|
|
164
164
|
if (this.redraw && this.redraw.cleanup) {
|
|
@@ -290,7 +290,7 @@ class TestDriverAgent extends EventEmitter2 {
|
|
|
290
290
|
image = null;
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
-
this.emitter.emit(events.log.
|
|
293
|
+
this.emitter.emit(events.log.narration, theme.dim("thinking..."), true);
|
|
294
294
|
|
|
295
295
|
const streamId = `error-${Date.now()}`;
|
|
296
296
|
this.emitter.emit(events.log.markdown.start, streamId);
|
|
@@ -332,14 +332,14 @@ class TestDriverAgent extends EventEmitter2 {
|
|
|
332
332
|
|
|
333
333
|
if (this.checkCount >= this.checkLimit) {
|
|
334
334
|
this.emitter.emit(
|
|
335
|
-
events.log.
|
|
335
|
+
events.log.narration,
|
|
336
336
|
theme.red("Exploratory loop detected. Exiting."),
|
|
337
337
|
);
|
|
338
338
|
await this.summarize("Check loop detected.");
|
|
339
339
|
return await this.exit(true);
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
-
this.emitter.emit(events.log.
|
|
342
|
+
this.emitter.emit(events.log.narration, theme.dim("checking..."));
|
|
343
343
|
|
|
344
344
|
// check asks the ai if the task is complete
|
|
345
345
|
let thisScreenshot = await this.system.captureScreenBase64(1, false, true);
|
|
@@ -583,8 +583,6 @@ class TestDriverAgent extends EventEmitter2 {
|
|
|
583
583
|
"check thinks more needs to be done",
|
|
584
584
|
);
|
|
585
585
|
|
|
586
|
-
this.emitter.emit(events.log.log, theme.dim("not done yet!"));
|
|
587
|
-
|
|
588
586
|
return await this.aiExecute(response, validateAndLoop);
|
|
589
587
|
} else {
|
|
590
588
|
this.emitter.emit(events.log.debug, "seems complete, returning");
|
|
@@ -719,7 +717,7 @@ class TestDriverAgent extends EventEmitter2 {
|
|
|
719
717
|
}
|
|
720
718
|
}
|
|
721
719
|
|
|
722
|
-
this.emitter.emit(events.log.
|
|
720
|
+
this.emitter.emit(events.log.narration, theme.dim("thinking..."), true);
|
|
723
721
|
|
|
724
722
|
let response = `\`\`\`yaml
|
|
725
723
|
commands:
|
|
@@ -747,7 +745,7 @@ commands:
|
|
|
747
745
|
|
|
748
746
|
this.tasks.push(currentTask);
|
|
749
747
|
|
|
750
|
-
this.emitter.emit(events.log.
|
|
748
|
+
this.emitter.emit(events.log.narration, theme.dim("thinking..."), true);
|
|
751
749
|
|
|
752
750
|
this.lastScreenshot = await this.system.captureScreenBase64();
|
|
753
751
|
|
|
@@ -789,7 +787,7 @@ commands:
|
|
|
789
787
|
async generate(type, count, baseYaml, skipYaml = false) {
|
|
790
788
|
this.emitter.emit(events.log.debug, "generate called, %s", type);
|
|
791
789
|
|
|
792
|
-
this.emitter.emit(events.log.
|
|
790
|
+
this.emitter.emit(events.log.narration, theme.dim("thinking..."), true);
|
|
793
791
|
|
|
794
792
|
if (baseYaml && !skipYaml) {
|
|
795
793
|
await this.runLifecycle("prerun");
|
|
@@ -866,7 +864,7 @@ commands:
|
|
|
866
864
|
|
|
867
865
|
// this is the functinoality for "undo"
|
|
868
866
|
async popFromHistory(fullStep) {
|
|
869
|
-
this.emitter.emit(events.log.
|
|
867
|
+
this.emitter.emit(events.log.narration, theme.dim("undoing..."), true);
|
|
870
868
|
|
|
871
869
|
if (this.executionHistory.length) {
|
|
872
870
|
if (fullStep) {
|
|
@@ -946,12 +944,16 @@ ${yml}
|
|
|
946
944
|
async summarize(error = null) {
|
|
947
945
|
this.analytics.track("summarize");
|
|
948
946
|
|
|
949
|
-
this.emitter.emit(
|
|
947
|
+
this.emitter.emit(
|
|
948
|
+
events.log.narration,
|
|
949
|
+
theme.dim("reviewing test..."),
|
|
950
|
+
true,
|
|
951
|
+
);
|
|
950
952
|
|
|
951
953
|
// let text = prompts.summarize(tasks, error);
|
|
952
954
|
let image = await this.system.captureScreenBase64();
|
|
953
955
|
|
|
954
|
-
this.emitter.emit(events.log.
|
|
956
|
+
this.emitter.emit(events.log.narration, theme.dim("summarizing..."), true);
|
|
955
957
|
|
|
956
958
|
const streamId = `summarize-${Date.now()}`;
|
|
957
959
|
this.emitter.emit(events.log.markdown.start, streamId);
|
|
@@ -1124,7 +1126,7 @@ ${regression}
|
|
|
1124
1126
|
timestamp: fileStartTime,
|
|
1125
1127
|
});
|
|
1126
1128
|
|
|
1127
|
-
this.emitter.emit(events.log.
|
|
1129
|
+
this.emitter.emit(events.log.narration, theme.cyan(`running ${file}...`));
|
|
1128
1130
|
|
|
1129
1131
|
let ymlObj = await this.loadYML(file);
|
|
1130
1132
|
|
|
@@ -1516,8 +1518,8 @@ ${regression}
|
|
|
1516
1518
|
if (this.sandboxId && !this.config.CI && !createNew) {
|
|
1517
1519
|
// Attempt to connect to known instance
|
|
1518
1520
|
this.emitter.emit(
|
|
1519
|
-
events.log.
|
|
1520
|
-
theme.dim(
|
|
1521
|
+
events.log.narration,
|
|
1522
|
+
theme.dim(`connecting to sandbox ${this.sandboxId}...`),
|
|
1521
1523
|
);
|
|
1522
1524
|
|
|
1523
1525
|
try {
|
|
@@ -1539,17 +1541,20 @@ ${regression}
|
|
|
1539
1541
|
}
|
|
1540
1542
|
}
|
|
1541
1543
|
|
|
1542
|
-
this.emitter.emit(
|
|
1544
|
+
this.emitter.emit(
|
|
1545
|
+
events.log.narration,
|
|
1546
|
+
theme.dim(`creating new sandbox...`),
|
|
1547
|
+
);
|
|
1543
1548
|
this.emitter.emit(
|
|
1544
1549
|
events.log.log,
|
|
1545
|
-
theme.dim(`
|
|
1550
|
+
theme.dim(`this can take between 10 - 240 seconds`),
|
|
1546
1551
|
);
|
|
1547
1552
|
// We don't have resiliency/retries baked in, so let's at least give it 1 attempt
|
|
1548
1553
|
// to see if that fixes the issue.
|
|
1549
1554
|
let newSandbox = await this.createNewSandbox().catch(() => {
|
|
1550
1555
|
this.emitter.emit(
|
|
1551
|
-
events.log.
|
|
1552
|
-
theme.dim(`
|
|
1556
|
+
events.log.narration,
|
|
1557
|
+
theme.dim(`double-checking sandbox availability`),
|
|
1553
1558
|
);
|
|
1554
1559
|
|
|
1555
1560
|
return this.createNewSandbox();
|
|
@@ -1576,7 +1581,7 @@ ${regression}
|
|
|
1576
1581
|
if (!debuggerStarted) {
|
|
1577
1582
|
debuggerStarted = true; // Prevent multiple starts, especially when running test in parallel
|
|
1578
1583
|
this.emitter.emit(
|
|
1579
|
-
events.log.
|
|
1584
|
+
events.log.narration,
|
|
1580
1585
|
theme.green(`Starting debugger server...`),
|
|
1581
1586
|
);
|
|
1582
1587
|
debuggerProcess = await createDebuggerProcess(
|
|
@@ -1697,8 +1702,8 @@ ${regression}
|
|
|
1697
1702
|
|
|
1698
1703
|
async connectToSandboxService() {
|
|
1699
1704
|
this.emitter.emit(
|
|
1700
|
-
events.log.
|
|
1701
|
-
theme.
|
|
1705
|
+
events.log.narration,
|
|
1706
|
+
theme.dim(`establishing connection...`),
|
|
1702
1707
|
);
|
|
1703
1708
|
let ableToBoot = await this.sandbox.boot(this.config.TD_API_ROOT);
|
|
1704
1709
|
|
|
@@ -1710,7 +1715,7 @@ Please check your network connection, TD_API_KEY, or the service status.`,
|
|
|
1710
1715
|
);
|
|
1711
1716
|
}
|
|
1712
1717
|
|
|
1713
|
-
this.emitter.emit(events.log.
|
|
1718
|
+
this.emitter.emit(events.log.narration, theme.dim(`authenticating...`));
|
|
1714
1719
|
let ableToAuth = await this.sandbox.auth(this.config.TD_API_KEY);
|
|
1715
1720
|
|
|
1716
1721
|
if (!ableToAuth) {
|
|
@@ -1723,7 +1728,7 @@ Please check your network connection, TD_API_KEY, or the service status.`,
|
|
|
1723
1728
|
}
|
|
1724
1729
|
|
|
1725
1730
|
async connectToSandboxDirect(sandboxId, persist = false) {
|
|
1726
|
-
this.emitter.emit(events.log.
|
|
1731
|
+
this.emitter.emit(events.log.narration, theme.dim(`connecting...`));
|
|
1727
1732
|
let instance = await this.sandbox.connect(sandboxId, persist);
|
|
1728
1733
|
return instance;
|
|
1729
1734
|
}
|
package/agent/lib/commander.js
CHANGED
|
@@ -80,20 +80,20 @@ commands:
|
|
|
80
80
|
// this will actually interpret the command and execute it
|
|
81
81
|
switch (object.command) {
|
|
82
82
|
case "type":
|
|
83
|
-
emitter.emit(events.narration, `typing ${object.text}`);
|
|
83
|
+
emitter.emit(events.log.narration, `typing ${object.text}`);
|
|
84
84
|
emitter.emit(events.log.log, generator.jsonToManual(object));
|
|
85
85
|
response = await commands.type(object.text, object.delay);
|
|
86
86
|
break;
|
|
87
87
|
case "press-keys":
|
|
88
88
|
emitter.emit(
|
|
89
|
-
events.narration,
|
|
89
|
+
events.log.narration,
|
|
90
90
|
`pressing keys ${object.keys.join(",")}`,
|
|
91
91
|
);
|
|
92
92
|
emitter.emit(events.log.log, generator.jsonToManual(object));
|
|
93
93
|
response = await commands["press-keys"](object.keys);
|
|
94
94
|
break;
|
|
95
95
|
case "scroll":
|
|
96
|
-
emitter.emit(events.narration, `scrolling ${object.direction}`);
|
|
96
|
+
emitter.emit(events.log.narration, `scrolling ${object.direction}`);
|
|
97
97
|
emitter.emit(events.log.log, generator.jsonToManual(object));
|
|
98
98
|
response = await commands.scroll(
|
|
99
99
|
object.direction,
|
|
@@ -102,17 +102,20 @@ commands:
|
|
|
102
102
|
);
|
|
103
103
|
break;
|
|
104
104
|
case "wait":
|
|
105
|
-
emitter.emit(
|
|
105
|
+
emitter.emit(
|
|
106
|
+
events.log.narration,
|
|
107
|
+
`waiting ${object.timeout} seconds`,
|
|
108
|
+
);
|
|
106
109
|
emitter.emit(events.log.log, generator.jsonToManual(object));
|
|
107
110
|
response = await commands.wait(object.timeout);
|
|
108
111
|
break;
|
|
109
112
|
case "click":
|
|
110
|
-
emitter.emit(events.narration, `${object.action}`);
|
|
113
|
+
emitter.emit(events.log.narration, `${object.action}`);
|
|
111
114
|
emitter.emit(events.log.log, generator.jsonToManual(object));
|
|
112
115
|
response = await commands["click"](object.x, object.y, object.action);
|
|
113
116
|
break;
|
|
114
117
|
case "hover":
|
|
115
|
-
emitter.emit(events.narration, `moving mouse`);
|
|
118
|
+
emitter.emit(events.log.narration, `moving mouse`);
|
|
116
119
|
emitter.emit(events.log.log, generator.jsonToManual(object));
|
|
117
120
|
response = await commands["hover"](object.x, object.y);
|
|
118
121
|
break;
|
|
@@ -121,7 +124,10 @@ commands:
|
|
|
121
124
|
response = await commands["drag"](object.x, object.y);
|
|
122
125
|
break;
|
|
123
126
|
case "hover-text":
|
|
124
|
-
emitter.emit(
|
|
127
|
+
emitter.emit(
|
|
128
|
+
events.log.narration,
|
|
129
|
+
`searching for ${object.description}`,
|
|
130
|
+
);
|
|
125
131
|
emitter.emit(events.log.log, generator.jsonToManual(object));
|
|
126
132
|
response = await commands["hover-text"](
|
|
127
133
|
object.text,
|
|
@@ -132,7 +138,7 @@ commands:
|
|
|
132
138
|
break;
|
|
133
139
|
case "hover-image":
|
|
134
140
|
emitter.emit(
|
|
135
|
-
events.narration,
|
|
141
|
+
events.log.narration,
|
|
136
142
|
`searching for image of ${object.description}`,
|
|
137
143
|
);
|
|
138
144
|
emitter.emit(events.log.log, generator.jsonToManual(object));
|
|
@@ -144,13 +150,16 @@ commands:
|
|
|
144
150
|
case "match-image":
|
|
145
151
|
emitter.emit(events.log.log, generator.jsonToManual(object));
|
|
146
152
|
emitter.emit(
|
|
147
|
-
events.narration,
|
|
153
|
+
events.log.narration,
|
|
148
154
|
`${object.action} image ${object.path}`,
|
|
149
155
|
);
|
|
150
156
|
response = await commands["match-image"](object.path, object.action);
|
|
151
157
|
break;
|
|
152
158
|
case "wait-for-image":
|
|
153
|
-
emitter.emit(
|
|
159
|
+
emitter.emit(
|
|
160
|
+
events.log.narration,
|
|
161
|
+
`waiting for ${object.description}`,
|
|
162
|
+
);
|
|
154
163
|
emitter.emit(events.log.log, generator.jsonToManual(object));
|
|
155
164
|
response = await commands["wait-for-image"](
|
|
156
165
|
object.description,
|
|
@@ -158,7 +167,7 @@ commands:
|
|
|
158
167
|
);
|
|
159
168
|
break;
|
|
160
169
|
case "wait-for-text":
|
|
161
|
-
emitter.emit(events.narration, `waiting for ${object.text}`);
|
|
170
|
+
emitter.emit(events.log.narration, `waiting for ${object.text}`);
|
|
162
171
|
emitter.emit(events.log.log, generator.jsonToManual(object));
|
|
163
172
|
copy.text = "*****";
|
|
164
173
|
response = await commands["wait-for-text"](
|
|
@@ -168,7 +177,7 @@ commands:
|
|
|
168
177
|
);
|
|
169
178
|
break;
|
|
170
179
|
case "scroll-until-text":
|
|
171
|
-
emitter.emit(events.narration, `scrolling until ${object.text}`);
|
|
180
|
+
emitter.emit(events.log.narration, `scrolling until ${object.text}`);
|
|
172
181
|
emitter.emit(events.log.log, generator.jsonToManual(object));
|
|
173
182
|
copy.text = "*****";
|
|
174
183
|
response = await commands["scroll-until-text"](
|
|
@@ -181,7 +190,7 @@ commands:
|
|
|
181
190
|
break;
|
|
182
191
|
case "scroll-until-image": {
|
|
183
192
|
const needle = object.description || object.path;
|
|
184
|
-
emitter.emit(events.narration, `scrolling until ${needle}`);
|
|
193
|
+
emitter.emit(events.log.narration, `scrolling until ${needle}`);
|
|
185
194
|
emitter.emit(events.log.log, generator.jsonToManual(object));
|
|
186
195
|
response = await commands["scroll-until-image"](
|
|
187
196
|
object.description,
|
|
@@ -193,7 +202,7 @@ commands:
|
|
|
193
202
|
break;
|
|
194
203
|
}
|
|
195
204
|
case "focus-application":
|
|
196
|
-
emitter.emit(events.narration, `focusing ${object.name}`);
|
|
205
|
+
emitter.emit(events.log.narration, `focusing ${object.name}`);
|
|
197
206
|
emitter.emit(events.log.log, generator.jsonToManual(object));
|
|
198
207
|
response = await commands["focus-application"](object.name);
|
|
199
208
|
break;
|
|
@@ -205,12 +214,12 @@ commands:
|
|
|
205
214
|
break;
|
|
206
215
|
}
|
|
207
216
|
case "assert":
|
|
208
|
-
emitter.emit(events.narration, `asserting ${object.expect}`);
|
|
217
|
+
emitter.emit(events.log.narration, `asserting ${object.expect}`);
|
|
209
218
|
emitter.emit(events.log.log, generator.jsonToManual(object));
|
|
210
219
|
response = await commands.assert(object.expect, object.async);
|
|
211
220
|
break;
|
|
212
221
|
case "exec":
|
|
213
|
-
emitter.emit(events.narration, `exec`);
|
|
222
|
+
emitter.emit(events.log.narration, `exec`);
|
|
214
223
|
emitter.emit(
|
|
215
224
|
events.log.log,
|
|
216
225
|
generator.jsonToManual({
|
package/agent/lib/commands.js
CHANGED
|
@@ -190,7 +190,7 @@ const createCommands = (
|
|
|
190
190
|
}
|
|
191
191
|
};
|
|
192
192
|
|
|
193
|
-
emitter.emit(events.log.
|
|
193
|
+
emitter.emit(events.log.narration, `thinking...`);
|
|
194
194
|
|
|
195
195
|
if (async) {
|
|
196
196
|
await sdk
|
|
@@ -276,7 +276,7 @@ const createCommands = (
|
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
emitter.emit(
|
|
279
|
-
|
|
279
|
+
events.log.narration,
|
|
280
280
|
theme.dim(`${action} ${button} clicking at ${x}, ${y}...`),
|
|
281
281
|
true,
|
|
282
282
|
);
|
|
@@ -347,7 +347,7 @@ const createCommands = (
|
|
|
347
347
|
|
|
348
348
|
description = description ? description.toString() : null;
|
|
349
349
|
|
|
350
|
-
emitter.emit(events.log.
|
|
350
|
+
emitter.emit(events.log.narration, theme.dim("thinking..."), true);
|
|
351
351
|
|
|
352
352
|
let response = await sdk.req(
|
|
353
353
|
"hover/text",
|
|
@@ -375,7 +375,7 @@ const createCommands = (
|
|
|
375
375
|
// uses our api to find all images on screen
|
|
376
376
|
"hover-image": async (description, action = "click") => {
|
|
377
377
|
// take a screenshot
|
|
378
|
-
emitter.emit(events.log.
|
|
378
|
+
emitter.emit(events.log.narration, theme.dim("thinking..."), true);
|
|
379
379
|
|
|
380
380
|
let response = await sdk.req(
|
|
381
381
|
"hover/image",
|
|
@@ -446,7 +446,7 @@ const createCommands = (
|
|
|
446
446
|
},
|
|
447
447
|
"wait-for-image": async (description, timeout = 10000) => {
|
|
448
448
|
emitter.emit(
|
|
449
|
-
events.log.
|
|
449
|
+
events.log.narration,
|
|
450
450
|
theme.dim(
|
|
451
451
|
`waiting for an image matching description "${description}"...`,
|
|
452
452
|
),
|
|
@@ -467,7 +467,7 @@ const createCommands = (
|
|
|
467
467
|
durationPassed = new Date().getTime() - startTime;
|
|
468
468
|
if (!passed) {
|
|
469
469
|
emitter.emit(
|
|
470
|
-
events.log.
|
|
470
|
+
events.log.narration,
|
|
471
471
|
theme.dim(
|
|
472
472
|
`${niceSeconds(durationPassed)} seconds have passed without finding an image matching the description "${description}"`,
|
|
473
473
|
),
|
|
@@ -479,7 +479,7 @@ const createCommands = (
|
|
|
479
479
|
|
|
480
480
|
if (passed) {
|
|
481
481
|
emitter.emit(
|
|
482
|
-
events.log.
|
|
482
|
+
events.log.narration,
|
|
483
483
|
theme.dim(
|
|
484
484
|
`An image matching the description "${description}" found!`,
|
|
485
485
|
),
|
|
@@ -496,7 +496,7 @@ const createCommands = (
|
|
|
496
496
|
await redraw.start();
|
|
497
497
|
|
|
498
498
|
emitter.emit(
|
|
499
|
-
events.log.
|
|
499
|
+
events.log.narration,
|
|
500
500
|
theme.dim(`waiting for text: "${text}"...`),
|
|
501
501
|
true,
|
|
502
502
|
);
|
|
@@ -525,7 +525,7 @@ const createCommands = (
|
|
|
525
525
|
durationPassed = new Date().getTime() - startTime;
|
|
526
526
|
if (!passed) {
|
|
527
527
|
emitter.emit(
|
|
528
|
-
events.log.
|
|
528
|
+
events.log.narration,
|
|
529
529
|
theme.dim(
|
|
530
530
|
`${niceSeconds(durationPassed)} seconds have passed without finding "${text}"`,
|
|
531
531
|
),
|
|
@@ -536,7 +536,7 @@ const createCommands = (
|
|
|
536
536
|
}
|
|
537
537
|
|
|
538
538
|
if (passed) {
|
|
539
|
-
emitter.emit(events.log.
|
|
539
|
+
emitter.emit(events.log.narration, theme.dim(`"${text}" found!`), true);
|
|
540
540
|
return;
|
|
541
541
|
} else {
|
|
542
542
|
throw new MatchError(
|
|
@@ -554,7 +554,7 @@ const createCommands = (
|
|
|
554
554
|
await redraw.start();
|
|
555
555
|
|
|
556
556
|
emitter.emit(
|
|
557
|
-
events.log.
|
|
557
|
+
events.log.narration,
|
|
558
558
|
theme.dim(`scrolling for text: "${text}"...`),
|
|
559
559
|
true,
|
|
560
560
|
);
|
|
@@ -598,7 +598,7 @@ const createCommands = (
|
|
|
598
598
|
passed = response.data;
|
|
599
599
|
if (!passed) {
|
|
600
600
|
emitter.emit(
|
|
601
|
-
events.log.
|
|
601
|
+
events.log.narration,
|
|
602
602
|
theme.dim(
|
|
603
603
|
`scrolling ${direction} ${incrementDistance}px. ${scrollDistance + incrementDistance}/${maxDistance}px scrolled...`,
|
|
604
604
|
),
|
|
@@ -610,7 +610,7 @@ const createCommands = (
|
|
|
610
610
|
}
|
|
611
611
|
|
|
612
612
|
if (passed) {
|
|
613
|
-
emitter.emit(events.log.
|
|
613
|
+
emitter.emit(events.log.narration, theme.dim(`"${text}" found!`), true);
|
|
614
614
|
return;
|
|
615
615
|
} else {
|
|
616
616
|
throw new MatchError(
|
|
@@ -638,7 +638,7 @@ const createCommands = (
|
|
|
638
638
|
}
|
|
639
639
|
|
|
640
640
|
emitter.emit(
|
|
641
|
-
events.log.
|
|
641
|
+
events.log.narration,
|
|
642
642
|
theme.dim(`scrolling for an image matching "${needle}"...`),
|
|
643
643
|
true,
|
|
644
644
|
);
|
|
@@ -665,7 +665,7 @@ const createCommands = (
|
|
|
665
665
|
|
|
666
666
|
if (!passed) {
|
|
667
667
|
emitter.emit(
|
|
668
|
-
events.log.
|
|
668
|
+
events.log.narration,
|
|
669
669
|
theme.dim(`scrolling ${direction} ${incrementDistance} pixels...`),
|
|
670
670
|
true,
|
|
671
671
|
);
|
|
@@ -675,7 +675,11 @@ const createCommands = (
|
|
|
675
675
|
}
|
|
676
676
|
|
|
677
677
|
if (passed) {
|
|
678
|
-
emitter.emit(
|
|
678
|
+
emitter.emit(
|
|
679
|
+
events.log.narration,
|
|
680
|
+
theme.dim(`"${needle}" found!`),
|
|
681
|
+
true,
|
|
682
|
+
);
|
|
679
683
|
return;
|
|
680
684
|
} else {
|
|
681
685
|
throw new CommandError(
|
|
@@ -705,7 +709,7 @@ const createCommands = (
|
|
|
705
709
|
return await assert(assertion, true, async);
|
|
706
710
|
},
|
|
707
711
|
exec: async (language, code, timeout, silent = false) => {
|
|
708
|
-
emitter.emit(events.log.
|
|
712
|
+
emitter.emit(events.log.narration, theme.dim(`calling exec...`), true);
|
|
709
713
|
|
|
710
714
|
emitter.emit(events.log.log, code);
|
|
711
715
|
|
|
@@ -738,10 +742,10 @@ const createCommands = (
|
|
|
738
742
|
return result.out?.stdout?.trim();
|
|
739
743
|
}
|
|
740
744
|
} else if (language == "js") {
|
|
741
|
-
emitter.emit(events.log.
|
|
745
|
+
emitter.emit(events.log.narration, theme.dim(`running js...`), true);
|
|
742
746
|
|
|
743
747
|
emitter.emit(
|
|
744
|
-
events.log.
|
|
748
|
+
events.log.narration,
|
|
745
749
|
theme.dim(`running value of \`${plat}\` in local JS vm...`),
|
|
746
750
|
true,
|
|
747
751
|
);
|