testdriverai 4.1.10 → 4.1.11

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.
@@ -151,10 +151,10 @@
151
151
 
152
152
  #terminal-wrapper {
153
153
  position: absolute;
154
- left: calc(100vw - 800px);
154
+ left: calc(100vw - 700px);
155
155
  top: 0px;
156
156
  height: 100vh;
157
- width: 800px;
157
+ width: 700px;
158
158
  background: black;
159
159
  opacity: 0;
160
160
  z-index: -1;
package/lib/redraw.js CHANGED
@@ -7,14 +7,17 @@ const { compare } = require("odiff-bin");
7
7
  const si = require('systeminformation');
8
8
  const chalk = require('chalk');
9
9
 
10
- const networkCooldownMs = 5000;
11
10
  const redrawThresholdPercent = 3;
11
+ const networkUpdateInterval = 2000;
12
12
 
13
13
  let lastTxBytes = null;
14
14
  let lastRxBytes = null;
15
+
16
+ let diffRxBytes = 0;
17
+ let diffTxBytes = 0;
18
+
15
19
  let measurements = [];
16
20
  let networkSettled = true;
17
- let lastUnsettled = null;
18
21
  let screenHasRedrawn = null;
19
22
 
20
23
  async function resetState() {
@@ -22,7 +25,6 @@ async function resetState() {
22
25
  lastRxBytes = null;
23
26
  measurements = [];
24
27
  networkSettled = true;
25
- lastUnsettled = null;
26
28
  screenHasRedrawn = false;
27
29
  }
28
30
 
@@ -31,8 +33,8 @@ async function updateNetwork() {
31
33
  let thisRxBytes = data[0].rx_bytes;
32
34
  let thisTxBytes = data[0].tx_bytes;
33
35
 
34
- let diffRxBytes = lastRxBytes !== null ? thisRxBytes - lastRxBytes : 0;
35
- let diffTxBytes = lastTxBytes !== null ? thisTxBytes - lastTxBytes : 0;
36
+ diffRxBytes = lastRxBytes !== null ? thisRxBytes - lastRxBytes : 0;
37
+ diffTxBytes = lastTxBytes !== null ? thisTxBytes - lastTxBytes : 0;
36
38
 
37
39
  lastRxBytes = thisRxBytes;
38
40
  lastTxBytes = thisTxBytes;
@@ -52,20 +54,11 @@ async function updateNetwork() {
52
54
  let zIndexRx = stdDevRx !== 0 ? (diffRxBytes - avgRx) / stdDevRx : 0;
53
55
  let zIndexTx = stdDevTx !== 0 ? (diffTxBytes - avgTx) / stdDevTx : 0;
54
56
 
55
- // log time since unsettlement
56
-
57
- if ((new Date().getTime() - lastUnsettled) < networkCooldownMs) {
58
- networkSettled = false;
57
+ // log time since unsettlement
58
+ if ((zIndexRx < 0 && zIndexTx < 0) ) {
59
+ networkSettled = true;
59
60
  } else {
60
-
61
- if ((zIndexRx < 0 && zIndexTx < 0) ) {
62
- lastUnsettled = null;
63
- networkSettled = true;
64
- } else {
65
- lastUnsettled = new Date().getTime();
66
- networkSettled = false;
67
- }
68
-
61
+ networkSettled = false;
69
62
  }
70
63
 
71
64
  if (process.env["DEV"]) {
@@ -125,11 +118,11 @@ async function checkCondition(resolve, startTime, timeoutMs) {
125
118
  if (!screenHasRedrawn) {
126
119
  diffPercent = await imageDiffPercent(startImage, nowImage);
127
120
  screenHasRedrawn = diffPercent > redrawThresholdPercent;
128
- }
129
-
121
+ };
122
+
130
123
  // // log redraw as output
131
124
  let redrawText = screenHasRedrawn ? chalk.green(`y`) : chalk.dim(`${diffPercent}/${redrawThresholdPercent}%`);
132
- let networkText = networkSettled ? chalk.green(`y`) : chalk.dim(`${Math.floor((networkCooldownMs - (Date.now() - lastUnsettled)) / 1000)}/${Math.floor(networkCooldownMs/1000)}s`);
125
+ let networkText = networkSettled ? chalk.green(`y`) : chalk.dim(`${Math.trunc((diffRxBytes + diffTxBytes) / networkUpdateInterval)}b/s`);
133
126
  let timeoutText = isTimeout ? chalk.green(`y`) : chalk.dim(`${Math.floor((timeElapsed)/1000)}/${(timeoutMs / 1000)}s`);
134
127
 
135
128
  console.log(` `, chalk.dim('redraw='), redrawText, chalk.dim('network='), networkText, chalk.dim('timeout='), timeoutText);
@@ -150,6 +143,6 @@ function wait(timeoutMs) {
150
143
  });
151
144
  }
152
145
 
153
- setInterval(updateNetwork, 2000);
146
+ setInterval(updateNetwork, networkUpdateInterval);
154
147
 
155
148
  module.exports = { start, wait };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testdriverai",
3
- "version": "4.1.10",
3
+ "version": "4.1.11",
4
4
  "description": "Next generation autonomous AI agent for end-to-end testing of web & desktop",
5
5
  "main": "index.js",
6
6
  "bin": {