testdriverai 4.0.14 → 4.0.15

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.
Files changed (2) hide show
  1. package/index.js +22 -13
  2. package/package.json +2 -1
package/index.js CHANGED
@@ -16,6 +16,7 @@ const http = require('http');
16
16
  const path = require('path');
17
17
  const chalk = require('chalk')
18
18
  const yaml = require('js-yaml');
19
+ const macScreenPerms = require('mac-screen-capture-permissions');
19
20
 
20
21
  // local modules
21
22
  const speak = require('./lib/speak');
@@ -94,15 +95,6 @@ log.log('info', `Join our Discord for help`);
94
95
  log.log('info', chalk.yellow(`https://discord.com/invite/cWDFW8DzPm`));
95
96
  console.log('')
96
97
 
97
- if (a.command !== 'run') {
98
- speak('Howdy! I am TestDriver version ' + package.version);
99
-
100
- console.log(chalk.red('Warning!') + chalk.dim(' TestDriver sends screenshots of the desktop to our API.'));
101
- console.log(chalk.dim('https://docs.testdriver.ai/security-and-privacy/agent'));
102
- console.log('')
103
-
104
- }
105
-
106
98
  // individual run ID for this session
107
99
  let runID = new Date().getTime();
108
100
 
@@ -135,8 +127,8 @@ const exit = async (failed = true) => {
135
127
 
136
128
  // we purposly never resolve this promise so the process will hang
137
129
  return new Promise(async () => {
138
- rl.close()
139
- rl.removeAllListeners()
130
+ rl?.close()
131
+ rl?.removeAllListeners()
140
132
  process.exit(failed ? 1 : 0);
141
133
  });
142
134
  }
@@ -827,6 +819,25 @@ const embed = async (file, depth) => {
827
819
 
828
820
  // await sdk.auth();
829
821
 
822
+
823
+ // if os is mac, check for screen capture permissions
824
+ if (process.platform === 'darwin' && !macScreenPerms.hasScreenCapturePermission()) {
825
+ log.log('info', chalk.red('Screen capture permissions not enabled.'))
826
+ log.log('info', 'You must enable screen capture permissions for the application calling `testdriverai`.')
827
+ log.log('info', 'Read More: https://docs.testdriver.ai/faq/screen-recording-permissions-mac-only')
828
+ analytics.track('noMacPermissions');
829
+ return exit();
830
+ }
831
+
832
+ if (thisCommand !== 'run') {
833
+ speak('Howdy! I am TestDriver version ' + package.version);
834
+
835
+ console.log(chalk.red('Warning!') + chalk.dim(' TestDriver sends screenshots of the desktop to our API.'));
836
+ console.log(chalk.dim('https://docs.testdriver.ai/security-and-privacy/agent'));
837
+ console.log('')
838
+
839
+ }
840
+
830
841
  let win = await system.activeWin();
831
842
  terminalApp = win?.owner?.name || "";
832
843
 
@@ -856,7 +867,6 @@ process.on('uncaughtException', async (err) => {
856
867
  analytics.track('uncaughtException', {err});
857
868
  console.error('Uncaught Exception:', err);
858
869
  // You might want to exit the process after handling the error
859
- await summarize(err);
860
870
  await exit(true);
861
871
  });
862
872
 
@@ -864,6 +874,5 @@ process.on('unhandledRejection', async (reason, promise) => {
864
874
  analytics.track('unhandledRejection', {reason, promise});
865
875
  console.error('Unhandled Rejection at:', promise, 'reason:', reason);
866
876
  // Optionally, you might want to exit the process
867
- await summarize(reason)
868
877
  await exit(true);
869
878
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testdriverai",
3
- "version": "4.0.14",
3
+ "version": "4.0.15",
4
4
  "description": "Next generation autonomous AI agent for end-to-end testing of web & desktop",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -26,6 +26,7 @@
26
26
  "dotenv": "^16.4.5",
27
27
  "jimp": "^0.22.12",
28
28
  "js-yaml": "^4.1.0",
29
+ "mac-screen-capture-permissions": "^2.1.0",
29
30
  "markdown-parser": "0.0.8",
30
31
  "marked": "^12.0.1",
31
32
  "marked-terminal": "^7.0.0",