testdriverai 4.0.47 → 4.0.49
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/analytics.js +2 -2
- package/lib/commander.js +5 -1
- package/lib/config.js +1 -1
- package/lib/redraw.js +27 -16
- package/package.json +2 -1
package/lib/analytics.js
CHANGED
|
@@ -3,10 +3,10 @@ const config = require("./config");
|
|
|
3
3
|
|
|
4
4
|
module.exports = {
|
|
5
5
|
track: async (event, data) => {
|
|
6
|
-
if (config["TD_ANALYTICS"]) {
|
|
6
|
+
if (!config["TD_ANALYTICS"]) {
|
|
7
7
|
return;
|
|
8
8
|
} else {
|
|
9
|
-
sdk.req("analytics", { event, data });
|
|
9
|
+
await sdk.req("analytics", { event, data });
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
};
|
package/lib/commander.js
CHANGED
|
@@ -6,6 +6,7 @@ const yaml = require("js-yaml");
|
|
|
6
6
|
const speak = require("./speak");
|
|
7
7
|
const notify = require("./notify");
|
|
8
8
|
const analytics = require("./analytics");
|
|
9
|
+
const marky = require('marky');
|
|
9
10
|
|
|
10
11
|
// object is a json representation of the individual yml command
|
|
11
12
|
// the process turns markdown -> yml -> json -> js function execution
|
|
@@ -35,7 +36,7 @@ commands:
|
|
|
35
36
|
} else {
|
|
36
37
|
let copy = JSON.parse(JSON.stringify(object));
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
marky.mark(object.command);
|
|
39
40
|
|
|
40
41
|
// we speak, log, and take images here because we want to be careful not to render a notification containing the text we're looking for
|
|
41
42
|
// or to cover the screen of some item we might want
|
|
@@ -176,6 +177,9 @@ commands:
|
|
|
176
177
|
}
|
|
177
178
|
}
|
|
178
179
|
|
|
180
|
+
let timing = marky.stop(object.command);
|
|
181
|
+
await analytics.track("command", { data: object, depth, timing});
|
|
182
|
+
|
|
179
183
|
return response;
|
|
180
184
|
};
|
|
181
185
|
|
package/lib/config.js
CHANGED
|
@@ -23,7 +23,7 @@ function parseValue(value) {
|
|
|
23
23
|
// Object for TD related config, with defaults
|
|
24
24
|
const config = {
|
|
25
25
|
TD_SPEAK: false,
|
|
26
|
-
TD_ANALYTICS:
|
|
26
|
+
TD_ANALYTICS: true,
|
|
27
27
|
TD_NOTIFY: false,
|
|
28
28
|
TD_API_ROOT: "https://replayable-api-production.herokuapp.com",
|
|
29
29
|
TD_DEV: parseValue(process.env["DEV"]),
|
package/lib/redraw.js
CHANGED
|
@@ -24,24 +24,35 @@ async function start() {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
function wait(timeoutMs) {
|
|
27
|
+
|
|
28
|
+
// wait for a certain amount of time
|
|
27
29
|
return new Promise((resolve) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
let nowImage = await captureScreenPNG();
|
|
32
|
-
let result = await compareImages(startImage, nowImage);
|
|
33
|
-
|
|
34
|
-
if (result) {
|
|
35
|
-
resolve("Condition met");
|
|
36
|
-
} else if (Date.now() - startTime >= timeoutMs) {
|
|
37
|
-
resolve("Timeout reached");
|
|
38
|
-
} else {
|
|
39
|
-
setTimeout(checkCondition, 0);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
checkCondition();
|
|
30
|
+
setTimeout(() => {
|
|
31
|
+
resolve("Timeout reached");
|
|
32
|
+
}, timeoutMs);
|
|
44
33
|
});
|
|
34
|
+
|
|
35
|
+
// return new Promise((resolve) => {
|
|
36
|
+
// const startTime = Date.now();
|
|
37
|
+
|
|
38
|
+
// async function checkCondition() {
|
|
39
|
+
// console.log('check condition')
|
|
40
|
+
// let nowImage = await captureScreenPNG();
|
|
41
|
+
// let result = await compareImages(startImage, nowImage);
|
|
42
|
+
|
|
43
|
+
// if (result) {
|
|
44
|
+
// resolve("Condition met");
|
|
45
|
+
// } else if (Date.now() - startTime >= timeoutMs) {
|
|
46
|
+
// resolve("Timeout reached");
|
|
47
|
+
// } else {
|
|
48
|
+
// setTimeout(() => {
|
|
49
|
+
// checkCondition();
|
|
50
|
+
// }, 0);
|
|
51
|
+
// }
|
|
52
|
+
// }
|
|
53
|
+
|
|
54
|
+
// checkCondition();
|
|
55
|
+
// });
|
|
45
56
|
}
|
|
46
57
|
|
|
47
58
|
module.exports = { start, wait };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "testdriverai",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.49",
|
|
4
4
|
"description": "Next generation autonomous AI agent for end-to-end testing of web & desktop",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"markdown-parser": "0.0.8",
|
|
30
30
|
"marked": "^12.0.1",
|
|
31
31
|
"marked-terminal": "^7.0.0",
|
|
32
|
+
"marky": "^1.2.5",
|
|
32
33
|
"node-notifier": "^10.0.1",
|
|
33
34
|
"prompts": "^2.4.2",
|
|
34
35
|
"remark-parse": "^11.0.0",
|