testdriverai 4.0.77 → 4.0.79
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/logger.js +13 -10
- package/lib/resources/cursor.png +0 -0
- package/lib/system.js +8 -0
- package/package.json +1 -1
package/lib/logger.js
CHANGED
|
@@ -33,20 +33,18 @@ marked.use(
|
|
|
33
33
|
const spaceChar = " ";
|
|
34
34
|
|
|
35
35
|
const markedParsePartial = (markdown, start = 0, end = 0) => {
|
|
36
|
-
let result =
|
|
37
|
-
.parse(markdown)
|
|
38
|
-
.replace(/^/gm, spaceChar)
|
|
39
|
-
.trimEnd()
|
|
40
|
-
.split("\n");
|
|
41
|
-
|
|
36
|
+
let result = markdown.trimEnd().split("\n").slice(start, end);
|
|
42
37
|
if (end <= 0) {
|
|
43
38
|
end = result.length + end;
|
|
44
39
|
}
|
|
45
|
-
|
|
40
|
+
result = result.join("\n");
|
|
41
|
+
|
|
42
|
+
return marked.parse(result).replace(/^/gm, spaceChar).trimEnd();
|
|
46
43
|
};
|
|
47
44
|
|
|
48
45
|
const createMarkdownStreamLogger = () => {
|
|
49
46
|
let buffer = "";
|
|
47
|
+
console.log("");
|
|
50
48
|
return {
|
|
51
49
|
log: (chunk) => {
|
|
52
50
|
if (typeof chunk !== "string") {
|
|
@@ -61,14 +59,19 @@ const createMarkdownStreamLogger = () => {
|
|
|
61
59
|
|
|
62
60
|
const consoleOutput = markedParsePartial(buffer, 0, -1);
|
|
63
61
|
|
|
64
|
-
|
|
62
|
+
const diff = consoleOutput.replace(previousConsoleOutput, "");
|
|
63
|
+
if (diff) {
|
|
64
|
+
process.stdout.write(diff);
|
|
65
|
+
}
|
|
65
66
|
},
|
|
66
67
|
end() {
|
|
67
68
|
const previousConsoleOutput = markedParsePartial(buffer, 0, -1);
|
|
68
69
|
|
|
69
70
|
const consoleOutput = markedParsePartial(buffer);
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
const diff = consoleOutput.replace(previousConsoleOutput, "");
|
|
72
|
+
if (diff) {
|
|
73
|
+
process.stdout.write(diff);
|
|
74
|
+
}
|
|
72
75
|
process.stdout.write("\n\n");
|
|
73
76
|
buffer = "";
|
|
74
77
|
log("silly", consoleOutput);
|
|
Binary file
|
package/lib/system.js
CHANGED
|
@@ -43,12 +43,20 @@ const captureAndResize = async (scale = 1) => {
|
|
|
43
43
|
|
|
44
44
|
await screenshot({ filename: step1, format: "png" });
|
|
45
45
|
|
|
46
|
+
// Fetch the mouse position
|
|
47
|
+
const mousePos = robot.getMousePos();
|
|
48
|
+
|
|
49
|
+
// Location of cursor image
|
|
50
|
+
const cursorPath = path.join(__dirname, "resources", "cursor.png");
|
|
51
|
+
|
|
46
52
|
// resize to 1:1 px ratio
|
|
47
53
|
await sharp(step1)
|
|
48
54
|
.resize(
|
|
49
55
|
Math.floor(primaryDisplay.currentResX * scale),
|
|
50
56
|
Math.floor(primaryDisplay.currentResY * scale),
|
|
51
57
|
)
|
|
58
|
+
// composite the mouse image ontop
|
|
59
|
+
.composite([{ input: cursorPath, left: mousePos.x, top: mousePos.y}])
|
|
52
60
|
.toFile(step2);
|
|
53
61
|
|
|
54
62
|
return step2;
|