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 +6 -4
- package/lib/focus-application.js +6 -3
- package/package.json +1 -1
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.
|
|
182
|
+
await robot.keyTap("pageup");
|
|
180
183
|
await redraw.wait(2000);
|
|
181
184
|
break;
|
|
182
185
|
case 'down':
|
|
183
|
-
await robot.
|
|
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',
|
|
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);
|
package/lib/focus-application.js
CHANGED
|
@@ -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 "
|
|
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 "
|
|
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 {
|