webdriver 8.29.3 → 8.30.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/build/command.d.ts +1 -7
- package/build/command.d.ts.map +1 -1
- package/build/command.js +8 -5
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +28 -11
- package/package.json +6 -6
package/build/command.d.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import type { ChildProcess } from 'node:child_process';
|
|
3
1
|
import { type CommandEndpoint } from '@wdio/protocols';
|
|
4
2
|
import type { WebDriverResponse } from './request/index.js';
|
|
5
3
|
import type { BaseClient, BidiResponses } from './types.js';
|
|
6
|
-
|
|
7
|
-
_driverProcess?: ChildProcess;
|
|
8
|
-
}
|
|
9
|
-
export default function (method: string, endpointUri: string, commandInfo: CommandEndpoint, doubleEncodeVariables?: boolean): (this: BaseClientWithEventHandler, ...args: any[]) => Promise<WebDriverResponse | BidiResponses | void>;
|
|
10
|
-
export {};
|
|
4
|
+
export default function (method: string, endpointUri: string, commandInfo: CommandEndpoint, doubleEncodeVariables?: boolean): (this: BaseClient, ...args: any[]) => Promise<WebDriverResponse | BidiResponses | void>;
|
|
11
5
|
//# sourceMappingURL=command.d.ts.map
|
package/build/command.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,eAAe,EACvB,MAAM,iBAAiB,CAAA;AAGxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAgB,aAAa,EAAE,MAAM,YAAY,CAAA;AAKzE,MAAM,CAAC,OAAO,WACV,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,eAAe,EAC5B,qBAAqB,UAAQ,UAIgB,UAAU,WAAW,GAAG,EAAE,KAAG,QAAQ,iBAAiB,GAAG,aAAa,GAAG,IAAI,CAAC,CA0J9H"}
|
package/build/command.js
CHANGED
|
@@ -89,6 +89,9 @@ export default function (method, endpointUri, commandInfo, doubleEncodeVariables
|
|
|
89
89
|
request.on('performance', (...args) => this.emit('request.performance', ...args));
|
|
90
90
|
this.emit('command', { method, endpoint, body });
|
|
91
91
|
log.info('COMMAND', commandCallStructure(command, args));
|
|
92
|
+
/**
|
|
93
|
+
* use then here so we can better unit test what happens before and after the request
|
|
94
|
+
*/
|
|
92
95
|
return request.makeRequest(this.options, this.sessionId).then((result) => {
|
|
93
96
|
if (typeof result.value !== 'undefined') {
|
|
94
97
|
let resultLog = result.value;
|
|
@@ -102,16 +105,16 @@ export default function (method, endpointUri, commandInfo, doubleEncodeVariables
|
|
|
102
105
|
}
|
|
103
106
|
this.emit('result', { method, endpoint, body, result });
|
|
104
107
|
if (command === 'deleteSession') {
|
|
108
|
+
const shutdownDriver = body.deleteSessionOpts?.shutdownDriver !== false;
|
|
105
109
|
/**
|
|
106
110
|
* kill driver process if there is one
|
|
107
111
|
*/
|
|
108
|
-
if (this.
|
|
109
|
-
log.info(`Kill
|
|
110
|
-
const killedSuccessfully =
|
|
112
|
+
if (shutdownDriver && 'wdio:driverPID' in this.capabilities && this.capabilities['wdio:driverPID']) {
|
|
113
|
+
log.info(`Kill driver process with PID ${this.capabilities['wdio:driverPID']}`);
|
|
114
|
+
const killedSuccessfully = process.kill(this.capabilities['wdio:driverPID'], 'SIGKILL');
|
|
111
115
|
if (!killedSuccessfully) {
|
|
112
|
-
log.warn('Failed to kill driver process,
|
|
116
|
+
log.warn('Failed to kill driver process, manually clean-up might be required');
|
|
113
117
|
}
|
|
114
|
-
this._driverProcess = undefined;
|
|
115
118
|
setTimeout(() => {
|
|
116
119
|
/**
|
|
117
120
|
* clear up potential leaked TLS Socket handles
|
package/build/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export default class WebDriver {
|
|
|
16
16
|
* @param {object} instance the object we get from a new browser session.
|
|
17
17
|
* @returns {string} the new session id of the browser
|
|
18
18
|
*/
|
|
19
|
-
static reloadSession(instance: Client): Promise<string>;
|
|
19
|
+
static reloadSession(instance: Client, newCapabilities?: WebdriverIO.Capabilities): Promise<string>;
|
|
20
20
|
static get WebDriver(): typeof WebDriver;
|
|
21
21
|
}
|
|
22
22
|
/**
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAyB,YAAY,EAAE,kBAAkB,EAAsD,MAAM,YAAY,CAAA;AACxI,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAgB,MAAM,YAAY,CAAA;AAIrE,MAAM,CAAC,OAAO,OAAO,SAAS;WACb,UAAU,CACnB,OAAO,EAAE,OAAO,CAAC,SAAS,EAC1B,QAAQ,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAClC,aAAa,KAAK,EAClB,oBAAoB,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAC/C,OAAO,CAAC,MAAM,CAAC;IAqElB;;OAEG;IACH,MAAM,CAAC,eAAe,CAClB,OAAO,CAAC,EAAE,aAAa,EACvB,QAAQ,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAClC,aAAa,KAAK,EAClB,cAAc,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GACzC,MAAM;IA+CT;;;;;;OAMG;WACU,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,WAAW,CAAC,YAAY;IA4BvF,MAAM,KAAK,SAAS,qBAEnB;CACJ;AAED;;GAEG;AACH,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAA;AAC9D,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,OAAO,KAAK,KAAK,MAAM,sBAAsB,CAAA;AAC7C,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAA"}
|
package/build/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import logger from '@wdio/logger';
|
|
2
2
|
import { webdriverMonad, sessionEnvironmentDetector, startWebDriver } from '@wdio/utils';
|
|
3
3
|
import { validateConfig } from '@wdio/config';
|
|
4
|
+
import { deepmerge } from 'deepmerge-ts';
|
|
4
5
|
import command from './command.js';
|
|
5
6
|
import { DEFAULTS } from './constants.js';
|
|
6
7
|
import { startWebDriverSession, getPrototype, getEnvironmentVars, setupDirectConnect, initiateBidi, parseBidiMessage } from './utils.js';
|
|
@@ -20,9 +21,13 @@ export default class WebDriver {
|
|
|
20
21
|
const environment = sessionEnvironmentDetector({ capabilities, requestedCapabilities });
|
|
21
22
|
const environmentPrototype = getEnvironmentVars(environment);
|
|
22
23
|
const protocolCommands = getPrototype(environment);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
/**
|
|
25
|
+
* attach driver process to instance capabilities so we can kill the driver process
|
|
26
|
+
* even after attaching to this session
|
|
27
|
+
*/
|
|
28
|
+
if (driverProcess?.pid) {
|
|
29
|
+
capabilities['wdio:driverPID'] = driverProcess.pid;
|
|
30
|
+
}
|
|
26
31
|
/**
|
|
27
32
|
* initiate WebDriver Bidi
|
|
28
33
|
*/
|
|
@@ -35,7 +40,6 @@ export default class WebDriver {
|
|
|
35
40
|
...protocolCommands,
|
|
36
41
|
...environmentPrototype,
|
|
37
42
|
...userPrototype,
|
|
38
|
-
...driverPrototype,
|
|
39
43
|
...bidiPrototype
|
|
40
44
|
});
|
|
41
45
|
const client = monad(sessionId, customCommandWrapper);
|
|
@@ -109,14 +113,27 @@ export default class WebDriver {
|
|
|
109
113
|
* @param {object} instance the object we get from a new browser session.
|
|
110
114
|
* @returns {string} the new session id of the browser
|
|
111
115
|
*/
|
|
112
|
-
static async reloadSession(instance) {
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
static async reloadSession(instance, newCapabilities) {
|
|
117
|
+
const capabilities = deepmerge(instance.requestedCapabilities, newCapabilities || {});
|
|
118
|
+
const params = { ...instance.options, capabilities };
|
|
119
|
+
let driverProcess;
|
|
120
|
+
if (newCapabilities?.browserName) {
|
|
121
|
+
delete params.port;
|
|
122
|
+
delete params.hostname;
|
|
123
|
+
driverProcess = await startWebDriver(params);
|
|
124
|
+
}
|
|
125
|
+
const { sessionId, capabilities: newSessionCapabilities } = await startWebDriverSession(params);
|
|
126
|
+
/**
|
|
127
|
+
* attach driver process to instance capabilities so we can kill the driver process
|
|
128
|
+
* even after attaching to this session
|
|
129
|
+
*/
|
|
130
|
+
if (driverProcess?.pid) {
|
|
131
|
+
newSessionCapabilities['wdio:driverPID'] = driverProcess.pid;
|
|
132
|
+
}
|
|
133
|
+
instance.options.hostname = params.hostname;
|
|
134
|
+
instance.options.port = params.port;
|
|
118
135
|
instance.sessionId = sessionId;
|
|
119
|
-
instance.capabilities =
|
|
136
|
+
instance.capabilities = newSessionCapabilities;
|
|
120
137
|
return sessionId;
|
|
121
138
|
}
|
|
122
139
|
static get WebDriver() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webdriver",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.30.0",
|
|
4
4
|
"description": "A Node.js bindings implementation for the W3C WebDriver and Mobile JSONWire Protocol",
|
|
5
5
|
"author": "Christian Bromann <mail@bromann.dev>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/webdriver",
|
|
@@ -38,15 +38,15 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@types/node": "^20.1.0",
|
|
40
40
|
"@types/ws": "^8.5.3",
|
|
41
|
-
"@wdio/config": "8.
|
|
41
|
+
"@wdio/config": "8.30.0",
|
|
42
42
|
"@wdio/logger": "8.28.0",
|
|
43
|
-
"@wdio/protocols": "8.
|
|
44
|
-
"@wdio/types": "8.
|
|
45
|
-
"@wdio/utils": "8.
|
|
43
|
+
"@wdio/protocols": "8.29.7",
|
|
44
|
+
"@wdio/types": "8.30.0",
|
|
45
|
+
"@wdio/utils": "8.30.0",
|
|
46
46
|
"deepmerge-ts": "^5.1.0",
|
|
47
47
|
"got": "^12.6.1",
|
|
48
48
|
"ky": "^0.33.0",
|
|
49
49
|
"ws": "^8.8.0"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "033e2a91e97c9bd060eb70f2e4e412d382bec3af"
|
|
52
52
|
}
|