testdriverai 4.0.20 → 4.0.21
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 +4 -2
- 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
|
|
|
@@ -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 {
|