testdriverai 5.5.8 → 5.6.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.
@@ -17,6 +17,7 @@
17
17
  font-style: normal;
18
18
  font-size: 14px;
19
19
  scrollbar-width: none; /* Hide scrollbars for Firefox */
20
+ pointer-events: none;
20
21
  }
21
22
 
22
23
  *::-webkit-scrollbar {
@@ -77,10 +78,6 @@
77
78
  position: relative;
78
79
  }
79
80
 
80
- #main {
81
- pointer-events: none;
82
- }
83
-
84
81
  .screenshot {
85
82
  position: absolute;
86
83
  inset: 0;
@@ -94,7 +91,6 @@
94
91
  animation-timing-function: ease;
95
92
  animation-fill-mode: forwards;
96
93
  background-color: white;
97
- pointer-events: none;
98
94
  }
99
95
 
100
96
  .box {
@@ -192,7 +188,6 @@
192
188
  }
193
189
 
194
190
  #terminal-wrapper {
195
- pointer-events: none;
196
191
  position: absolute;
197
192
  right: calc(100vw - 600px);
198
193
  top: 0px;
@@ -212,7 +207,6 @@
212
207
  }
213
208
 
214
209
  #boxes {
215
- pointer-events: none;
216
210
  position: absolute;
217
211
  top: 0;
218
212
  left: 0;
@@ -223,11 +217,13 @@
223
217
 
224
218
  #vm-iframe {
225
219
  position: absolute;
220
+ display: none;
226
221
  top: 0;
227
222
  left: 0;
228
223
  width: 100%;
229
224
  height: 100%;
230
225
  border: none;
226
+ pointer-events: auto;
231
227
  }
232
228
  </style>
233
229
  <link rel="stylesheet" href="terminal/xterm.css" />
@@ -356,6 +352,7 @@
356
352
 
357
353
  ipcRenderer.on(events.vm.show, (event, data) => {
358
354
  const iframe = document.querySelector("#vm-iframe");
355
+ iframe.style.display = "block";
359
356
  iframe.src = data.url;
360
357
  });
361
358
 
package/lib/commands.js CHANGED
@@ -434,6 +434,7 @@ let commands = {
434
434
  // press keys
435
435
  // different than `type`, becasue it can press multiple keys at once
436
436
  "press-keys": async (inputKeys) => {
437
+
437
438
  await redraw.start();
438
439
 
439
440
  // robotjs is finiky with key-up on modifier keys
@@ -458,14 +459,6 @@ let commands = {
458
459
  }
459
460
  });
460
461
 
461
- // make sure all keys are valid
462
- keysPressed.forEach((key) => {
463
- if (keymap[key] === undefined) {
464
- logger.error(`Key not found: ${key}`);
465
- throw new AiError(`Key not found: ${key}`);
466
- }
467
- });
468
-
469
462
  // only one key can be pressed at a time
470
463
  if (!config.TD_VM && keysPressed.length > 1) {
471
464
  throw new AiError(
@@ -477,14 +470,18 @@ let commands = {
477
470
  let modsToPress = [];
478
471
 
479
472
  if (!config.TD_VM) {
480
- modifierKeysPressed.map((key) => {
481
- if (keymap[key] === undefined) {
482
- logger.error(`Modifier key not found: ${key}`);
483
- throw new AiError(`Modifier key not found: ${key}`);
473
+ modsToPress = modifierKeysPressed.map((key) => {
474
+ if (modifierKeys[key] === undefined) {
475
+ return key;
484
476
  } else {
485
477
  return keymap[key];
486
478
  }
487
479
  });
480
+
481
+ modsToPress.forEach((key) => {
482
+ robot.keyToggle(key, "down");
483
+ });
484
+
488
485
  robot.keyTap(keysPressed[0], modsToPress);
489
486
  } else {
490
487
  await sandbox.send({ type: "press", keys: keysPressed });
@@ -38,13 +38,7 @@ end tell`;
38
38
  // set value of attribute "AXMinimized" of every window of application process "${windowName}" to true
39
39
  // end tell`;
40
40
 
41
- const appleScriptActivate = (windowName) => `
42
- tell application id "${windowName}"
43
- set miniaturized of every window to false
44
- reopen
45
- activate
46
- end tell
47
- `;
41
+ const appleScriptActivate = (windowName) => `tell application "${windowName}" to activate`;
48
42
 
49
43
  const runPwsh = (appName, method) => {
50
44
  let script = `powershell -ExecutionPolicy Bypass -Command "& { ${scriptPath} '${appName}' '${method}' }"`;
@@ -63,7 +57,7 @@ async function focusApplication(appName) {
63
57
 
64
58
  try {
65
59
  if (platform() == "mac") {
66
- return await execSync(`osascript -e '${appleScriptSetFrontmost(appName)}'`);
60
+ return await execSync(`osascript -e '${appleScriptActivate(appName)}'`);
67
61
  } else if (platform() == "linux") {
68
62
  // TODO: This needs fixing
69
63
  return;
package/lib/parser.js CHANGED
@@ -24,19 +24,17 @@ function formatAjvError(error) {
24
24
 
25
25
  // use markdown parser to find code blocks within AI response
26
26
  const findCodeBlocks = async function (markdownContent) {
27
- return new Promise((resolve, reject) => {
28
- parser.parse(markdownContent, (err, result) => {
29
- if (err) {
30
- return reject(err);
31
- }
32
27
 
33
- let codes = result.codes.filter((code) => {
34
- return code.code.indexOf("yml") > -1 || code.code.indexOf("yaml") > -1;
35
- });
28
+ console.log(markdownContent)
36
29
 
37
- return resolve(codes);
38
- });
39
- });
30
+ let md = markdownContent.match(/```yaml\n([\s\S]*?)```/);
31
+ console.log('returning')
32
+
33
+ if (md) {
34
+ return [{code: md[1]}];
35
+ } else {
36
+ return []
37
+ }
40
38
  };
41
39
 
42
40
  // use markdown parser to find code blocks within AI response
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testdriverai",
3
- "version": "5.5.8",
3
+ "version": "5.6.0",
4
4
  "description": "Next generation autonomous AI agent for end-to-end testing of web & desktop",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -1,19 +0,0 @@
1
- version: 5.1.1
2
- session: 67f00511acbd9ccac373edf7
3
- steps:
4
- - prompt: launch chrome
5
- commands:
6
- - command: exec
7
- lang: shell
8
- linux: |
9
- jumpapp google-chrome --disable-fre --no-default-browser-check --no-first-run "${TD_WEBSITE}" &
10
- exit
11
- mac: |
12
- open -na "Google Chrome" --args --disable-fre --no-default-browser-check --no-first-run --disable-features=PasswordManagerEnabled "${TD_WEBSITE}" &
13
- exit
14
- windows:
15
- Start-Process "C:/Program Files/Google/Chrome/Application/chrome.exe" -ArgumentList "--start-maximized", "${TD_WEBSITE}"
16
- exit
17
- - command: wait-for-text
18
- text: "Google Chrome"
19
- timeout: 30000