testdriverai 4.0.20 → 4.0.22

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/lib/commands.js CHANGED
@@ -27,6 +27,9 @@ class AiError extends Error {
27
27
  this.attachScreenshot = attatchScreenshot;
28
28
  }
29
29
  }
30
+
31
+ const commandOrControl = process.platform === 'darwin' ? 'command' : 'control';
32
+
30
33
  const findImageOnScreen = async (relativePath, haystack, restrictToWindow) => {
31
34
  let displayMultiple = await getDisplayMultiple();
32
35
 
@@ -176,11 +179,11 @@ const scroll = async(direction = 'down', amount = 300) => {
176
179
 
177
180
  switch (direction) {
178
181
  case 'up':
179
- await robot.scrollMouse(0, amount);
182
+ await robot.keyTap("pageup");
180
183
  await redraw.wait(2000);
181
184
  break;
182
185
  case 'down':
183
- await robot.scrollMouse(0, amount * -1);
186
+ await robot.keyTap("pagedown");
184
187
  await redraw.wait(2000);
185
188
  break;
186
189
  case 'left':
@@ -445,8 +448,7 @@ let commands = {
445
448
 
446
449
  try {
447
450
  // use robot to press CMD+F
448
- await robot.keyTap('f', 'command');
449
- await robot.keyTap('command');
451
+ await robot.keyTap('f', commandOrControl);
450
452
  // type the text
451
453
  await robot.typeString(text);
452
454
  await redraw.wait(2000);
@@ -6,11 +6,14 @@ const scriptPath = path.join(__dirname, "focusWindow.ps1");
6
6
 
7
7
  // apple script that focuses on a window
8
8
  const appleScriptShow = (windowName) => `
9
- tell application "${windowName}" to set miniaturized of every window to false
10
- `;
9
+ tell application "System Events" to tell process "${windowName}"
10
+ set frontmost to true
11
+ end tell`;
11
12
 
12
13
  const appleScriptHide = (windowName) => `
13
- tell application "${windowName}" to set miniaturized of every window to true`;
14
+ tell application "System Events" to tell process "${windowName}"
15
+ set frontmost to false
16
+ end tell`;
14
17
 
15
18
  async function focusApplication(appName) {
16
19
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testdriverai",
3
- "version": "4.0.20",
3
+ "version": "4.0.22",
4
4
  "description": "Next generation autonomous AI agent for end-to-end testing of web & desktop",
5
5
  "main": "index.js",
6
6
  "bin": {