testplane 8.42.6 → 8.44.0

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.
Files changed (109) hide show
  1. package/build/package.json +4 -4
  2. package/build/src/browser/browser.js +5 -4
  3. package/build/src/browser/browser.js.map +1 -1
  4. package/build/src/browser/cdp/connection.d.ts +2 -39
  5. package/build/src/browser/cdp/connection.js +73 -353
  6. package/build/src/browser/cdp/connection.js.map +1 -1
  7. package/build/src/browser/cdp/constants.d.ts +0 -10
  8. package/build/src/browser/cdp/constants.js +1 -11
  9. package/build/src/browser/cdp/constants.js.map +1 -1
  10. package/build/src/browser/cdp/error.d.ts +14 -20
  11. package/build/src/browser/cdp/error.js +29 -32
  12. package/build/src/browser/cdp/error.js.map +1 -1
  13. package/build/src/browser/cdp/selectivity/css-selectivity.d.ts +6 -4
  14. package/build/src/browser/cdp/selectivity/css-selectivity.js +13 -2
  15. package/build/src/browser/cdp/selectivity/css-selectivity.js.map +1 -1
  16. package/build/src/browser/cdp/selectivity/hash-reader.js +7 -3
  17. package/build/src/browser/cdp/selectivity/hash-reader.js.map +1 -1
  18. package/build/src/browser/cdp/selectivity/hash-writer.d.ts +1 -1
  19. package/build/src/browser/cdp/selectivity/hash-writer.js +6 -11
  20. package/build/src/browser/cdp/selectivity/hash-writer.js.map +1 -1
  21. package/build/src/browser/cdp/selectivity/index.d.ts +6 -3
  22. package/build/src/browser/cdp/selectivity/index.js +22 -14
  23. package/build/src/browser/cdp/selectivity/index.js.map +1 -1
  24. package/build/src/browser/cdp/selectivity/js-selectivity.d.ts +8 -6
  25. package/build/src/browser/cdp/selectivity/js-selectivity.js +79 -42
  26. package/build/src/browser/cdp/selectivity/js-selectivity.js.map +1 -1
  27. package/build/src/browser/cdp/selectivity/merge-dumps/merge-tests.js +1 -0
  28. package/build/src/browser/cdp/selectivity/merge-dumps/merge-tests.js.map +1 -1
  29. package/build/src/browser/cdp/selectivity/runner.js +11 -1
  30. package/build/src/browser/cdp/selectivity/runner.js.map +1 -1
  31. package/build/src/browser/cdp/selectivity/test-dependencies-reader.js +1 -1
  32. package/build/src/browser/cdp/selectivity/test-dependencies-reader.js.map +1 -1
  33. package/build/src/browser/cdp/selectivity/test-dependencies-writer.js +1 -1
  34. package/build/src/browser/cdp/selectivity/test-dependencies-writer.js.map +1 -1
  35. package/build/src/browser/cdp/selectivity/testplane-selectivity.d.ts +3 -1
  36. package/build/src/browser/cdp/selectivity/testplane-selectivity.js +18 -5
  37. package/build/src/browser/cdp/selectivity/testplane-selectivity.js.map +1 -1
  38. package/build/src/browser/cdp/selectivity/types.d.ts +2 -0
  39. package/build/src/browser/cdp/selectivity/types.js.map +1 -1
  40. package/build/src/browser/cdp/selectivity/utils.d.ts +8 -3
  41. package/build/src/browser/cdp/selectivity/utils.js +41 -11
  42. package/build/src/browser/cdp/selectivity/utils.js.map +1 -1
  43. package/build/src/browser/cdp/utils.d.ts +0 -6
  44. package/build/src/browser/cdp/utils.js +1 -6
  45. package/build/src/browser/cdp/utils.js.map +1 -1
  46. package/build/src/browser/commands/assert-view/errors/image-diff-error.d.ts +1 -0
  47. package/build/src/browser/commands/assert-view/index.js +6 -1
  48. package/build/src/browser/commands/assert-view/index.js.map +1 -1
  49. package/build/src/browser/existing-browser.d.ts +2 -0
  50. package/build/src/browser/existing-browser.js +15 -0
  51. package/build/src/browser/existing-browser.js.map +1 -1
  52. package/build/src/browser/wsdriver/compression.d.ts +5 -0
  53. package/build/src/browser/wsdriver/compression.js +79 -0
  54. package/build/src/browser/wsdriver/compression.js.map +1 -0
  55. package/build/src/browser/wsdriver/constants.d.ts +11 -0
  56. package/build/src/browser/wsdriver/constants.js +15 -0
  57. package/build/src/browser/wsdriver/constants.js.map +1 -0
  58. package/build/src/browser/wsdriver/debug.d.ts +2 -0
  59. package/build/src/browser/wsdriver/debug.js +9 -0
  60. package/build/src/browser/wsdriver/debug.js.map +1 -0
  61. package/build/src/browser/wsdriver/error.d.ts +18 -0
  62. package/build/src/browser/wsdriver/error.js +36 -0
  63. package/build/src/browser/wsdriver/error.js.map +1 -0
  64. package/build/src/browser/wsdriver/index.d.ts +23 -0
  65. package/build/src/browser/wsdriver/index.js +261 -0
  66. package/build/src/browser/wsdriver/index.js.map +1 -0
  67. package/build/src/browser/wsdriver/request.d.ts +10 -0
  68. package/build/src/browser/wsdriver/request.js +58 -0
  69. package/build/src/browser/wsdriver/request.js.map +1 -0
  70. package/build/src/browser/wsdriver/response.d.ts +3 -0
  71. package/build/src/browser/wsdriver/response.js +111 -0
  72. package/build/src/browser/wsdriver/response.js.map +1 -0
  73. package/build/src/browser/wsdriver/types.d.ts +71 -0
  74. package/build/src/browser/wsdriver/types.js +27 -0
  75. package/build/src/browser/wsdriver/types.js.map +1 -0
  76. package/build/src/config/browser-options.js +1 -0
  77. package/build/src/config/browser-options.js.map +1 -1
  78. package/build/src/config/defaults.d.ts +3 -0
  79. package/build/src/config/defaults.js +3 -0
  80. package/build/src/config/defaults.js.map +1 -1
  81. package/build/src/config/types.d.ts +18 -3
  82. package/build/src/constants/png.d.ts +1 -0
  83. package/build/src/image.d.ts +2 -0
  84. package/build/src/image.js +21 -1
  85. package/build/src/image.js.map +1 -1
  86. package/build/src/runner/browser-env/vite/browser-modules/tsconfig.tsbuildinfo +1 -1
  87. package/build/src/runner/suite-monitor.d.ts +1 -1
  88. package/build/src/test-reader/mocha-reader/mocha-event-bus.d.ts +1 -1
  89. package/build/src/test-reader/test-parser.js +1 -1
  90. package/build/src/test-reader/test-parser.js.map +1 -1
  91. package/build/src/testplane.js +3 -3
  92. package/build/src/testplane.js.map +1 -1
  93. package/build/src/utils/eight-bit-rgba-to-png.d.ts +1 -0
  94. package/build/src/utils/workers-registry.d.ts +2 -2
  95. package/build/src/worker/runner/test-runner/one-time-screenshooter.js +2 -3
  96. package/build/src/worker/runner/test-runner/one-time-screenshooter.js.map +1 -1
  97. package/build/src/ws-connection/constants.d.ts +13 -0
  98. package/build/src/ws-connection/constants.js +17 -0
  99. package/build/src/ws-connection/constants.js.map +1 -0
  100. package/build/src/ws-connection/error.d.ts +51 -0
  101. package/build/src/ws-connection/error.js +81 -0
  102. package/build/src/ws-connection/error.js.map +1 -0
  103. package/build/src/ws-connection/index.d.ts +83 -0
  104. package/build/src/ws-connection/index.js +386 -0
  105. package/build/src/ws-connection/index.js.map +1 -0
  106. package/build/src/ws-connection/utils.d.ts +6 -0
  107. package/build/src/ws-connection/utils.js +9 -0
  108. package/build/src/ws-connection/utils.js.map +1 -0
  109. package/package.json +4 -4
@@ -0,0 +1,386 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WsConnection = void 0;
4
+ const ws_1 = require("ws");
5
+ const error_1 = require("./error");
6
+ const utils_1 = require("./utils");
7
+ const constants_1 = require("./constants");
8
+ var WsConnectionStatus;
9
+ (function (WsConnectionStatus) {
10
+ WsConnectionStatus[WsConnectionStatus["DISCONNECTED"] = 0] = "DISCONNECTED";
11
+ WsConnectionStatus[WsConnectionStatus["CONNECTING"] = 1] = "CONNECTING";
12
+ WsConnectionStatus[WsConnectionStatus["CONNECTED"] = 2] = "CONNECTED";
13
+ WsConnectionStatus[WsConnectionStatus["CLOSED"] = 3] = "CLOSED";
14
+ })(WsConnectionStatus || (WsConnectionStatus = {}));
15
+ // Closing WS when its still not connected produces error:
16
+ // https://github.com/websockets/ws/blob/86eac5b44ac2bff9087ec40c9bd06bc7b4f0da07/lib/websocket.js#L297-L301
17
+ const closeWsConnection = (ws) => {
18
+ if (ws.readyState !== ws.CONNECTING) {
19
+ ws.close();
20
+ }
21
+ else {
22
+ ws.once("open", () => {
23
+ ws.close();
24
+ });
25
+ }
26
+ };
27
+ class WsConnection {
28
+ constructor(endpoint, options) {
29
+ this._onPong = null;
30
+ this._pingShouldSkip = false;
31
+ this._pingInterval = null;
32
+ this._pingSubsequentFails = 0;
33
+ this._onConnectionCloseFn = null; // Defined, if there is connection attempt at the moment
34
+ this._wsConnectionStatus = WsConnectionStatus.DISCONNECTED;
35
+ this._wsConnection = null;
36
+ this._wsConnectionPromise = null;
37
+ this._requestId = 0;
38
+ this._pendingRequests = {};
39
+ const { headers, debugFn, retries, timeouts, errors, onMessage } = options;
40
+ this._endpoint = endpoint;
41
+ this._requestHeaders = headers;
42
+ this._debugFn = debugFn || (() => { });
43
+ this._retries = retries || { count: 3, baseDelay: 500, factor: 2 };
44
+ this._timeouts = timeouts;
45
+ this._errors = errors;
46
+ this._onMessage = onMessage;
47
+ }
48
+ async getConnectionProperties() {
49
+ await this._getWsConnection();
50
+ return {
51
+ responseHeaders: this._responseHeaders,
52
+ };
53
+ }
54
+ /** @description Tries to establish ws connection with timeout */
55
+ async _tryToEstablishWsConnection(endpoint) {
56
+ return new Promise(resolve => {
57
+ try {
58
+ const onConnectionCloseFn = () => done(new this._errors.ConnectionTerminated());
59
+ if (this._wsConnectionStatus === WsConnectionStatus.CLOSED) {
60
+ onConnectionCloseFn();
61
+ }
62
+ else {
63
+ this._onConnectionCloseFn = onConnectionCloseFn;
64
+ }
65
+ // eslint-disable-next-line
66
+ const cdpConnectionInstance = this;
67
+ const ws = new ws_1.WebSocket(endpoint, { headers: this._requestHeaders });
68
+ let isSettled = false;
69
+ const timeoutId = setTimeout(() => {
70
+ closeWsConnection(ws);
71
+ done(new this._errors.ConnectionTimeout({
72
+ message: `Couldn't establish WS connection to "${endpoint}" in ${this._timeouts.createSession}ms`,
73
+ }));
74
+ }, this._timeouts.createSession).unref();
75
+ const onOpen = () => {
76
+ done(ws);
77
+ };
78
+ const onError = (error) => {
79
+ closeWsConnection(ws);
80
+ done(new this._errors.ConnectionEstablishment({
81
+ message: `Couldn't establish WS connection to "${endpoint}": ${error}`,
82
+ }));
83
+ };
84
+ const onClose = () => {
85
+ done(new this._errors.ConnectionEstablishment({
86
+ message: `WS connection to "${endpoint}" unexpectedly closed while establishing`,
87
+ }));
88
+ };
89
+ const onUpgrade = (res) => {
90
+ this._responseHeaders = res.headers;
91
+ this._onResponseHeaders?.(res.headers);
92
+ };
93
+ ws.on("open", onOpen);
94
+ ws.on("error", onError);
95
+ ws.on("close", onClose);
96
+ ws.on("upgrade", onUpgrade);
97
+ // eslint-disable-next-line no-inner-declarations
98
+ function done(result) {
99
+ if (isSettled) {
100
+ return;
101
+ }
102
+ cdpConnectionInstance._onConnectionCloseFn = null;
103
+ isSettled = true;
104
+ clearTimeout(timeoutId);
105
+ ws.off("open", onOpen);
106
+ ws.off("error", onError);
107
+ ws.off("close", onClose);
108
+ ws.off("upgrade", onUpgrade);
109
+ resolve(result);
110
+ }
111
+ }
112
+ catch (err) {
113
+ resolve(err);
114
+ }
115
+ });
116
+ }
117
+ /**
118
+ * @description creates ws connection with retries or returns existing one
119
+ * @note Concurrent requests with same params produce same ws connection
120
+ */
121
+ async _getWsConnection() {
122
+ const ws = this._wsConnection;
123
+ if (this._wsConnectionStatus === WsConnectionStatus.CLOSED) {
124
+ throw new this._errors.ConnectionTerminated({ message: `Session to ${this._endpoint} was closed` });
125
+ }
126
+ if (this._wsConnectionStatus === WsConnectionStatus.CONNECTING && this._wsConnectionPromise) {
127
+ return this._wsConnectionPromise;
128
+ }
129
+ if (this._wsConnectionStatus === WsConnectionStatus.CONNECTED && ws && ws.readyState === ws.OPEN) {
130
+ return ws;
131
+ }
132
+ if (this._wsConnectionStatus === WsConnectionStatus.CONNECTED && ws && ws.readyState !== ws.OPEN) {
133
+ this._closeWsConnection("WS connection was in invalid state", WsConnectionStatus.DISCONNECTED);
134
+ }
135
+ this._wsConnectionStatus = WsConnectionStatus.CONNECTING;
136
+ this._wsConnectionPromise = (async () => {
137
+ try {
138
+ for (let retriesLeft = this._retries.count || 0; retriesLeft >= 0; retriesLeft--) {
139
+ const result = await this._tryToEstablishWsConnection(this._endpoint);
140
+ if (this._wsConnectionStatus === WsConnectionStatus.CLOSED) {
141
+ if (result instanceof ws_1.WebSocket) {
142
+ closeWsConnection(result);
143
+ }
144
+ throw new this._errors.ConnectionTerminated();
145
+ }
146
+ if (result instanceof ws_1.WebSocket) {
147
+ this._debugFn(`\u2713 Established WS connection to ${this._endpoint}`);
148
+ this._wsConnection = result;
149
+ this._wsConnectionStatus = WsConnectionStatus.CONNECTED;
150
+ this._pingHealthCheckStart();
151
+ const onPing = () => result.pong();
152
+ const onMessage = (data, isBinary) => this._onMessage(data, isBinary);
153
+ const onError = (err) => {
154
+ if (result === this._wsConnection) {
155
+ this._closeWsConnection(`An error occured in WS connection: ${err}`, WsConnectionStatus.DISCONNECTED);
156
+ this._tryToReconnect();
157
+ }
158
+ };
159
+ result.on("ping", onPing);
160
+ result.on("message", onMessage);
161
+ result.on("error", onError);
162
+ result.once("close", () => {
163
+ result.off("ping", onPing);
164
+ result.off("message", onMessage);
165
+ result.off("error", onError);
166
+ if (result === this._wsConnection) {
167
+ this._closeWsConnection("WS connection was closed unexpectedly", WsConnectionStatus.DISCONNECTED);
168
+ this._tryToReconnect();
169
+ }
170
+ });
171
+ return result;
172
+ }
173
+ if (!(result instanceof error_1.WsError) || !result.isRetryable()) {
174
+ throw result;
175
+ }
176
+ this._debugFn(`⟳ ${result.message}; retries left: ${retriesLeft}`);
177
+ // Intentionally avoiding wait after timeout
178
+ if (result instanceof error_1.WsError && !(result instanceof error_1.WsTimeoutError)) {
179
+ await (0, utils_1.exponentiallyWait)({
180
+ baseDelay: this._retries.baseDelay,
181
+ attempt: this._retries.count - retriesLeft,
182
+ factor: this._retries.factor,
183
+ });
184
+ }
185
+ }
186
+ throw new this._errors.ConnectionEstablishment({
187
+ message: `Couldn't establish WS connection to ${this._endpoint} in ${this._retries.count} retries`,
188
+ });
189
+ }
190
+ catch (err) {
191
+ if (this._wsConnectionStatus === WsConnectionStatus.CONNECTING) {
192
+ this._wsConnectionStatus = WsConnectionStatus.DISCONNECTED;
193
+ this._wsConnectionPromise = null;
194
+ }
195
+ throw err;
196
+ }
197
+ finally {
198
+ if (this._wsConnectionStatus !== WsConnectionStatus.CONNECTING) {
199
+ this._wsConnectionPromise = null;
200
+ }
201
+ }
202
+ })();
203
+ return this._wsConnectionPromise;
204
+ }
205
+ /** @description Produces connection-"uniq" request ids */
206
+ getRequestId() {
207
+ const id = ++this._requestId;
208
+ if (this._requestId >= constants_1.WS_MAX_REQUEST_ID) {
209
+ this._requestId = 0;
210
+ }
211
+ return id;
212
+ }
213
+ /** @description Performs WS request with timeout */
214
+ async makeRequest(requestId, requestMessage) {
215
+ const ws = await this._getWsConnection();
216
+ if (this._wsConnectionStatus === WsConnectionStatus.CLOSED) {
217
+ throw new this._errors.ConnectionTerminated({
218
+ requestId,
219
+ message: `Couldn't send request because WS connection was manually closed`,
220
+ });
221
+ }
222
+ return new Promise(resolve => {
223
+ const pendingRequests = this._pendingRequests;
224
+ let isSettled = false;
225
+ const onTimeout = setTimeout(() => {
226
+ const err = new this._errors.RequestTimeout({
227
+ message: `Timed out while waiting for request in ${this._timeouts.request}ms`,
228
+ requestId,
229
+ });
230
+ done(err);
231
+ }, this._timeouts.request).unref();
232
+ function done(response) {
233
+ if (isSettled) {
234
+ return;
235
+ }
236
+ isSettled = true;
237
+ delete pendingRequests[requestId];
238
+ clearTimeout(onTimeout);
239
+ resolve(response);
240
+ }
241
+ pendingRequests[requestId] = done;
242
+ ws.send(requestMessage, error => {
243
+ if (!error) {
244
+ this._pingShouldSkip = true;
245
+ return;
246
+ }
247
+ done(new this._errors.ConnectionBreak({
248
+ message: `Couldn't send WS request: ${error.message}`,
249
+ requestId,
250
+ }));
251
+ // Proactively closing connection as "send error" is marker that something bad with connection happened
252
+ if (ws === this._wsConnection) {
253
+ this._closeWsConnection("WS connection was considered broken as 'send' failed", WsConnectionStatus.DISCONNECTED);
254
+ this._tryToReconnect();
255
+ }
256
+ });
257
+ });
258
+ }
259
+ provideResponseFor(requestId, data) {
260
+ if (!this._pendingRequests[requestId]) {
261
+ this._debugFn(`! Received response to request ${requestId}, which is probably timed out already`);
262
+ return;
263
+ }
264
+ this._pendingRequests[requestId](data);
265
+ }
266
+ forceReconnect(sessionAbortMessage) {
267
+ this._closeWsConnection(sessionAbortMessage, WsConnectionStatus.DISCONNECTED);
268
+ this._tryToReconnect();
269
+ }
270
+ /** @description Used to abort all pending requests when connection is closed */
271
+ _abortPendingRequests(message, isTerminated) {
272
+ const pendingRequests = this._pendingRequests;
273
+ const pendingRequestIds = Object.keys(pendingRequests).map(Number);
274
+ this._pendingRequests = {};
275
+ for (const requestId of pendingRequestIds) {
276
+ if (pendingRequests[requestId]) {
277
+ pendingRequests[requestId](isTerminated
278
+ ? new this._errors.ConnectionTerminated({
279
+ message,
280
+ requestId,
281
+ })
282
+ : new this._errors.ConnectionBreak({
283
+ message,
284
+ requestId,
285
+ }));
286
+ }
287
+ }
288
+ }
289
+ _closeWsConnection(sessionAbortMessage, status) {
290
+ const ws = this._wsConnection;
291
+ if (!ws || this._wsConnectionStatus === WsConnectionStatus.CLOSED) {
292
+ this._wsConnection = null;
293
+ return;
294
+ }
295
+ this._debugFn(`\u2718 ${sessionAbortMessage}; endpoint: "${this._endpoint}"`);
296
+ const isClosing = status === WsConnectionStatus.CLOSED;
297
+ if (isClosing && this._onConnectionCloseFn) {
298
+ this._onConnectionCloseFn();
299
+ }
300
+ this._wsConnection = null;
301
+ this._wsConnectionStatus = status;
302
+ this._abortPendingRequests(`Request was aborted because ${sessionAbortMessage}`, isClosing);
303
+ this._pingHealthCheckStop();
304
+ if (isClosing) {
305
+ this._onClose?.();
306
+ }
307
+ else {
308
+ this._onDisconnect?.();
309
+ }
310
+ closeWsConnection(ws);
311
+ }
312
+ /**
313
+ * @description Tries to re-establish connection after network drops
314
+ * @note Silently gives up after failed retries attempts
315
+ */
316
+ _tryToReconnect() {
317
+ this._debugFn(`⟳ Trying to reconnect; endpoint: "${this._endpoint}"`);
318
+ this._getWsConnection()
319
+ .then(() => {
320
+ this._onReconnect?.();
321
+ this._debugFn(`\u2713 Successfully reconnected to session; endpoint: "${this._endpoint}"`);
322
+ })
323
+ .catch(() => this._debugFn(`\u2718 Couldn't reconnect to session automatically; endpoint: "${this._endpoint}"`));
324
+ }
325
+ /** @description Closes websocket connection, terminating all pending requests */
326
+ close() {
327
+ this._closeWsConnection("Connection was closed manually", WsConnectionStatus.CLOSED);
328
+ }
329
+ _pingHealthCheckStop() {
330
+ this._pingSubsequentFails = 0;
331
+ if (this._pingInterval) {
332
+ clearInterval(this._pingInterval);
333
+ }
334
+ if (this._wsConnection && this._onPong) {
335
+ this._wsConnection.off("pong", this._onPong);
336
+ }
337
+ }
338
+ _isWebSocketActive(ws) {
339
+ return Boolean(ws.readyState !== ws.CLOSED && ws.readyState !== ws.CLOSING && ws === this._wsConnection);
340
+ }
341
+ _pingHealthCheckStart() {
342
+ this._pingHealthCheckStop();
343
+ const ws = this._wsConnection;
344
+ if (!ws || !this._isWebSocketActive(ws)) {
345
+ return;
346
+ }
347
+ this._pingHealthCheckStop();
348
+ let isWaitingForPong = false;
349
+ let pongTimeout;
350
+ const onPong = (this._onPong = () => {
351
+ if (isWaitingForPong && this._isWebSocketActive(ws)) {
352
+ isWaitingForPong = false;
353
+ this._debugFn("< PONG");
354
+ clearTimeout(pongTimeout);
355
+ this._pingSubsequentFails = 0;
356
+ }
357
+ });
358
+ ws.on("pong", onPong);
359
+ const pingInterval = (this._pingInterval = setInterval(() => {
360
+ if (!this._isWebSocketActive(ws)) {
361
+ clearInterval(pingInterval);
362
+ return;
363
+ }
364
+ if (this._pingShouldSkip) {
365
+ this._pingShouldSkip = false;
366
+ return;
367
+ }
368
+ pongTimeout = setTimeout(() => {
369
+ if (isWaitingForPong && this._isWebSocketActive(ws)) {
370
+ isWaitingForPong = false;
371
+ this._pingSubsequentFails++;
372
+ this._debugFn(`! Ping failed(${this._pingSubsequentFails} in a row) in ${constants_1.WS_PING_TIMEOUT}ms`);
373
+ if (this._pingSubsequentFails >= constants_1.WS_PING_MAX_SUBSEQUENT_FAILS) {
374
+ this._closeWsConnection(`WS connection was considered broken as ${this._pingSubsequentFails} pings failed in a row`, WsConnectionStatus.DISCONNECTED);
375
+ this._tryToReconnect();
376
+ }
377
+ }
378
+ }, constants_1.WS_PING_TIMEOUT).unref();
379
+ ws.ping();
380
+ this._debugFn("> PING");
381
+ isWaitingForPong = true;
382
+ }, constants_1.WS_PING_INTERVAL).unref());
383
+ }
384
+ }
385
+ exports.WsConnection = WsConnection;
386
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ws-connection/index.ts"],"names":[],"mappings":";;;AAEA,2BAA6C;AAC7C,mCAQiB;AACjB,mCAA4C;AAC5C,2CAAiH;AAEjH,IAAK,kBAKJ;AALD,WAAK,kBAAkB;IACnB,2EAAY,CAAA;IACZ,uEAAU,CAAA;IACV,qEAAS,CAAA;IACT,+DAAM,CAAA;AACV,CAAC,EALI,kBAAkB,KAAlB,kBAAkB,QAKtB;AAqCD,0DAA0D;AAC1D,4GAA4G;AAC5G,MAAM,iBAAiB,GAAG,CAAC,EAAa,EAAQ,EAAE;IAC9C,IAAI,EAAE,CAAC,UAAU,KAAK,EAAE,CAAC,UAAU,EAAE,CAAC;QAClC,EAAE,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;SAAM,CAAC;QACJ,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE;YACjB,EAAE,CAAC,KAAK,EAAE,CAAC;QACf,CAAC,CAAC,CAAC;IACP,CAAC;AACL,CAAC,CAAC;AAEF,MAAa,YAAY;IA2BrB,YAAY,QAAgB,EAAE,OAA4B;QAXlD,YAAO,GAAwB,IAAI,CAAC;QACpC,oBAAe,GAAG,KAAK,CAAC;QACxB,kBAAa,GAA0C,IAAI,CAAC;QAC5D,yBAAoB,GAAG,CAAC,CAAC;QACzB,yBAAoB,GAAwB,IAAI,CAAC,CAAC,wDAAwD;QAC1G,wBAAmB,GAAuB,kBAAkB,CAAC,YAAY,CAAC;QAC1E,kBAAa,GAAqB,IAAI,CAAC;QACvC,yBAAoB,GAA8B,IAAI,CAAC;QACvD,eAAU,GAAG,CA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AC;oBAEzB,IAAI,CAAC,oBAAoB,EAAE,CAAC;oBAE5B,IAAI,CAAC,QAAQ,CAAC,iBAAiB,IAAI,CAAC,oBAAoB,iBAAiB,2BAAe,IAAI,CAAC,CAAC;oBAE9F,IAAI,IAAI,CAAC,oBAAoB,IAAI,wCAA4B,EAAE,CAAC;wBAC5D,IAAI,CAAC,kBAAkB,CACnB,0CAA0C,IAAI,CAAC,oBAAoB,wBAAwB,EAC3F,kBAAkB,CAAC,YAAY,CAClC,CAAC;wBACF,IAAI,CAAC,eAAe,EAAE,CAAC;oBAC3B,CAAC;gBACL,CAAC;YACL,CAAC,EAAE,2BAAe,CAAC,CAAC,KAAK,EAAE,CAAC;YAE5B,EAAE,CAAC,IAAI,EAAE,CAAC;YAEV,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAExB,gBAAgB,GAAG,IAAI,CAAC;QAC5B,CAAC,EAAE,4BAAgB,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;IAClC,CAAC;CACJ;AAveD,oCAueC"}
@@ -0,0 +1,6 @@
1
+ export declare const exponentiallyWait: ({ baseDelay, attempt, factor, jitter, }?: {
2
+ baseDelay?: number | undefined;
3
+ attempt?: number | undefined;
4
+ factor?: number | undefined;
5
+ jitter?: number | undefined;
6
+ }) => Promise<void>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.exponentiallyWait = void 0;
4
+ const exponentiallyWait = ({ baseDelay = 500, attempt = 0, factor = 2, jitter = 100, } = {}) => {
5
+ const delay = Math.round(baseDelay * factor ** attempt + Math.random() * jitter);
6
+ return new Promise(resolve => setTimeout(resolve, delay).unref());
7
+ };
8
+ exports.exponentiallyWait = exponentiallyWait;
9
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/ws-connection/utils.ts"],"names":[],"mappings":";;;AAAO,MAAM,iBAAiB,GAAG,CAAC,EAC9B,SAAS,GAAG,GAAG,EACf,OAAO,GAAG,CAAC,EACX,MAAM,GAAG,CAAC,EACV,MAAM,GAAG,GAAG,MACgE,EAAE,EAAiB,EAAE;IACjG,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,MAAM,IAAI,OAAO,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC;IAEjF,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;AACtE,CAAC,CAAC;AATW,QAAA,iBAAiB,qBAS5B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testplane",
3
- "version": "8.42.6",
3
+ "version": "8.44.0",
4
4
  "description": "Tests framework based on mocha and wdio",
5
5
  "main": "build/src/index.js",
6
6
  "files": [
@@ -72,7 +72,7 @@
72
72
  "@testplane/devtools": "8.32.5",
73
73
  "@testplane/wdio-protocols": "9.4.7",
74
74
  "@testplane/wdio-utils": "9.5.4",
75
- "@testplane/webdriverio": "9.5.24",
75
+ "@testplane/webdriverio": "9.5.25",
76
76
  "@vitest/spy": "2.1.4",
77
77
  "buffer-crc32": "1.0.0",
78
78
  "chalk": "2.4.2",
@@ -125,7 +125,7 @@
125
125
  "@rrweb/record": "2.0.0-alpha.18",
126
126
  "@sinonjs/fake-timers": "10.3.0",
127
127
  "@swc/core": "1.13.3",
128
- "@testplane/wdio-types": "9.5.4",
128
+ "@testplane/wdio-types": "9.5.5",
129
129
  "@types/babel__code-frame": "7.0.6",
130
130
  "@types/browserify": "12.0.40",
131
131
  "@types/chai": "4.3.4",
@@ -139,7 +139,7 @@
139
139
  "@types/lodash": "4.14.191",
140
140
  "@types/micromatch": "4.0.9",
141
141
  "@types/mocha": "10.0.1",
142
- "@types/node": "18.19.3",
142
+ "@types/node": "20.19.39",
143
143
  "@types/proper-lockfile": "4.1.4",
144
144
  "@types/proxyquire": "1.3.28",
145
145
  "@types/set-cookie-parser": "2.4.10",