testdriverai 4.0.23 → 4.0.25

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/index.js CHANGED
@@ -124,6 +124,8 @@ if (!commandHistory.length) {
124
124
 
125
125
  const exit = async (failed = true) => {
126
126
 
127
+ await save();
128
+
127
129
  analytics.track('exit', {failed});
128
130
 
129
131
  // we purposly never resolve this promise so the process will hang
@@ -487,9 +489,8 @@ const firstPrompt = async (text) => {
487
489
  // this is how we parse user input
488
490
  // notice that the AI is only called if the input is not a command
489
491
  rl.on('line', async (input) => {
490
-
491
- let win = await system.activeWin();
492
- terminalApp = win?.owner?.name || "";
492
+
493
+ await setTerminalApp();
493
494
 
494
495
  setTerminalWindowTransparency(true)
495
496
  errorCounts = {};
@@ -743,6 +744,17 @@ const promptUser = () => {
743
744
  rl.prompt(true);
744
745
  }
745
746
 
747
+ const setTerminalApp = async () => {
748
+
749
+ let win = await system.activeWin();
750
+ if (process.platform === 'win32') {
751
+ terminalApp = win?.title || "";
752
+ } else {
753
+ terminalApp = win?.owner?.name || "";
754
+ }
755
+
756
+ }
757
+
746
758
  const iffy = async (condition, then, otherwise, depth) => {
747
759
 
748
760
  analytics.track('if', {condition});
@@ -830,8 +842,7 @@ const embed = async (file, depth) => {
830
842
 
831
843
  }
832
844
 
833
- let win = await system.activeWin();
834
- terminalApp = win?.owner?.name || "";
845
+ await setTerminalApp();
835
846
 
836
847
  // should be start of new session
837
848
  sessionRes = await sdk.req('session/start', {
package/lib/commands.js CHANGED
@@ -327,6 +327,12 @@ let commands = {
327
327
 
328
328
  // remove any modifier keys from the inputKeys array and put them in a new array
329
329
  inputKeys.forEach(key => {
330
+
331
+ // change command to control on windows
332
+ if (key === 'command' && process.platform === 'win32') {
333
+ key = 'control';
334
+ }
335
+
330
336
  if (modifierKeys.includes(key)) {
331
337
  modifierKeysPressed.push(key);
332
338
  } else {
@@ -21,7 +21,7 @@ end tell
21
21
 
22
22
  const runPwsh = (appName, method) => {
23
23
  let script = `powershell -ExecutionPolicy Bypass -Command "& { ${scriptPath} '${appName}' '${method}' }"`;
24
- return execSync(script);
24
+ return execSync(script, { stdio: "inherit", shell: "powershell" });
25
25
  }
26
26
 
27
27
  async function focusApplication(appName) {
@@ -42,7 +42,7 @@ async function focusApplication(appName) {
42
42
  }
43
43
 
44
44
  async function hideTerminal(appName) {
45
-
45
+
46
46
  try {
47
47
  if (platform() == "mac") {
48
48
  return await execSync(`osascript -e '${appleScriptMinMax(appName, 'true')}'`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testdriverai",
3
- "version": "4.0.23",
3
+ "version": "4.0.25",
4
4
  "description": "Next generation autonomous AI agent for end-to-end testing of web & desktop",
5
5
  "main": "index.js",
6
6
  "bin": {