testdriverai 7.3.18 → 7.3.20

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/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [7.3.20](https://github.com/testdriverai/testdriverai/compare/v7.3.19...v7.3.20) (2026-02-19)
2
+
3
+
4
+
5
+ ## [7.3.19](https://github.com/testdriverai/testdriverai/compare/v7.3.17...v7.3.19) (2026-02-19)
6
+
7
+
8
+
1
9
  ## [7.3.18](https://github.com/testdriverai/testdriverai/compare/v7.3.17...v7.3.18) (2026-02-19)
2
10
 
3
11
 
@@ -71,7 +71,9 @@ const createSandbox = (emitter, analytics, sessionInstance) => {
71
71
  let resolvePromise;
72
72
  let rejectPromise;
73
73
 
74
- if (this.socket) {
74
+ // Check if socket exists and is actually open before sending
75
+ // This prevents sending to a closed connection (e.g., sandbox killed due to test failure)
76
+ if (this.socket && this.socket.readyState === WebSocket.OPEN) {
75
77
  this.messageId++;
76
78
  message.requestId = `${this.uniqueId}-${this.messageId}`;
77
79
 
@@ -150,8 +152,16 @@ const createSandbox = (emitter, analytics, sessionInstance) => {
150
152
  return p;
151
153
  }
152
154
 
153
- // Return a rejected promise if socket is not available
154
- return Promise.reject(new Error("Sandbox socket not connected"));
155
+ // Return a rejected promise if socket is not available or not open
156
+ // This can happen when the sandbox is killed (e.g., due to test failure)
157
+ const state = this.socket?.readyState;
158
+ const stateMap = {
159
+ [WebSocket.CONNECTING]: "connecting",
160
+ [WebSocket.CLOSING]: "closing",
161
+ [WebSocket.CLOSED]: "closed",
162
+ };
163
+ const stateDesc = stateMap[state] || "unavailable";
164
+ return Promise.reject(new Error(`Sandbox socket not connected (state: ${stateDesc})`));
155
165
  }
156
166
 
157
167
  async auth(apiKey) {
@@ -355,6 +365,9 @@ const createSandbox = (emitter, analytics, sessionInstance) => {
355
365
  this.socket.on("close", () => {
356
366
  clearInterval(this.heartbeat);
357
367
  this.apiSocketConnected = false;
368
+ // Also mark instance socket as disconnected to prevent sending messages
369
+ // to a closed connection (e.g., when sandbox is killed due to test failure)
370
+ this.instanceSocketConnected = false;
358
371
  // Reset reconnecting flag so handleConnectionLoss can run for this new disconnection
359
372
  this.reconnecting = false;
360
373
  this.handleConnectionLoss();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testdriverai",
3
- "version": "7.3.18",
3
+ "version": "7.3.20",
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",