@midscene/webdriver 1.17.1 → 1.17.2-beta-20261027024537.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.
- package/dist/es/index.mjs +10 -4
- package/dist/lib/index.js +12 -3
- package/dist/types/index.d.ts +8 -0
- package/package.json +2 -2
package/dist/es/index.mjs
CHANGED
|
@@ -157,6 +157,12 @@ class WebDriverRequestError extends Error {
|
|
|
157
157
|
this.name = 'WebDriverRequestError';
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
+
class WebDriverRequestTimeoutError extends WebDriverRequestError {
|
|
161
|
+
constructor(timeout){
|
|
162
|
+
super(`Request timeout after ${timeout}ms`);
|
|
163
|
+
this.name = 'WebDriverRequestTimeoutError';
|
|
164
|
+
}
|
|
165
|
+
}
|
|
160
166
|
async function makeWebDriverRequest(baseUrl, method, endpoint, data, timeout = 30000) {
|
|
161
167
|
const url = `${baseUrl}${endpoint}`;
|
|
162
168
|
debugRequest(`${method} ${endpoint}${data ? ` with data: ${JSON.stringify(data)}` : ''}`);
|
|
@@ -172,7 +178,6 @@ async function makeWebDriverRequest(baseUrl, method, endpoint, data, timeout = 3
|
|
|
172
178
|
body: data ? JSON.stringify(data) : void 0,
|
|
173
179
|
signal: controller.signal
|
|
174
180
|
});
|
|
175
|
-
clearTimeout(timeoutId);
|
|
176
181
|
let responseData;
|
|
177
182
|
const contentType = response.headers.get('content-type');
|
|
178
183
|
if (contentType?.includes('application/json')) responseData = await response.json();
|
|
@@ -186,11 +191,12 @@ async function makeWebDriverRequest(baseUrl, method, endpoint, data, timeout = 3
|
|
|
186
191
|
}
|
|
187
192
|
return responseData;
|
|
188
193
|
} catch (error) {
|
|
189
|
-
clearTimeout(timeoutId);
|
|
190
194
|
if (error instanceof WebDriverRequestError) throw error;
|
|
191
|
-
if (error instanceof Error && 'AbortError' === error.name) throw new
|
|
195
|
+
if (error instanceof Error && 'AbortError' === error.name) throw new WebDriverRequestTimeoutError(timeout);
|
|
192
196
|
debugRequest(`Request failed: ${error}`);
|
|
193
197
|
throw new WebDriverRequestError(`Request failed: ${error}`);
|
|
198
|
+
} finally{
|
|
199
|
+
clearTimeout(timeoutId);
|
|
194
200
|
}
|
|
195
201
|
}
|
|
196
202
|
function WebDriverClient_define_property(obj, key, value) {
|
|
@@ -320,4 +326,4 @@ class WebDriverClient {
|
|
|
320
326
|
debugClient('Initialized WebDriver client');
|
|
321
327
|
}
|
|
322
328
|
}
|
|
323
|
-
export { BaseServiceManager, WDAManager, WebDriverClient, WebDriverRequestError, makeWebDriverRequest, normalizeWebDriverBaseUrl };
|
|
329
|
+
export { BaseServiceManager, WDAManager, WebDriverClient, WebDriverRequestError, WebDriverRequestTimeoutError, makeWebDriverRequest, normalizeWebDriverBaseUrl };
|
package/dist/lib/index.js
CHANGED
|
@@ -24,6 +24,7 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
WebDriverRequestTimeoutError: ()=>WebDriverRequestTimeoutError,
|
|
27
28
|
normalizeWebDriverBaseUrl: ()=>normalizeWebDriverBaseUrl,
|
|
28
29
|
WDAManager: ()=>WDAManager,
|
|
29
30
|
makeWebDriverRequest: ()=>makeWebDriverRequest,
|
|
@@ -190,6 +191,12 @@ class WebDriverRequestError extends Error {
|
|
|
190
191
|
this.name = 'WebDriverRequestError';
|
|
191
192
|
}
|
|
192
193
|
}
|
|
194
|
+
class WebDriverRequestTimeoutError extends WebDriverRequestError {
|
|
195
|
+
constructor(timeout){
|
|
196
|
+
super(`Request timeout after ${timeout}ms`);
|
|
197
|
+
this.name = 'WebDriverRequestTimeoutError';
|
|
198
|
+
}
|
|
199
|
+
}
|
|
193
200
|
async function makeWebDriverRequest(baseUrl, method, endpoint, data, timeout = 30000) {
|
|
194
201
|
const url = `${baseUrl}${endpoint}`;
|
|
195
202
|
debugRequest(`${method} ${endpoint}${data ? ` with data: ${JSON.stringify(data)}` : ''}`);
|
|
@@ -205,7 +212,6 @@ async function makeWebDriverRequest(baseUrl, method, endpoint, data, timeout = 3
|
|
|
205
212
|
body: data ? JSON.stringify(data) : void 0,
|
|
206
213
|
signal: controller.signal
|
|
207
214
|
});
|
|
208
|
-
clearTimeout(timeoutId);
|
|
209
215
|
let responseData;
|
|
210
216
|
const contentType = response.headers.get('content-type');
|
|
211
217
|
if (contentType?.includes('application/json')) responseData = await response.json();
|
|
@@ -219,11 +225,12 @@ async function makeWebDriverRequest(baseUrl, method, endpoint, data, timeout = 3
|
|
|
219
225
|
}
|
|
220
226
|
return responseData;
|
|
221
227
|
} catch (error) {
|
|
222
|
-
clearTimeout(timeoutId);
|
|
223
228
|
if (error instanceof WebDriverRequestError) throw error;
|
|
224
|
-
if (error instanceof Error && 'AbortError' === error.name) throw new
|
|
229
|
+
if (error instanceof Error && 'AbortError' === error.name) throw new WebDriverRequestTimeoutError(timeout);
|
|
225
230
|
debugRequest(`Request failed: ${error}`);
|
|
226
231
|
throw new WebDriverRequestError(`Request failed: ${error}`);
|
|
232
|
+
} finally{
|
|
233
|
+
clearTimeout(timeoutId);
|
|
227
234
|
}
|
|
228
235
|
}
|
|
229
236
|
function WebDriverClient_define_property(obj, key, value) {
|
|
@@ -357,6 +364,7 @@ exports.BaseServiceManager = __webpack_exports__.BaseServiceManager;
|
|
|
357
364
|
exports.WDAManager = __webpack_exports__.WDAManager;
|
|
358
365
|
exports.WebDriverClient = __webpack_exports__.WebDriverClient;
|
|
359
366
|
exports.WebDriverRequestError = __webpack_exports__.WebDriverRequestError;
|
|
367
|
+
exports.WebDriverRequestTimeoutError = __webpack_exports__.WebDriverRequestTimeoutError;
|
|
360
368
|
exports.makeWebDriverRequest = __webpack_exports__.makeWebDriverRequest;
|
|
361
369
|
exports.normalizeWebDriverBaseUrl = __webpack_exports__.normalizeWebDriverBaseUrl;
|
|
362
370
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
@@ -364,6 +372,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
364
372
|
"WDAManager",
|
|
365
373
|
"WebDriverClient",
|
|
366
374
|
"WebDriverRequestError",
|
|
375
|
+
"WebDriverRequestTimeoutError",
|
|
367
376
|
"makeWebDriverRequest",
|
|
368
377
|
"normalizeWebDriverBaseUrl"
|
|
369
378
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
package/dist/types/index.d.ts
CHANGED
|
@@ -134,6 +134,14 @@ export declare interface WebDriverRequestOptions {
|
|
|
134
134
|
timeout?: number;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
/**
|
|
138
|
+
* The HTTP request exceeded its timeout, including reading the response body.
|
|
139
|
+
* Remains a WebDriverRequestError for callers that catch transport failures.
|
|
140
|
+
*/
|
|
141
|
+
export declare class WebDriverRequestTimeoutError extends WebDriverRequestError {
|
|
142
|
+
constructor(timeout: number);
|
|
143
|
+
}
|
|
144
|
+
|
|
137
145
|
export declare interface WebDriverServiceManager {
|
|
138
146
|
start(): Promise<void>;
|
|
139
147
|
stop(): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/webdriver",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.2-beta-20261027024537.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/midscene.git",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"types": "dist/types/index.d.ts",
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"node-fetch": "^3.3.2",
|
|
15
|
-
"@midscene/shared": "1.17.
|
|
15
|
+
"@midscene/shared": "1.17.2-beta-20261027024537.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@rslib/core": "^0.18.3",
|