testdriverai 4.0.42 → 4.0.43
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/focus-application.js +9 -4
- package/package.json +1 -1
package/lib/focus-application.js
CHANGED
|
@@ -10,12 +10,16 @@ tell application "System Events" to tell process "${windowName}"
|
|
|
10
10
|
set frontmost to true
|
|
11
11
|
end tell`;
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
const appleScriptMin = (windowName) => `
|
|
14
15
|
tell application "System Events"
|
|
15
|
-
set value of attribute "AXMinimized" of every window of application process "${windowName}" to ${state}
|
|
16
16
|
end tell
|
|
17
17
|
`;
|
|
18
18
|
|
|
19
|
+
const appleScriptMax = (windowName) => `
|
|
20
|
+
tell application "${windowName}" to activate
|
|
21
|
+
`;
|
|
22
|
+
|
|
19
23
|
const runPwsh = (appName, method) => {
|
|
20
24
|
let script = `powershell -ExecutionPolicy Bypass -Command "& { ${scriptPath} '${appName}' '${method}' }"`;
|
|
21
25
|
return execSync(script, { shell: "powershell" });
|
|
@@ -42,7 +46,8 @@ async function hideTerminal(appName) {
|
|
|
42
46
|
|
|
43
47
|
try {
|
|
44
48
|
if (platform() == "mac") {
|
|
45
|
-
return await execSync(`osascript -e '${
|
|
49
|
+
return await execSync(`osascript -e '${appleScriptMin(appName)}'`);
|
|
50
|
+
|
|
46
51
|
} else if (platform() == "linux") {
|
|
47
52
|
} else if (platform() == "windows") {
|
|
48
53
|
return runPwsh(appName, "Minimize");
|
|
@@ -57,7 +62,7 @@ async function showTerminal(appName) {
|
|
|
57
62
|
try {
|
|
58
63
|
|
|
59
64
|
if (platform() == "mac") {
|
|
60
|
-
return await execSync(`osascript -e '${
|
|
65
|
+
return await execSync(`osascript -e '${appleScriptMax(appName)}'`);
|
|
61
66
|
} else if (platform() == "linux") {
|
|
62
67
|
} else if (platform() == "windows") {
|
|
63
68
|
return runPwsh(appName, "Restore");
|