testdriverai 4.0.28 → 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 +2 -12
- package/package.json +1 -1
package/lib/commands.js
CHANGED
|
@@ -33,8 +33,8 @@ 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
|
|
37
|
-
let rootpath = path.join(cwd(),
|
|
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';
|
|
@@ -46,7 +46,6 @@ const findImageOnScreen = async (relativePath, haystack, restrictToWindow) => {
|
|
|
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
|
}
|