testdriverai 4.0.14 → 4.0.16
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 +31 -14
- package/package.json +2 -1
package/index.js
CHANGED
|
@@ -16,6 +16,8 @@ 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');
|
|
20
|
+
const clipboardy = require('clipboardy');
|
|
19
21
|
|
|
20
22
|
// local modules
|
|
21
23
|
const speak = require('./lib/speak');
|
|
@@ -94,15 +96,6 @@ log.log('info', `Join our Discord for help`);
|
|
|
94
96
|
log.log('info', chalk.yellow(`https://discord.com/invite/cWDFW8DzPm`));
|
|
95
97
|
console.log('')
|
|
96
98
|
|
|
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
99
|
// individual run ID for this session
|
|
107
100
|
let runID = new Date().getTime();
|
|
108
101
|
|
|
@@ -135,8 +128,8 @@ const exit = async (failed = true) => {
|
|
|
135
128
|
|
|
136
129
|
// we purposly never resolve this promise so the process will hang
|
|
137
130
|
return new Promise(async () => {
|
|
138
|
-
rl
|
|
139
|
-
rl
|
|
131
|
+
rl?.close()
|
|
132
|
+
rl?.removeAllListeners()
|
|
140
133
|
process.exit(failed ? 1 : 0);
|
|
141
134
|
});
|
|
142
135
|
}
|
|
@@ -756,7 +749,14 @@ ${yaml.dump(step)}
|
|
|
756
749
|
|
|
757
750
|
|
|
758
751
|
const promptUser = () => {
|
|
759
|
-
|
|
752
|
+
// Case where it doesn't execute the command but pastes the clipboard content
|
|
753
|
+
if (rl.on) {
|
|
754
|
+
rl.on('paste', () => {
|
|
755
|
+
const clipboardContent = clipboardy.readSync();
|
|
756
|
+
rl.write(clipboardContent);
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
rl.prompt(true);
|
|
760
760
|
}
|
|
761
761
|
|
|
762
762
|
const iffy = async (condition, then, otherwise, depth) => {
|
|
@@ -827,6 +827,25 @@ const embed = async (file, depth) => {
|
|
|
827
827
|
|
|
828
828
|
// await sdk.auth();
|
|
829
829
|
|
|
830
|
+
|
|
831
|
+
// if os is mac, check for screen capture permissions
|
|
832
|
+
if (process.platform === 'darwin' && !macScreenPerms.hasScreenCapturePermission()) {
|
|
833
|
+
log.log('info', chalk.red('Screen capture permissions not enabled.'))
|
|
834
|
+
log.log('info', 'You must enable screen capture permissions for the application calling `testdriverai`.')
|
|
835
|
+
log.log('info', 'Read More: https://docs.testdriver.ai/faq/screen-recording-permissions-mac-only')
|
|
836
|
+
analytics.track('noMacPermissions');
|
|
837
|
+
return exit();
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
if (thisCommand !== 'run') {
|
|
841
|
+
speak('Howdy! I am TestDriver version ' + package.version);
|
|
842
|
+
|
|
843
|
+
console.log(chalk.red('Warning!') + chalk.dim(' TestDriver sends screenshots of the desktop to our API.'));
|
|
844
|
+
console.log(chalk.dim('https://docs.testdriver.ai/security-and-privacy/agent'));
|
|
845
|
+
console.log('')
|
|
846
|
+
|
|
847
|
+
}
|
|
848
|
+
|
|
830
849
|
let win = await system.activeWin();
|
|
831
850
|
terminalApp = win?.owner?.name || "";
|
|
832
851
|
|
|
@@ -856,7 +875,6 @@ process.on('uncaughtException', async (err) => {
|
|
|
856
875
|
analytics.track('uncaughtException', {err});
|
|
857
876
|
console.error('Uncaught Exception:', err);
|
|
858
877
|
// You might want to exit the process after handling the error
|
|
859
|
-
await summarize(err);
|
|
860
878
|
await exit(true);
|
|
861
879
|
});
|
|
862
880
|
|
|
@@ -864,6 +882,5 @@ process.on('unhandledRejection', async (reason, promise) => {
|
|
|
864
882
|
analytics.track('unhandledRejection', {reason, promise});
|
|
865
883
|
console.error('Unhandled Rejection at:', promise, 'reason:', reason);
|
|
866
884
|
// Optionally, you might want to exit the process
|
|
867
|
-
await summarize(reason)
|
|
868
885
|
await exit(true);
|
|
869
886
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "testdriverai",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.16",
|
|
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",
|