testdriverai 4.0.27 → 4.0.29

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/lib/commands.js CHANGED
@@ -33,20 +33,19 @@ const commandOrControl = process.platform === 'darwin' ? 'command' : 'control';
33
33
  const findImageOnScreen = async (relativePath, haystack, restrictToWindow) => {
34
34
  let displayMultiple = await getDisplayMultiple();
35
35
 
36
- // move the file from filePath to `.testdriver/screenshots`
37
- let rootpath = path.join(cwd(), `.testdriver`, `screenshots`, platform());
36
+ // move the file from filePath to `testdriver/screenshots`
37
+ let rootpath = path.join(cwd(), `testdriver`, `screenshots`, platform());
38
38
  // add .png to relative path if not already there
39
39
  if (!relativePath.endsWith('.png')) {
40
40
  relativePath = relativePath + '.png';
41
41
  }
42
42
 
43
43
  // check if the file exists
44
- if (await !fs.existsSync(path.join(rootpath, relativePath))) {
44
+ if (await !fs.access(path.join(rootpath, relativePath))) {
45
45
  throw new AiError(`Image not found: ${relativePath}`)
46
46
  }
47
47
 
48
48
  let needle = path.join(rootpath, relativePath);
49
- let foundWriteLocation = path.join(cwd(), '.testdriver', '.matches', `${new Date().getTime()}-${relativePath}`);
50
49
 
51
50
  const bar1 = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);
52
51
 
@@ -114,15 +113,6 @@ const findImageOnScreen = async (relativePath, haystack, restrictToWindow) => {
114
113
 
115
114
  bar1.stop();
116
115
 
117
- if (foundWriteLocation) {
118
- // Crop the haystack at the coordinates found in result
119
- const imageHaystack = await Jimp.read(haystack);
120
- const croppedImage = imageHaystack.crop(result.x, result.y, result.width, result.height);
121
-
122
- await croppedImage.writeAsync(foundWriteLocation);
123
-
124
- result.foundWriteLocation = foundWriteLocation;
125
- }
126
116
  return result;
127
117
 
128
118
  }
@@ -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, { stdio: "inherit", shell: "powershell" });
24
+ return execSync(script, { shell: "powershell" });
25
25
  }
26
26
 
27
27
  async function focusApplication(appName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testdriverai",
3
- "version": "4.0.27",
3
+ "version": "4.0.29",
4
4
  "description": "Next generation autonomous AI agent for end-to-end testing of web & desktop",
5
5
  "main": "index.js",
6
6
  "bin": {