testdriverai 4.1.6 → 4.1.8

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/agent.js CHANGED
@@ -640,10 +640,10 @@ const firstPrompt = async () => {
640
640
  // this is how we parse user input
641
641
  // notice that the AI is only called if the input is not a command
642
642
  rl.on("line", async (input) => {
643
+ if (!isInteractive) return;
643
644
  emitter.emit(events.interactive, false);
644
645
  await setTerminalApp();
645
-
646
- setTerminalWindowTransparency(true);
646
+ // setTerminalWindowTransparency(true);
647
647
  errorCounts = {};
648
648
 
649
649
  // append this to commandHistoryFile
@@ -676,7 +676,7 @@ const firstPrompt = async () => {
676
676
  await humanInput(input, true);
677
677
  }
678
678
 
679
- setTerminalWindowTransparency(false);
679
+ // setTerminalWindowTransparency(false);
680
680
  promptUser();
681
681
  });
682
682
 
@@ -991,9 +991,11 @@ const embed = async (file, depth) => {
991
991
  log.log("info", `${file} (end)`);
992
992
  };
993
993
 
994
+ let isInteractive = false;
994
995
  emitter.on(events.interactive, (data) => {
996
+ isInteractive = data;
995
997
  if (!terminalApp) return;
996
- if (data) {
998
+ if (isInteractive) {
997
999
  showTerminal(terminalApp);
998
1000
  } else {
999
1001
  hideTerminal(terminalApp);
package/lib/redraw.js CHANGED
@@ -7,7 +7,7 @@ const { compare } = require("odiff-bin");
7
7
  const si = require('systeminformation');
8
8
  const chalk = require('chalk');
9
9
 
10
- const networkCooldownMs = 2000;
10
+ const networkCooldownMs = 5000;
11
11
  const redrawThresholdPercent = 3;
12
12
 
13
13
  let lastTxBytes = null;
@@ -15,7 +15,6 @@ let lastRxBytes = null;
15
15
  let measurements = [];
16
16
  let networkSettled = true;
17
17
  let lastUnsettled = null;
18
- let watchNetwork = null;
19
18
  let screenHasRedrawn = null;
20
19
 
21
20
  async function resetState() {
@@ -108,18 +107,17 @@ async function imageDiffPercent(image1Url, image2Url) {
108
107
  }
109
108
  }
110
109
 
110
+
111
111
  let startImage = null;
112
112
 
113
113
  async function start() {
114
114
  resetState();
115
- watchNetwork = setInterval(updateNetwork, 500);
116
- startImage = await captureScreenPNG();
117
115
  startImage = await captureScreenPNG(1, true);
118
116
  return startImage;
119
117
  }
120
118
 
121
119
  async function checkCondition(resolve, startTime, timeoutMs) {
122
- let nowImage = await captureScreenPNG(1, true);
120
+ let nowImage = await captureScreenPNG(.5, true);
123
121
  let timeElapsed = Date.now() - startTime;
124
122
  let diffPercent = 0;
125
123
  let isTimeout = timeElapsed > timeoutMs;
@@ -131,19 +129,16 @@ async function checkCondition(resolve, startTime, timeoutMs) {
131
129
 
132
130
  // // log redraw as output
133
131
  let redrawText = screenHasRedrawn ? chalk.green(`✓`) : chalk.dim(`${diffPercent}/${redrawThresholdPercent}%`);
134
- let networkText = networkSettled ? chalk.green(`✓`) : chalk.dim(`${Math.floor((Date.now() - lastUnsettled) / 1000)}/${Math.floor(networkCooldownMs/1000)}s`);
132
+ let networkText = networkSettled ? chalk.green(`✓`) : chalk.dim(`${Math.floor((networkCooldownMs - (Date.now() - lastUnsettled)) / 1000)}/${Math.floor(networkCooldownMs/1000)}s`);
135
133
  let timeoutText = isTimeout ? chalk.green(`✓`) : chalk.dim(`${Math.floor((timeElapsed)/1000)}/${(timeoutMs / 1000)}s`);
136
134
 
137
135
  console.log(` `, chalk.dim('redraw='), redrawText, chalk.dim('network='), networkText, chalk.dim('timeout='), timeoutText);
138
136
 
139
137
  if ((screenHasRedrawn && networkSettled) || isTimeout) {
140
- clearInterval(watchNetwork);
141
138
  console.log('')
142
139
  resolve("true");
143
140
  } else {
144
- setTimeout(() => {
145
- checkCondition(resolve, startTime, timeoutMs);
146
- }, 1000);
141
+ checkCondition(resolve, startTime, timeoutMs);
147
142
  }
148
143
  }
149
144
 
@@ -155,4 +150,6 @@ function wait(timeoutMs) {
155
150
  });
156
151
  }
157
152
 
153
+ setInterval(updateNetwork, 2000);
154
+
158
155
  module.exports = { start, wait };
@@ -13,7 +13,7 @@ module.exports = (inputVersion) => {
13
13
  // Compare major and minor versions
14
14
  if (
15
15
  inputParsed.major === currentParsed.major &&
16
- inputParsed.minor >= currentParsed.minor
16
+ inputParsed.minor <= currentParsed.minor
17
17
  ) {
18
18
  return true;
19
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testdriverai",
3
- "version": "4.1.6",
3
+ "version": "4.1.8",
4
4
  "description": "Next generation autonomous AI agent for end-to-end testing of web & desktop",
5
5
  "main": "index.js",
6
6
  "bin": {