testdriverai 4.2.0-test.1 → 4.2.0-test.2

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.
@@ -0,0 +1,11 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "npm" # See documentation for possible values
9
+ directory: "/" # Location of package manifests
10
+ schedule:
11
+ interval: "weekly"
@@ -3,7 +3,7 @@ name: Example Todo App
3
3
 
4
4
  on:
5
5
  push:
6
- branches: ["main", "alexrowe/test-interp"]
6
+ branches: ["main"]
7
7
  pull_request:
8
8
  workflow_dispatch:
9
9
 
package/agent.js CHANGED
@@ -898,10 +898,10 @@ let run = async (file, shouldSave = false, shouldExit = true) => {
898
898
  await exit(true);
899
899
  }
900
900
 
901
- console.log(yml)
902
- console.log(process.env)
901
+ let interpolationVars = JSON.parse(process.env["TD_INTERPOLATION_VARS"] || '{}');
902
+
903
903
  // Inject environment variables into any ${VAR} strings
904
- yml = parser.interpolate(yml, process.env);
904
+ yml = parser.interpolate(yml, interpolationVars);
905
905
 
906
906
  console.log(yml)
907
907
  let ymlObj = null;
@@ -246,7 +246,7 @@
246
246
  screenshotElement.classList.add('screenshot');
247
247
  setTimeout(() => {
248
248
  container.style.opacity = 1
249
- }, 300)
249
+ }, 2000)
250
250
  });
251
251
 
252
252
  ipcRenderer.on(events.mouseClick,
@@ -305,4 +305,4 @@
305
305
  </script>
306
306
  </body>
307
307
 
308
- </html>
308
+ </html>
package/lib/system.js CHANGED
@@ -2,12 +2,11 @@
2
2
  const fs = require("fs");
3
3
  const os = require("os");
4
4
  const path = require("path");
5
- const screenshot = require("screenshot-desktop");
6
5
  const si = require("systeminformation");
7
- const activeWindow = require("active-win");
8
6
  const robot = require("robotjs");
9
7
  const sharp = require("sharp");
10
8
  const { emitter, events } = require("./events.js");
9
+ const { Monitor } = require("node-screenshots");
11
10
 
12
11
  let primaryDisplay = null;
13
12
 
@@ -48,7 +47,11 @@ const captureAndResize = async (scale = 1, silent = false, mouse = false) => {
48
47
  let step1 = tmpFilename();
49
48
  let step2 = tmpFilename();
50
49
 
51
- await screenshot({ filename: step1, format: "png" });
50
+ const monitors = Monitor.all();
51
+ const primaryMonitor = monitors.find(monitor => monitor.isPrimary);
52
+ const image = await primaryMonitor.captureImage(); // Capture the image asynchronously
53
+ const buffer = await image.toPng(); // Convert the image to PNG format
54
+ fs.writeFileSync(step1, buffer); // Save the image to a file
52
55
 
53
56
  // Fetch the mouse position
54
57
  const mousePos = robot.getMousePos();
@@ -111,9 +114,25 @@ const platform = () => {
111
114
  return platform;
112
115
  };
113
116
 
117
+ // Import get-windows using dynamic import for ES module compatibility
118
+ let activeWindowFn = null;
119
+ const initializeActiveWindow = async () => {
120
+ if (!activeWindowFn) {
121
+ const { activeWindow } = await import('get-windows');
122
+ activeWindowFn = activeWindow;
123
+ }
124
+ return activeWindowFn;
125
+ };
126
+
114
127
  // this is the focused window
115
128
  const activeWin = async () => {
116
- return await activeWindow();
129
+ try {
130
+ const activeWindow = await initializeActiveWindow();
131
+ return await activeWindow();
132
+ } catch (error) {
133
+ console.error('Error getting active window:', error);
134
+ return null;
135
+ }
117
136
  };
118
137
 
119
138
  const getMousePosition = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testdriverai",
3
- "version": "4.2.0-test.1",
3
+ "version": "4.2.0-test.2",
4
4
  "description": "Next generation autonomous AI agent for end-to-end testing of web & desktop",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -17,7 +17,6 @@
17
17
  "license": "ISC",
18
18
  "dependencies": {
19
19
  "@electerm/strip-ansi": "^1.0.0",
20
- "active-win": "^8.2.1",
21
20
  "axios": "^1.7.7",
22
21
  "chalk": "^4.1.2",
23
22
  "cli-progress": "^3.12.0",
@@ -25,6 +24,7 @@
25
24
  "decompress": "^4.2.1",
26
25
  "dotenv": "^16.4.5",
27
26
  "electron": "^33.0.2",
27
+ "get-windows": "^9.2.0",
28
28
  "jimp": "^0.22.12",
29
29
  "js-yaml": "^4.1.0",
30
30
  "mac-screen-capture-permissions": "^2.1.0",
@@ -34,14 +34,13 @@
34
34
  "marky": "^1.2.5",
35
35
  "node-ipc": "^12.0.0",
36
36
  "node-notifier": "^10.0.1",
37
+ "node-screenshots": "0.2.1",
37
38
  "odiff-bin": "^3.1.2",
38
39
  "prompts": "^2.4.2",
39
40
  "remark-parse": "^11.0.0",
40
- "rimraf": "^5.0.5",
41
41
  "robotjs": "^0.6.0",
42
42
  "sanitize-filename": "^1.6.3",
43
43
  "say": "^0.16.0",
44
- "screenshot-desktop": "^1.15.0",
45
44
  "semver": "^7.6.2",
46
45
  "sharp": "^0.33.5",
47
46
  "systeminformation": "^5.23.5",
@@ -49,16 +48,19 @@
49
48
  "uuid": "^10.0.0",
50
49
  "winston": "^3.13.0"
51
50
  },
51
+ "overrides": {
52
+ "glob": "^11.0.1",
53
+ "rimraf": "^5.0.10"
54
+ },
52
55
  "devDependencies": {
53
56
  "@eslint/js": "^9.10.0",
57
+ "chai": "^5.1.2",
54
58
  "esbuild": "0.20.2",
55
59
  "esbuild-plugin-fileloc": "^0.0.6",
56
60
  "eslint": "^9.10.0",
57
61
  "globals": "^15.9.0",
58
- "node-addon-api": "^8.0.0",
59
- "node-gyp": "^10.1.0",
60
62
  "mocha": "^10.8.2",
61
- "chai": "^5.1.2",
63
+ "node-addon-api": "^8.0.0",
62
64
  "prettier": "3.3.3"
63
65
  },
64
66
  "optionalDependencies": {