webdriver 7.14.1 → 7.16.7
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.js +5 -5
- package/build/index.js +11 -11
- package/build/request/browser.js +2 -2
- package/build/request/index.js +4 -4
- package/build/utils.js +7 -7
- package/package.json +8 -8
package/build/command.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const logger_1 = __importDefault(require("@wdio/logger"));
|
|
7
7
|
const utils_1 = require("@wdio/utils");
|
|
8
8
|
const factory_1 = __importDefault(require("./request/factory"));
|
|
9
|
-
const log = logger_1.default('webdriver');
|
|
9
|
+
const log = (0, logger_1.default)('webdriver');
|
|
10
10
|
function default_1(method, endpointUri, commandInfo, doubleEncodeVariables = false) {
|
|
11
11
|
const { command, ref, parameters, variables = [], isHubCommand = false } = commandInfo;
|
|
12
12
|
return function protocolCommand(...args) {
|
|
@@ -40,7 +40,7 @@ function default_1(method, endpointUri, commandInfo, doubleEncodeVariables = fal
|
|
|
40
40
|
for (const [it, arg] of Object.entries(args)) {
|
|
41
41
|
const i = parseInt(it, 10);
|
|
42
42
|
const commandParam = commandParams[i];
|
|
43
|
-
if (!utils_1.isValidParameter(arg, commandParam.type)) {
|
|
43
|
+
if (!(0, utils_1.isValidParameter)(arg, commandParam.type)) {
|
|
44
44
|
/**
|
|
45
45
|
* ignore if argument is not required
|
|
46
46
|
*/
|
|
@@ -48,8 +48,8 @@ function default_1(method, endpointUri, commandInfo, doubleEncodeVariables = fal
|
|
|
48
48
|
continue;
|
|
49
49
|
}
|
|
50
50
|
const actual = commandParam.type.endsWith('[]')
|
|
51
|
-
? `(${(Array.isArray(arg) ? arg : [arg]).map((a) => utils_1.getArgumentType(a))})[]`
|
|
52
|
-
: utils_1.getArgumentType(arg);
|
|
51
|
+
? `(${(Array.isArray(arg) ? arg : [arg]).map((a) => (0, utils_1.getArgumentType)(a))})[]`
|
|
52
|
+
: (0, utils_1.getArgumentType)(arg);
|
|
53
53
|
throw new Error(`Malformed type for "${commandParam.name}" parameter of command ${command}\n` +
|
|
54
54
|
`Expected: ${commandParam.type}\n` +
|
|
55
55
|
`Actual: ${actual}` +
|
|
@@ -70,7 +70,7 @@ function default_1(method, endpointUri, commandInfo, doubleEncodeVariables = fal
|
|
|
70
70
|
}
|
|
71
71
|
const request = factory_1.default.getInstance(method, endpoint, body, isHubCommand);
|
|
72
72
|
this.emit('command', { method, endpoint, body });
|
|
73
|
-
log.info('COMMAND', utils_1.commandCallStructure(command, args));
|
|
73
|
+
log.info('COMMAND', (0, utils_1.commandCallStructure)(command, args));
|
|
74
74
|
return request.makeRequest(this.options, this.sessionId).then((result) => {
|
|
75
75
|
if (result.value != null) {
|
|
76
76
|
log.info('RESULT', /screenshot|recording/i.test(command)
|
package/build/index.js
CHANGED
|
@@ -24,10 +24,10 @@ const constants_1 = require("./constants");
|
|
|
24
24
|
Object.defineProperty(exports, "DEFAULTS", { enumerable: true, get: function () { return constants_1.DEFAULTS; } });
|
|
25
25
|
const utils_2 = require("./utils");
|
|
26
26
|
Object.defineProperty(exports, "getPrototype", { enumerable: true, get: function () { return utils_2.getPrototype; } });
|
|
27
|
-
const log = logger_1.default('webdriver');
|
|
27
|
+
const log = (0, logger_1.default)('webdriver');
|
|
28
28
|
class WebDriver {
|
|
29
29
|
static async newSession(options, modifier, userPrototype = {}, customCommandWrapper) {
|
|
30
|
-
const params = config_1.validateConfig(constants_1.DEFAULTS, options);
|
|
30
|
+
const params = (0, config_1.validateConfig)(constants_1.DEFAULTS, options);
|
|
31
31
|
if (!options.logLevels || !options.logLevels.webdriver) {
|
|
32
32
|
logger_1.default.setLevel('webdriver', params.logLevel);
|
|
33
33
|
}
|
|
@@ -55,12 +55,12 @@ class WebDriver {
|
|
|
55
55
|
params.path = directConnectPath;
|
|
56
56
|
}
|
|
57
57
|
const requestedCapabilities = { ...params.capabilities };
|
|
58
|
-
const { sessionId, capabilities } = await utils_2.startWebDriverSession(params);
|
|
59
|
-
const environment = utils_1.sessionEnvironmentDetector({ capabilities, requestedCapabilities });
|
|
60
|
-
const environmentPrototype = utils_2.getEnvironmentVars(environment);
|
|
61
|
-
const protocolCommands = utils_2.getPrototype(environment);
|
|
58
|
+
const { sessionId, capabilities } = await (0, utils_2.startWebDriverSession)(params);
|
|
59
|
+
const environment = (0, utils_1.sessionEnvironmentDetector)({ capabilities, requestedCapabilities });
|
|
60
|
+
const environmentPrototype = (0, utils_2.getEnvironmentVars)(environment);
|
|
61
|
+
const protocolCommands = (0, utils_2.getPrototype)(environment);
|
|
62
62
|
const prototype = { ...protocolCommands, ...environmentPrototype, ...userPrototype };
|
|
63
|
-
const monad = utils_1.webdriverMonad({ ...params, requestedCapabilities }, modifier, prototype);
|
|
63
|
+
const monad = (0, utils_1.webdriverMonad)({ ...params, requestedCapabilities }, modifier, prototype);
|
|
64
64
|
return monad(sessionId, customCommandWrapper);
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
@@ -80,10 +80,10 @@ class WebDriver {
|
|
|
80
80
|
options.hostname = options.hostname || constants_1.DEFAULTS.hostname.default;
|
|
81
81
|
options.port = options.port || constants_1.DEFAULTS.port.default;
|
|
82
82
|
options.path = options.path || constants_1.DEFAULTS.path.default;
|
|
83
|
-
const environmentPrototype = utils_2.getEnvironmentVars(options);
|
|
84
|
-
const protocolCommands = utils_2.getPrototype(options);
|
|
83
|
+
const environmentPrototype = (0, utils_2.getEnvironmentVars)(options);
|
|
84
|
+
const protocolCommands = (0, utils_2.getPrototype)(options);
|
|
85
85
|
const prototype = { ...protocolCommands, ...environmentPrototype, ...userPrototype };
|
|
86
|
-
const monad = utils_1.webdriverMonad(options, modifier, prototype);
|
|
86
|
+
const monad = (0, utils_1.webdriverMonad)(options, modifier, prototype);
|
|
87
87
|
return monad(options.sessionId, commandWrapper);
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
@@ -98,7 +98,7 @@ class WebDriver {
|
|
|
98
98
|
...instance.options,
|
|
99
99
|
capabilities: instance.requestedCapabilities
|
|
100
100
|
};
|
|
101
|
-
const { sessionId, capabilities } = await utils_2.startWebDriverSession(params);
|
|
101
|
+
const { sessionId, capabilities } = await (0, utils_2.startWebDriverSession)(params);
|
|
102
102
|
instance.sessionId = sessionId;
|
|
103
103
|
instance.capabilities = capabilities;
|
|
104
104
|
return sessionId;
|
package/build/request/browser.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const logger_1 = __importDefault(require("@wdio/logger"));
|
|
7
7
|
const index_1 = __importDefault(require("./index"));
|
|
8
8
|
const ky_1 = __importDefault(require("ky"));
|
|
9
|
-
const log = logger_1.default('webdriver');
|
|
9
|
+
const log = (0, logger_1.default)('webdriver');
|
|
10
10
|
const UNSUPPORTED_OPTS = [
|
|
11
11
|
'agent',
|
|
12
12
|
'responseType',
|
|
@@ -37,7 +37,7 @@ class BrowserRequest extends index_1.default {
|
|
|
37
37
|
Authorization: `Basic ${encodedAuth}`
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
-
const res = await ky_1.default(url, kyOptions);
|
|
40
|
+
const res = await (0, ky_1.default)(url, kyOptions);
|
|
41
41
|
return {
|
|
42
42
|
statusCode: res.status,
|
|
43
43
|
body: await res.json(),
|
package/build/request/index.js
CHANGED
|
@@ -20,7 +20,7 @@ const DEFAULT_HEADERS = {
|
|
|
20
20
|
'Accept': 'application/json',
|
|
21
21
|
'User-Agent': 'webdriver/' + pkg.version
|
|
22
22
|
};
|
|
23
|
-
const log = logger_1.default('webdriver');
|
|
23
|
+
const log = (0, logger_1.default)('webdriver');
|
|
24
24
|
class WebDriverRequest extends events_1.EventEmitter {
|
|
25
25
|
constructor(method, endpoint, body, isHubCommand = false) {
|
|
26
26
|
super();
|
|
@@ -107,7 +107,7 @@ class WebDriverRequest extends events_1.EventEmitter {
|
|
|
107
107
|
async _request(fullRequestOptions, transformResponse, totalRetryCount = 0, retryCount = 0) {
|
|
108
108
|
log.info(`[${fullRequestOptions.method}] ${fullRequestOptions.url.href}`);
|
|
109
109
|
if (fullRequestOptions.json && Object.keys(fullRequestOptions.json).length) {
|
|
110
|
-
log.info('DATA', utils_1.transformCommandLogResult(fullRequestOptions.json));
|
|
110
|
+
log.info('DATA', (0, utils_1.transformCommandLogResult)(fullRequestOptions.json));
|
|
111
111
|
}
|
|
112
112
|
const { url, ...requestLibOptions } = fullRequestOptions;
|
|
113
113
|
let response = await this._libRequest(url, requestLibOptions)
|
|
@@ -154,7 +154,7 @@ class WebDriverRequest extends events_1.EventEmitter {
|
|
|
154
154
|
if (typeof transformResponse === 'function') {
|
|
155
155
|
response = transformResponse(response, fullRequestOptions);
|
|
156
156
|
}
|
|
157
|
-
const error = utils_2.getErrorFromResponseBody(response.body);
|
|
157
|
+
const error = (0, utils_2.getErrorFromResponseBody)(response.body);
|
|
158
158
|
/**
|
|
159
159
|
* retry connection refused errors
|
|
160
160
|
*/
|
|
@@ -178,7 +178,7 @@ class WebDriverRequest extends events_1.EventEmitter {
|
|
|
178
178
|
/**
|
|
179
179
|
* Resolve only if successful response
|
|
180
180
|
*/
|
|
181
|
-
if (utils_2.isSuccessfulResponse(response.statusCode, response.body)) {
|
|
181
|
+
if ((0, utils_2.isSuccessfulResponse)(response.statusCode, response.body)) {
|
|
182
182
|
this.emit('response', { result: response.body });
|
|
183
183
|
return response.body;
|
|
184
184
|
}
|
package/build/utils.js
CHANGED
|
@@ -10,7 +10,7 @@ const protocols_1 = require("@wdio/protocols");
|
|
|
10
10
|
const factory_1 = __importDefault(require("./request/factory"));
|
|
11
11
|
const command_1 = __importDefault(require("./command"));
|
|
12
12
|
const constants_1 = require("./constants");
|
|
13
|
-
const log = logger_1.default('webdriver');
|
|
13
|
+
const log = (0, logger_1.default)('webdriver');
|
|
14
14
|
const BROWSER_DRIVER_ERRORS = [
|
|
15
15
|
'unknown command: wd/hub/session',
|
|
16
16
|
'HTTP method not allowed',
|
|
@@ -38,7 +38,7 @@ async function startWebDriverSession(params) {
|
|
|
38
38
|
throw new Error(`Invalid or unsupported WebDriver capabilities found ("${invalidWebDriverCaps.join('", "')}"). ` +
|
|
39
39
|
'Ensure to only use valid W3C WebDriver capabilities (see https://w3c.github.io/webdriver/#capabilities).' +
|
|
40
40
|
'If you run your tests on a remote vendor, like Sauce Labs or BrowserStack, make sure that you put them ' +
|
|
41
|
-
'into vendor specific capabilities, e.g. "sauce:options" or "
|
|
41
|
+
'into vendor specific capabilities, e.g. "sauce:options" or "bstack:options". Please reach out to ' +
|
|
42
42
|
'to your vendor support team if you have further questions.');
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -67,7 +67,7 @@ async function startWebDriverSession(params) {
|
|
|
67
67
|
}
|
|
68
68
|
catch (err) {
|
|
69
69
|
log.error(err);
|
|
70
|
-
const message = exports.getSessionError(err, params);
|
|
70
|
+
const message = (0, exports.getSessionError)(err, params);
|
|
71
71
|
throw new Error('Failed to create session.\n' + message);
|
|
72
72
|
}
|
|
73
73
|
const sessionId = response.value.sessionId || response.sessionId;
|
|
@@ -140,19 +140,19 @@ exports.isSuccessfulResponse = isSuccessfulResponse;
|
|
|
140
140
|
*/
|
|
141
141
|
function getPrototype({ isW3C, isChrome, isFirefox, isMobile, isSauce, isSeleniumStandalone }) {
|
|
142
142
|
const prototype = {};
|
|
143
|
-
const ProtocolCommands = lodash_merge_1.default(
|
|
143
|
+
const ProtocolCommands = (0, lodash_merge_1.default)(
|
|
144
144
|
/**
|
|
145
145
|
* if mobile apply JSONWire and WebDriver protocol because
|
|
146
146
|
* some legacy JSONWire commands are still used in Appium
|
|
147
147
|
* (e.g. set/get geolocation)
|
|
148
148
|
*/
|
|
149
149
|
isMobile
|
|
150
|
-
? lodash_merge_1.default({}, protocols_1.JsonWProtocol, protocols_1.WebDriverProtocol)
|
|
150
|
+
? (0, lodash_merge_1.default)({}, protocols_1.JsonWProtocol, protocols_1.WebDriverProtocol)
|
|
151
151
|
: isW3C ? protocols_1.WebDriverProtocol : protocols_1.JsonWProtocol,
|
|
152
152
|
/**
|
|
153
153
|
* only apply mobile protocol if session is actually for mobile
|
|
154
154
|
*/
|
|
155
|
-
isMobile ? lodash_merge_1.default({}, protocols_1.MJsonWProtocol, protocols_1.AppiumProtocol) : {},
|
|
155
|
+
isMobile ? (0, lodash_merge_1.default)({}, protocols_1.MJsonWProtocol, protocols_1.AppiumProtocol) : {},
|
|
156
156
|
/**
|
|
157
157
|
* only apply special Chrome commands if session is using Chrome
|
|
158
158
|
*/
|
|
@@ -172,7 +172,7 @@ function getPrototype({ isW3C, isChrome, isFirefox, isMobile, isSauce, isSeleniu
|
|
|
172
172
|
isSeleniumStandalone ? protocols_1.SeleniumProtocol : {});
|
|
173
173
|
for (const [endpoint, methods] of Object.entries(ProtocolCommands)) {
|
|
174
174
|
for (const [method, commandData] of Object.entries(methods)) {
|
|
175
|
-
prototype[commandData.command] = { value: command_1.default(method, endpoint, commandData, isSeleniumStandalone) };
|
|
175
|
+
prototype[commandData.command] = { value: (0, command_1.default)(method, endpoint, commandData, isSeleniumStandalone) };
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
return prototype;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webdriver",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.16.7",
|
|
4
4
|
"description": "A Node.js bindings implementation for the W3C WebDriver and Mobile JSONWire Protocol",
|
|
5
5
|
"author": "Christian Bromann <christian@saucelabs.com>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/webdriver",
|
|
@@ -25,15 +25,15 @@
|
|
|
25
25
|
"@types/lodash.merge": "^4.6.6"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@types/node": "^
|
|
29
|
-
"@wdio/config": "7.
|
|
30
|
-
"@wdio/logger": "7.
|
|
31
|
-
"@wdio/protocols": "7.
|
|
32
|
-
"@wdio/types": "7.
|
|
33
|
-
"@wdio/utils": "7.
|
|
28
|
+
"@types/node": "^16.11.1",
|
|
29
|
+
"@wdio/config": "7.16.3",
|
|
30
|
+
"@wdio/logger": "7.16.0",
|
|
31
|
+
"@wdio/protocols": "7.16.7",
|
|
32
|
+
"@wdio/types": "7.16.3",
|
|
33
|
+
"@wdio/utils": "7.16.3",
|
|
34
34
|
"got": "^11.0.2",
|
|
35
35
|
"ky": "^0.28.5",
|
|
36
36
|
"lodash.merge": "^4.6.1"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "6c51be2984c51b4442cc185e2fe4579179c6da03"
|
|
39
39
|
}
|