testdriverai 4.0.40 → 4.0.42

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
@@ -61,6 +61,16 @@ let getArgs = () => {
61
61
  let command = 0;
62
62
  let file = 1;
63
63
 
64
+
65
+ // TODO use a arg parser library to simplify this
66
+ if (args[command] == "--help" || args[command] == '-h'
67
+ || args[file] == "--help" || args[file] == '-h') {
68
+ console.log(
69
+ "Command: testdriverai [init, run, edit] [yaml filepath]"
70
+ );
71
+ process.exit(0);
72
+ }
73
+
64
74
  if (args[command] == 'init') {
65
75
  } else if (args[command] !== 'run' && !args[file]) {
66
76
  args[file] = args[command];
package/lib/config.js CHANGED
@@ -1,3 +1,10 @@
1
+ /**
2
+ * This file contains application config.
3
+ * It is responsible for loading the config from env,
4
+ * supplying defaults, and formatting values
5
+ */
6
+
7
+ // Load the env vars from .env
1
8
  require('dotenv').config()
2
9
 
3
10
  // Parse out true and false string values
@@ -18,7 +25,9 @@ const config = {
18
25
  TD_SPEAK: false,
19
26
  TD_ANALYTICS: false,
20
27
  TD_NOTIFY: false,
21
- };
28
+ TD_API_ROOT: "https://replayable-api-production.herokuapp.com",
29
+ TD_DEV: parseValue(process.env['DEV']),
30
+ }
22
31
 
23
32
  // Find all env vars starting with TD_
24
33
  for (let key in process.env) {
@@ -27,4 +36,8 @@ for (let key in process.env) {
27
36
  }
28
37
  }
29
38
 
39
+ if (config.TD_DEV) {
40
+ console.info("Testdriverai config: ", config);
41
+ }
42
+
30
43
  module.exports = config;
@@ -10,12 +10,9 @@ tell application "System Events" to tell process "${windowName}"
10
10
  set frontmost to true
11
11
  end tell`;
12
12
 
13
- const appleScriptMinMax = (windowName, booleanString) => `
14
- tell application "${windowName}"
15
- set windowList to every window
16
- repeat with aWindow in windowList
17
- set miniaturized of aWindow to ${booleanString}
18
- end repeat
13
+ const appleScriptMinMax = (windowName, state) => `
14
+ tell application "System Events"
15
+ set value of attribute "AXMinimized" of every window of application process "${windowName}" to ${state}
19
16
  end tell
20
17
  `;
21
18
 
@@ -42,10 +39,10 @@ async function focusApplication(appName) {
42
39
  }
43
40
 
44
41
  async function hideTerminal(appName) {
45
-
42
+
46
43
  try {
47
44
  if (platform() == "mac") {
48
- return await execSync(`osascript -e '${appleScriptMinMax(appName, 'true')}'`);
45
+ return await execSync(`osascript -e '${appleScriptMinMax(appName, true)}'`);
49
46
  } else if (platform() == "linux") {
50
47
  } else if (platform() == "windows") {
51
48
  return runPwsh(appName, "Minimize");
@@ -60,7 +57,7 @@ async function showTerminal(appName) {
60
57
  try {
61
58
 
62
59
  if (platform() == "mac") {
63
- return await execSync(`osascript -e '${appleScriptMinMax(appName, 'false')}'`);
60
+ return await execSync(`osascript -e '${appleScriptMinMax(appName, false)}'`);
64
61
  } else if (platform() == "linux") {
65
62
  } else if (platform() == "windows") {
66
63
  return runPwsh(appName, "Restore");
package/lib/sdk.js CHANGED
@@ -1,17 +1,12 @@
1
-
2
- // custom "sdk" for calling our API
3
- let root = "https://replayable-api-production.herokuapp.com";
4
-
5
- if (process.env['DEV']) {
6
- root = "https://replayable-dev-ian-mac-m1-16.ngrok.io";
7
- }
8
-
1
+ const config = require('./config');
9
2
  const chalk = require('chalk');
10
3
  const axios = require('axios');
11
4
  const session = require('./session')
12
5
  const package = require('../package.json');
13
6
  const version = package.version;
14
7
 
8
+ const root = config["TD_API_ROOT"];
9
+
15
10
  let token = null;
16
11
 
17
12
  let outputError = (e) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testdriverai",
3
- "version": "4.0.40",
3
+ "version": "4.0.42",
4
4
  "description": "Next generation autonomous AI agent for end-to-end testing of web & desktop",
5
5
  "main": "index.js",
6
6
  "bin": {