testdriverai 7.2.76 → 7.2.77

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.
@@ -8,6 +8,7 @@ const DEFAULT_REDRAW_OPTIONS = {
8
8
  enabled: true, // Master switch to enable/disable redraw detection
9
9
  screenRedraw: true, // Enable screen redraw detection
10
10
  networkMonitor: true, // Enable network activity monitoring
11
+ noChangeTimeoutMs: 1500, // Exit early if no screen change detected after this time
11
12
  };
12
13
 
13
14
  // Factory function that creates redraw functionality with the provided system instance
@@ -235,7 +236,7 @@ const createRedraw = (
235
236
  }
236
237
 
237
238
  async function checkCondition(resolve, startTime, timeoutMs, options) {
238
- const { enabled, screenRedraw, networkMonitor } = options;
239
+ const { enabled, screenRedraw, networkMonitor, noChangeTimeoutMs = 1500 } = options;
239
240
 
240
241
  // If redraw is disabled, resolve immediately
241
242
  if (!enabled) {
@@ -248,6 +249,9 @@ const createRedraw = (
248
249
  let diffFromInitial = 0;
249
250
  let diffFromLast = 0;
250
251
  let isTimeout = timeElapsed > timeoutMs;
252
+
253
+ // Early exit: if no screen change detected after noChangeTimeoutMs, assume action had no visual effect
254
+ const noChangeTimeout = screenRedraw && !hasChangedFromInitial && timeElapsed > noChangeTimeoutMs;
251
255
 
252
256
  // Screen stability detection:
253
257
  // 1. Check if screen has changed from initial (detect transition)
@@ -276,8 +280,14 @@ const createRedraw = (
276
280
  lastScreenImage = nowImage;
277
281
  }
278
282
 
279
- // Screen is settled when: it has changed from initial AND consecutive frames are now stable
280
- const screenSettled = hasChangedFromInitial && consecutiveFramesStable;
283
+ // Screen is settled when:
284
+ // 1. It has changed from initial AND consecutive frames are now stable, OR
285
+ // 2. No change was detected after noChangeTimeoutMs (action had no visual effect)
286
+ const screenSettled = (hasChangedFromInitial && consecutiveFramesStable) || noChangeTimeout;
287
+
288
+ if (noChangeTimeout && !hasChangedFromInitial) {
289
+ emitter.emit(events.log.debug, `[redraw] No screen change detected after ${noChangeTimeoutMs}ms, settling early`);
290
+ }
281
291
 
282
292
  // If screen redraw is disabled, consider it as "settled"
283
293
  const effectiveScreenSettled = screenRedraw ? screenSettled : true;
@@ -334,12 +344,13 @@ const createRedraw = (
334
344
  networkSettled: effectiveNetworkSettled,
335
345
  isTimeout,
336
346
  timeElapsed,
347
+ noChangeTimeout,
337
348
  });
338
349
  resolve("true");
339
350
  } else {
340
351
  setTimeout(() => {
341
352
  checkCondition(resolve, startTime, timeoutMs, options);
342
- }, 500);
353
+ }, 250);
343
354
  }
344
355
  }
345
356
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testdriverai",
3
- "version": "7.2.76",
3
+ "version": "7.2.77",
4
4
  "description": "Next generation autonomous AI agent for end-to-end testing of web & desktop",
5
5
  "main": "sdk.js",
6
6
  "types": "sdk.d.ts",