testdriverai 4.0.50 → 4.0.51

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/index.js CHANGED
@@ -10,6 +10,7 @@ const package = require("./package.json");
10
10
  const fs = require("fs");
11
11
  const readline = require("readline");
12
12
  const os = require("os");
13
+ const http = require('http');
13
14
 
14
15
  // third party modules
15
16
  const path = require("path");
@@ -668,6 +669,22 @@ New commands will be appended.
668
669
 
669
670
  let setTerminalWindowTransparency = async (hide) => {
670
671
 
672
+
673
+ try {
674
+ await http.get('http://localhost:60305/hide')
675
+ } catch (e) {
676
+ // Suppress error
677
+ console.error('Caught exception:', e);
678
+ }
679
+
680
+ try {
681
+ await http.get('http://localhost:60305/show');
682
+ } catch (e) {
683
+ // Suppress error
684
+ console.error('Caught exception:', e);
685
+ }
686
+
687
+
671
688
  if (!config.TD_MINIMIZE) {
672
689
  return
673
690
  };
package/lib/commands.js CHANGED
@@ -122,8 +122,10 @@ const assert = async (assertion, shouldThrow = false, async = false) => {
122
122
  }
123
123
 
124
124
  const handleAssertResponse = (response) => {
125
+
126
+ logger.prettyMarkdown(response);
127
+
125
128
  if (response.indexOf("The task passed") > -1) {
126
- logger.prettyMarkdown(response);
127
129
  return true;
128
130
  } else {
129
131
  if (shouldThrow) {
@@ -40,6 +40,7 @@ async function focusApplication(appName) {
40
40
  }
41
41
 
42
42
  async function hideTerminal(appName) {
43
+
43
44
  try {
44
45
  if (platform() == "mac") {
45
46
  return await execSync(`osascript -e '${appleScriptMin(appName)}'`);
@@ -52,6 +53,7 @@ async function hideTerminal(appName) {
52
53
  }
53
54
 
54
55
  async function showTerminal(appName) {
56
+
55
57
  try {
56
58
  if (platform() == "mac") {
57
59
  return await execSync(`osascript -e '${appleScriptMax(appName)}'`);
@@ -68,3 +70,4 @@ module.exports = {
68
70
  hideTerminal,
69
71
  showTerminal,
70
72
  };
73
+
package/lib/redraw.js CHANGED
@@ -25,34 +25,27 @@ async function start() {
25
25
 
26
26
  function wait(timeoutMs) {
27
27
 
28
- // wait for a certain amount of time
29
28
  return new Promise((resolve) => {
30
- setTimeout(() => {
31
- resolve("Timeout reached");
32
- }, timeoutMs);
29
+ const startTime = Date.now();
30
+
31
+ async function checkCondition() {
32
+ console.log('check condition')
33
+ let nowImage = await captureScreenPNG();
34
+ let result = await compareImages(startImage, nowImage);
35
+
36
+ if (result) {
37
+ resolve("Condition met");
38
+ } else if (Date.now() - startTime >= timeoutMs) {
39
+ resolve("Timeout reached");
40
+ } else {
41
+ setTimeout(() => {
42
+ checkCondition();
43
+ }, 0);
44
+ }
45
+ }
46
+
47
+ checkCondition();
33
48
  });
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
- // });
56
49
  }
57
50
 
58
51
  module.exports = { start, wait };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testdriverai",
3
- "version": "4.0.50",
3
+ "version": "4.0.51",
4
4
  "description": "Next generation autonomous AI agent for end-to-end testing of web & desktop",
5
5
  "main": "index.js",
6
6
  "bin": {