@appium/base-driver 10.2.1 → 10.2.2
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/lib/jsonwp-proxy/protocol-converter.d.ts +42 -78
- package/build/lib/jsonwp-proxy/protocol-converter.d.ts.map +1 -1
- package/build/lib/jsonwp-proxy/protocol-converter.js +87 -139
- package/build/lib/jsonwp-proxy/protocol-converter.js.map +1 -1
- package/build/lib/jsonwp-proxy/proxy.d.ts +1 -1
- package/build/lib/jsonwp-proxy/proxy.d.ts.map +1 -1
- package/build/lib/jsonwp-proxy/proxy.js +2 -2
- package/build/lib/jsonwp-proxy/proxy.js.map +1 -1
- package/lib/jsonwp-proxy/protocol-converter.ts +284 -0
- package/lib/jsonwp-proxy/proxy.js +1 -1
- package/package.json +2 -2
- package/lib/jsonwp-proxy/protocol-converter.js +0 -317
|
@@ -1,89 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import type { AppiumLogger, HTTPBody, ProxyResponse } from '@appium/types';
|
|
2
|
+
export type ProxyFunction = (url: string, method: string, body?: HTTPBody) => Promise<[ProxyResponse, HTTPBody]>;
|
|
3
|
+
export declare const COMMAND_URLS_CONFLICTS: readonly [{
|
|
4
|
+
readonly commandNames: readonly ["execute", "executeAsync"];
|
|
5
|
+
readonly jsonwpConverter: (url: string) => string;
|
|
6
|
+
readonly w3cConverter: (url: string) => string;
|
|
7
|
+
}, {
|
|
8
|
+
readonly commandNames: readonly ["getElementScreenshot"];
|
|
9
|
+
readonly jsonwpConverter: (url: string) => string;
|
|
10
|
+
readonly w3cConverter: (url: string) => string;
|
|
11
|
+
}, {
|
|
12
|
+
readonly commandNames: readonly ["getWindowHandles", "getWindowHandle"];
|
|
13
|
+
readonly jsonwpConverter: (url: string) => string;
|
|
14
|
+
readonly w3cConverter: (url: string) => string;
|
|
15
|
+
}, {
|
|
16
|
+
readonly commandNames: readonly ["getProperty"];
|
|
17
|
+
readonly jsonwpConverter: (w3cUrl: string) => string;
|
|
18
|
+
readonly w3cConverter: (jsonwpUrl: string) => string;
|
|
19
|
+
}];
|
|
20
|
+
export declare class ProtocolConverter {
|
|
15
21
|
proxyFunc: ProxyFunction;
|
|
16
|
-
_downstreamProtocol
|
|
17
|
-
|
|
18
|
-
get log(): import("@appium/types").AppiumLogger;
|
|
19
|
-
set downstreamProtocol(value: any);
|
|
20
|
-
get downstreamProtocol(): any;
|
|
21
|
-
/**
|
|
22
|
-
* W3C /timeouts can take as many as 3 timeout types at once, MJSONWP /timeouts only takes one
|
|
23
|
-
* at a time. So if we're using W3C and proxying to MJSONWP and there's more than one timeout type
|
|
24
|
-
* provided in the request, we need to do 3 proxies and combine the result
|
|
25
|
-
*
|
|
26
|
-
* @param {Object} body Request body
|
|
27
|
-
* @return {Object[]} Array of W3C + MJSONWP compatible timeout objects
|
|
28
|
-
*/
|
|
29
|
-
getTimeoutRequestObjects(body: any): any[];
|
|
30
|
-
/**
|
|
31
|
-
* Proxy an array of timeout objects and merge the result
|
|
32
|
-
* @param {string} url Endpoint url
|
|
33
|
-
* @param {string} method Endpoint method
|
|
34
|
-
* @param {import('@appium/types').HTTPBody} body Request body
|
|
35
|
-
* @returns {Promise<[import('@appium/types').ProxyResponse, import('@appium/types').HTTPBody]>}
|
|
36
|
-
*/
|
|
37
|
-
proxySetTimeouts(url: string, method: string, body: import("@appium/types").HTTPBody): Promise<[import("@appium/types").ProxyResponse, import("@appium/types").HTTPBody]>;
|
|
38
|
-
/**
|
|
39
|
-
*
|
|
40
|
-
* @param {string} url
|
|
41
|
-
* @param {string} method
|
|
42
|
-
* @param {import('@appium/types').HTTPBody} body
|
|
43
|
-
* @returns {Promise<[import('@appium/types').ProxyResponse, import('@appium/types').HTTPBody]>}
|
|
44
|
-
*/
|
|
45
|
-
proxySetWindow(url: string, method: string, body: import("@appium/types").HTTPBody): Promise<[import("@appium/types").ProxyResponse, import("@appium/types").HTTPBody]>;
|
|
22
|
+
private _downstreamProtocol;
|
|
23
|
+
private readonly _log;
|
|
46
24
|
/**
|
|
47
|
-
*
|
|
48
|
-
* @param
|
|
49
|
-
* @param {string} method
|
|
50
|
-
* @param {import('@appium/types').HTTPBody} body
|
|
51
|
-
* @returns {Promise<[import('@appium/types').ProxyResponse, import('@appium/types').HTTPBody]>}
|
|
25
|
+
* @param proxyFunc - Function to perform the actual proxy request
|
|
26
|
+
* @param log - Logger instance, or null to use the default
|
|
52
27
|
*/
|
|
53
|
-
|
|
28
|
+
constructor(proxyFunc: ProxyFunction, log?: AppiumLogger | null);
|
|
29
|
+
get log(): AppiumLogger;
|
|
30
|
+
set downstreamProtocol(value: string | null | undefined);
|
|
31
|
+
get downstreamProtocol(): string | null | undefined;
|
|
54
32
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* @param {string} method
|
|
58
|
-
* @param {import('@appium/types').HTTPBody} body
|
|
59
|
-
* @returns {Promise<[import('@appium/types').ProxyResponse, import('@appium/types').HTTPBody]>}
|
|
33
|
+
* Handle "crossing" endpoints for the case when upstream and downstream
|
|
34
|
+
* drivers operate different protocols.
|
|
60
35
|
*/
|
|
61
|
-
|
|
36
|
+
convertAndProxy(commandName: string, url: string, method: string, body?: HTTPBody): Promise<[ProxyResponse, HTTPBody]>;
|
|
62
37
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* @param {import('@appium/types').HTTPBody} body
|
|
67
|
-
* @returns {Promise<[import('@appium/types').ProxyResponse, import('@appium/types').HTTPBody]>}
|
|
68
|
-
*/
|
|
69
|
-
proxyPerformActions(url: string, method: string, body: import("@appium/types").HTTPBody): Promise<[import("@appium/types").ProxyResponse, import("@appium/types").HTTPBody]>;
|
|
70
|
-
/**
|
|
71
|
-
*
|
|
72
|
-
* @param {string} url
|
|
73
|
-
* @param {string} method
|
|
74
|
-
* @returns {Promise<[import('@appium/types').ProxyResponse, import('@appium/types').HTTPBody]>}
|
|
38
|
+
* W3C /timeouts can take as many as 3 timeout types at once, MJSONWP /timeouts only takes one
|
|
39
|
+
* at a time. So if we're using W3C and proxying to MJSONWP and there's more than one timeout type
|
|
40
|
+
* provided in the request, we need to do 3 proxies and combine the result.
|
|
75
41
|
*/
|
|
76
|
-
|
|
42
|
+
private getTimeoutRequestObjects;
|
|
77
43
|
/**
|
|
78
|
-
*
|
|
79
|
-
* when upstream and downstream drivers operate different protocols
|
|
80
|
-
*
|
|
81
|
-
* @param {string} commandName
|
|
82
|
-
* @param {string} url
|
|
83
|
-
* @param {string} method
|
|
84
|
-
* @param {import('@appium/types').HTTPBody} [body]
|
|
85
|
-
* @returns {Promise<[import('@appium/types').ProxyResponse, import('@appium/types').HTTPBody]>}
|
|
44
|
+
* Proxy an array of timeout objects and merge the result.
|
|
86
45
|
*/
|
|
87
|
-
|
|
46
|
+
private proxySetTimeouts;
|
|
47
|
+
private proxySetWindow;
|
|
48
|
+
private proxySetValue;
|
|
49
|
+
private proxySetFrame;
|
|
50
|
+
private proxyPerformActions;
|
|
51
|
+
private proxyReleaseActions;
|
|
88
52
|
}
|
|
89
53
|
//# sourceMappingURL=protocol-converter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol-converter.d.ts","sourceRoot":"","sources":["../../../lib/jsonwp-proxy/protocol-converter.
|
|
1
|
+
{"version":3,"file":"protocol-converter.d.ts","sourceRoot":"","sources":["../../../lib/jsonwp-proxy/protocol-converter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAC,MAAM,eAAe,CAAC;AAMzE,MAAM,MAAM,aAAa,GAAG,CAC1B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,QAAQ,KACZ,OAAO,CAAC,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC;AAExC,eAAO,MAAM,sBAAsB;;oCAGR,MAAM;iCAET,MAAM;;;oCAKH,MAAM;iCACT,MAAM;;;oCAIL,MAAM;iCAKT,MAAM;;;uCAQE,MAAM;uCAKN,MAAM;EAE1B,CAAC;AAKX,qBAAa,iBAAiB;IASnB,SAAS,EAAE,aAAa;IARjC,OAAO,CAAC,mBAAmB,CAAmC;IAC9D,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAsB;IAE3C;;;OAGG;gBAEM,SAAS,EAAE,aAAa,EAC/B,GAAG,GAAE,YAAY,GAAG,IAAW;IAKjC,IAAI,GAAG,IAAI,YAAY,CAEtB;IAED,IAAI,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAEtD;IAED,IAAI,kBAAkB,IAAI,MAAM,GAAG,IAAI,GAAG,SAAS,CAElD;IAED;;;OAGG;IACG,eAAe,CACnB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,QAAQ,GACd,OAAO,CAAC,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IA8CrC;;;;OAIG;IACH,OAAO,CAAC,wBAAwB;IA6BhC;;OAEG;YACW,gBAAgB;YA+BhB,cAAc;YAwBd,aAAa;YAoBb,aAAa;YAeb,mBAAmB;YAgBnB,mBAAmB;CAMlC"}
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.COMMAND_URLS_CONFLICTS = void 0;
|
|
6
|
+
exports.ProtocolConverter = exports.COMMAND_URLS_CONFLICTS = void 0;
|
|
7
7
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
8
|
const support_1 = require("@appium/support");
|
|
9
9
|
const helpers_1 = require("../basedriver/helpers");
|
|
@@ -36,23 +36,24 @@ exports.COMMAND_URLS_CONFLICTS = [
|
|
|
36
36
|
commandNames: ['getProperty'],
|
|
37
37
|
jsonwpConverter: (w3cUrl) => {
|
|
38
38
|
const w3cPropertyRegex = /\/element\/([^/]+)\/property\/([^/]+)/;
|
|
39
|
-
|
|
40
|
-
return jsonwpUrl;
|
|
39
|
+
return w3cUrl.replace(w3cPropertyRegex, '/element/$1/attribute/$2');
|
|
41
40
|
},
|
|
42
|
-
|
|
41
|
+
// Don't convert JSONWP URL to W3C. W3C accepts /attribute and /property
|
|
42
|
+
w3cConverter: (jsonwpUrl) => jsonwpUrl,
|
|
43
43
|
},
|
|
44
44
|
];
|
|
45
45
|
const { MJSONWP, W3C } = constants_1.PROTOCOLS;
|
|
46
46
|
const DEFAULT_LOG = support_1.logger.getLogger('Protocol Converter');
|
|
47
47
|
class ProtocolConverter {
|
|
48
|
+
proxyFunc;
|
|
49
|
+
_downstreamProtocol = null;
|
|
50
|
+
_log;
|
|
48
51
|
/**
|
|
49
|
-
*
|
|
50
|
-
* @param
|
|
51
|
-
* @param {import('@appium/types').AppiumLogger | null} [log=null]
|
|
52
|
+
* @param proxyFunc - Function to perform the actual proxy request
|
|
53
|
+
* @param log - Logger instance, or null to use the default
|
|
52
54
|
*/
|
|
53
55
|
constructor(proxyFunc, log = null) {
|
|
54
56
|
this.proxyFunc = proxyFunc;
|
|
55
|
-
this._downstreamProtocol = null;
|
|
56
57
|
this._log = log;
|
|
57
58
|
}
|
|
58
59
|
get log() {
|
|
@@ -64,48 +65,88 @@ class ProtocolConverter {
|
|
|
64
65
|
get downstreamProtocol() {
|
|
65
66
|
return this._downstreamProtocol;
|
|
66
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Handle "crossing" endpoints for the case when upstream and downstream
|
|
70
|
+
* drivers operate different protocols.
|
|
71
|
+
*/
|
|
72
|
+
async convertAndProxy(commandName, url, method, body) {
|
|
73
|
+
if (!this.downstreamProtocol) {
|
|
74
|
+
return await this.proxyFunc(url, method, body);
|
|
75
|
+
}
|
|
76
|
+
// Same url, but different arguments
|
|
77
|
+
switch (commandName) {
|
|
78
|
+
case 'timeouts':
|
|
79
|
+
return await this.proxySetTimeouts(url, method, body);
|
|
80
|
+
case 'setWindow':
|
|
81
|
+
return await this.proxySetWindow(url, method, body);
|
|
82
|
+
case 'setValue':
|
|
83
|
+
return await this.proxySetValue(url, method, body);
|
|
84
|
+
case 'performActions':
|
|
85
|
+
return await this.proxyPerformActions(url, method, body);
|
|
86
|
+
case 'releaseActions':
|
|
87
|
+
return await this.proxyReleaseActions(url, method);
|
|
88
|
+
case 'setFrame':
|
|
89
|
+
return await this.proxySetFrame(url, method, body);
|
|
90
|
+
default:
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
// Same arguments, but different URLs
|
|
94
|
+
for (const { commandNames, jsonwpConverter, w3cConverter } of exports.COMMAND_URLS_CONFLICTS) {
|
|
95
|
+
if (!commandNames.includes(commandName)) {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
const rewrittenUrl = this.downstreamProtocol === MJSONWP ? jsonwpConverter(url) : w3cConverter(url);
|
|
99
|
+
if (rewrittenUrl === url) {
|
|
100
|
+
this.log.debug(`Did not know how to rewrite the original URL '${url}' for ${this.downstreamProtocol} protocol`);
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
this.log.info(`Rewrote the original URL '${url}' to '${rewrittenUrl}' for ${this.downstreamProtocol} protocol`);
|
|
104
|
+
return await this.proxyFunc(rewrittenUrl, method, body);
|
|
105
|
+
}
|
|
106
|
+
// No matches found. Proceed normally
|
|
107
|
+
return await this.proxyFunc(url, method, body);
|
|
108
|
+
}
|
|
67
109
|
/**
|
|
68
110
|
* W3C /timeouts can take as many as 3 timeout types at once, MJSONWP /timeouts only takes one
|
|
69
111
|
* at a time. So if we're using W3C and proxying to MJSONWP and there's more than one timeout type
|
|
70
|
-
* provided in the request, we need to do 3 proxies and combine the result
|
|
71
|
-
*
|
|
72
|
-
* @param {Object} body Request body
|
|
73
|
-
* @return {Object[]} Array of W3C + MJSONWP compatible timeout objects
|
|
112
|
+
* provided in the request, we need to do 3 proxies and combine the result.
|
|
74
113
|
*/
|
|
75
114
|
getTimeoutRequestObjects(body) {
|
|
76
|
-
if (
|
|
115
|
+
if (lodash_1.default.isNil(body)) {
|
|
116
|
+
return [];
|
|
117
|
+
}
|
|
118
|
+
const bodyObj = support_1.util.safeJsonParse(body) ?? {};
|
|
119
|
+
if (this.downstreamProtocol === W3C && lodash_1.default.has(bodyObj, 'ms') && lodash_1.default.has(bodyObj, 'type')) {
|
|
77
120
|
const typeToW3C = (x) => (x === 'page load' ? 'pageLoad' : x);
|
|
78
121
|
return [
|
|
79
122
|
{
|
|
80
|
-
[typeToW3C(
|
|
123
|
+
[typeToW3C(bodyObj.type)]: bodyObj.ms,
|
|
81
124
|
},
|
|
82
125
|
];
|
|
83
126
|
}
|
|
84
|
-
if (this.downstreamProtocol === MJSONWP && (!lodash_1.default.has(
|
|
127
|
+
if (this.downstreamProtocol === MJSONWP && (!lodash_1.default.has(bodyObj, 'ms') || !lodash_1.default.has(bodyObj, 'type'))) {
|
|
85
128
|
const typeToJSONWP = (x) => (x === 'pageLoad' ? 'page load' : x);
|
|
86
|
-
return
|
|
129
|
+
return lodash_1.default.toPairs(bodyObj)
|
|
87
130
|
// Only transform the entry if ms value is a valid positive float number
|
|
88
131
|
.filter((pair) => /^\d+(?:[.,]\d*?)?$/.test(`${pair[1]}`))
|
|
89
|
-
.map(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
ms: pair[1],
|
|
93
|
-
};
|
|
132
|
+
.map((pair) => ({
|
|
133
|
+
type: typeToJSONWP(pair[0]),
|
|
134
|
+
ms: pair[1],
|
|
94
135
|
}));
|
|
95
136
|
}
|
|
96
|
-
return [
|
|
137
|
+
return [bodyObj];
|
|
97
138
|
}
|
|
98
139
|
/**
|
|
99
|
-
* Proxy an array of timeout objects and merge the result
|
|
100
|
-
* @param {string} url Endpoint url
|
|
101
|
-
* @param {string} method Endpoint method
|
|
102
|
-
* @param {import('@appium/types').HTTPBody} body Request body
|
|
103
|
-
* @returns {Promise<[import('@appium/types').ProxyResponse, import('@appium/types').HTTPBody]>}
|
|
140
|
+
* Proxy an array of timeout objects and merge the result.
|
|
104
141
|
*/
|
|
105
142
|
async proxySetTimeouts(url, method, body) {
|
|
106
|
-
let response, resBody;
|
|
107
143
|
const timeoutRequestObjects = this.getTimeoutRequestObjects(body);
|
|
144
|
+
if (timeoutRequestObjects.length === 0) {
|
|
145
|
+
return await this.proxyFunc(url, method, body);
|
|
146
|
+
}
|
|
108
147
|
this.log.debug(`Will send the following request bodies to /timeouts: ${JSON.stringify(timeoutRequestObjects)}`);
|
|
148
|
+
let response;
|
|
149
|
+
let resBody;
|
|
109
150
|
for (const timeoutObj of timeoutRequestObjects) {
|
|
110
151
|
[response, resBody] = await this.proxyFunc(url, method, timeoutObj);
|
|
111
152
|
// If we got a non-MJSONWP response, return the result, nothing left to do
|
|
@@ -118,47 +159,28 @@ class ProtocolConverter {
|
|
|
118
159
|
}
|
|
119
160
|
// ...Otherwise, continue to the next timeouts call
|
|
120
161
|
}
|
|
121
|
-
return [
|
|
162
|
+
return [response, resBody];
|
|
122
163
|
}
|
|
123
|
-
/**
|
|
124
|
-
*
|
|
125
|
-
* @param {string} url
|
|
126
|
-
* @param {string} method
|
|
127
|
-
* @param {import('@appium/types').HTTPBody} body
|
|
128
|
-
* @returns {Promise<[import('@appium/types').ProxyResponse, import('@appium/types').HTTPBody]>}
|
|
129
|
-
*/
|
|
130
164
|
async proxySetWindow(url, method, body) {
|
|
131
165
|
const bodyObj = support_1.util.safeJsonParse(body);
|
|
132
166
|
if (lodash_1.default.isPlainObject(bodyObj)) {
|
|
167
|
+
const obj = bodyObj;
|
|
133
168
|
if (this.downstreamProtocol === W3C && lodash_1.default.has(bodyObj, 'name') && !lodash_1.default.has(bodyObj, 'handle')) {
|
|
134
|
-
this.log.debug(`Copied 'name' value '${
|
|
135
|
-
return await this.proxyFunc(url, method, {
|
|
136
|
-
... /** @type {import('@appium/types').StringRecord} */(bodyObj),
|
|
137
|
-
handle: /** @type {import('@appium/types').StringRecord} */ (bodyObj).name,
|
|
138
|
-
});
|
|
169
|
+
this.log.debug(`Copied 'name' value '${obj.name}' to 'handle' as per W3C spec`);
|
|
170
|
+
return await this.proxyFunc(url, method, { ...obj, handle: obj.name });
|
|
139
171
|
}
|
|
140
172
|
if (this.downstreamProtocol === MJSONWP &&
|
|
141
173
|
lodash_1.default.has(bodyObj, 'handle') &&
|
|
142
174
|
!lodash_1.default.has(bodyObj, 'name')) {
|
|
143
|
-
this.log.debug(`Copied 'handle' value '${
|
|
144
|
-
return await this.proxyFunc(url, method, {
|
|
145
|
-
... /** @type {import('@appium/types').StringRecord} */(bodyObj),
|
|
146
|
-
name: /** @type {import('@appium/types').StringRecord} */ (bodyObj).handle,
|
|
147
|
-
});
|
|
175
|
+
this.log.debug(`Copied 'handle' value '${obj.handle}' to 'name' as per JSONWP spec`);
|
|
176
|
+
return await this.proxyFunc(url, method, { ...obj, name: obj.handle });
|
|
148
177
|
}
|
|
149
178
|
}
|
|
150
179
|
return await this.proxyFunc(url, method, body);
|
|
151
180
|
}
|
|
152
|
-
/**
|
|
153
|
-
*
|
|
154
|
-
* @param {string} url
|
|
155
|
-
* @param {string} method
|
|
156
|
-
* @param {import('@appium/types').HTTPBody} body
|
|
157
|
-
* @returns {Promise<[import('@appium/types').ProxyResponse, import('@appium/types').HTTPBody]>}
|
|
158
|
-
*/
|
|
159
181
|
async proxySetValue(url, method, body) {
|
|
160
182
|
const bodyObj = support_1.util.safeJsonParse(body);
|
|
161
|
-
if (lodash_1.default.isPlainObject(bodyObj) && (support_1.util.hasValue(bodyObj
|
|
183
|
+
if (lodash_1.default.isPlainObject(bodyObj) && (support_1.util.hasValue(bodyObj?.text) || support_1.util.hasValue(bodyObj?.value))) {
|
|
162
184
|
let { text, value } = bodyObj;
|
|
163
185
|
if (support_1.util.hasValue(text) && !support_1.util.hasValue(value)) {
|
|
164
186
|
value = lodash_1.default.isString(text) ? [...text] : lodash_1.default.isArray(text) ? text : [];
|
|
@@ -168,104 +190,30 @@ class ProtocolConverter {
|
|
|
168
190
|
text = lodash_1.default.isArray(value) ? value.join('') : lodash_1.default.isString(value) ? value : '';
|
|
169
191
|
this.log.debug(`Added 'text' property to 'setValue' request body`);
|
|
170
192
|
}
|
|
171
|
-
return await this.proxyFunc(url, method, {
|
|
172
|
-
...bodyObj,
|
|
173
|
-
text,
|
|
174
|
-
value,
|
|
175
|
-
});
|
|
193
|
+
return await this.proxyFunc(url, method, { ...bodyObj, text, value });
|
|
176
194
|
}
|
|
177
195
|
return await this.proxyFunc(url, method, body);
|
|
178
196
|
}
|
|
179
|
-
/**
|
|
180
|
-
*
|
|
181
|
-
* @param {string} url
|
|
182
|
-
* @param {string} method
|
|
183
|
-
* @param {import('@appium/types').HTTPBody} body
|
|
184
|
-
* @returns {Promise<[import('@appium/types').ProxyResponse, import('@appium/types').HTTPBody]>}
|
|
185
|
-
*/
|
|
186
197
|
async proxySetFrame(url, method, body) {
|
|
187
198
|
const bodyObj = support_1.util.safeJsonParse(body);
|
|
188
|
-
|
|
189
|
-
|
|
199
|
+
if (lodash_1.default.has(bodyObj, 'id') && lodash_1.default.isPlainObject(bodyObj.id)) {
|
|
200
|
+
return await this.proxyFunc(url, method, {
|
|
190
201
|
...bodyObj,
|
|
191
202
|
id: (0, helpers_1.duplicateKeys)(bodyObj.id, constants_1.MJSONWP_ELEMENT_KEY, constants_1.W3C_ELEMENT_KEY),
|
|
192
|
-
})
|
|
193
|
-
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
return await this.proxyFunc(url, method, body);
|
|
194
206
|
}
|
|
195
|
-
/**
|
|
196
|
-
*
|
|
197
|
-
* @param {string} url
|
|
198
|
-
* @param {string} method
|
|
199
|
-
* @param {import('@appium/types').HTTPBody} body
|
|
200
|
-
* @returns {Promise<[import('@appium/types').ProxyResponse, import('@appium/types').HTTPBody]>}
|
|
201
|
-
*/
|
|
202
207
|
async proxyPerformActions(url, method, body) {
|
|
203
208
|
const bodyObj = support_1.util.safeJsonParse(body);
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
209
|
+
if (lodash_1.default.isPlainObject(bodyObj)) {
|
|
210
|
+
return await this.proxyFunc(url, method, (0, helpers_1.duplicateKeys)(bodyObj, constants_1.MJSONWP_ELEMENT_KEY, constants_1.W3C_ELEMENT_KEY));
|
|
211
|
+
}
|
|
212
|
+
return await this.proxyFunc(url, method, body);
|
|
207
213
|
}
|
|
208
|
-
/**
|
|
209
|
-
*
|
|
210
|
-
* @param {string} url
|
|
211
|
-
* @param {string} method
|
|
212
|
-
* @returns {Promise<[import('@appium/types').ProxyResponse, import('@appium/types').HTTPBody]>}
|
|
213
|
-
*/
|
|
214
214
|
async proxyReleaseActions(url, method) {
|
|
215
215
|
return await this.proxyFunc(url, method);
|
|
216
216
|
}
|
|
217
|
-
/**
|
|
218
|
-
* Handle "crossing" endpoints for the case
|
|
219
|
-
* when upstream and downstream drivers operate different protocols
|
|
220
|
-
*
|
|
221
|
-
* @param {string} commandName
|
|
222
|
-
* @param {string} url
|
|
223
|
-
* @param {string} method
|
|
224
|
-
* @param {import('@appium/types').HTTPBody} [body]
|
|
225
|
-
* @returns {Promise<[import('@appium/types').ProxyResponse, import('@appium/types').HTTPBody]>}
|
|
226
|
-
*/
|
|
227
|
-
async convertAndProxy(commandName, url, method, body) {
|
|
228
|
-
if (!this.downstreamProtocol) {
|
|
229
|
-
return await this.proxyFunc(url, method, body);
|
|
230
|
-
}
|
|
231
|
-
// Same url, but different arguments
|
|
232
|
-
switch (commandName) {
|
|
233
|
-
case 'timeouts':
|
|
234
|
-
return await this.proxySetTimeouts(url, method, body);
|
|
235
|
-
case 'setWindow':
|
|
236
|
-
return await this.proxySetWindow(url, method, body);
|
|
237
|
-
case 'setValue':
|
|
238
|
-
return await this.proxySetValue(url, method, body);
|
|
239
|
-
case 'performActions':
|
|
240
|
-
return await this.proxyPerformActions(url, method, body);
|
|
241
|
-
case 'releaseActions':
|
|
242
|
-
return await this.proxyReleaseActions(url, method);
|
|
243
|
-
case 'setFrame':
|
|
244
|
-
return await this.proxySetFrame(url, method, body);
|
|
245
|
-
default:
|
|
246
|
-
break;
|
|
247
|
-
}
|
|
248
|
-
// Same arguments, but different URLs
|
|
249
|
-
for (const { commandNames, jsonwpConverter, w3cConverter } of exports.COMMAND_URLS_CONFLICTS) {
|
|
250
|
-
if (!commandNames.includes(commandName)) {
|
|
251
|
-
continue;
|
|
252
|
-
}
|
|
253
|
-
const rewrittenUrl = this.downstreamProtocol === MJSONWP ? jsonwpConverter(url) : w3cConverter(url);
|
|
254
|
-
if (rewrittenUrl === url) {
|
|
255
|
-
this.log.debug(`Did not know how to rewrite the original URL '${url}' ` +
|
|
256
|
-
`for ${this.downstreamProtocol} protocol`);
|
|
257
|
-
break;
|
|
258
|
-
}
|
|
259
|
-
this.log.info(`Rewrote the original URL '${url}' to '${rewrittenUrl}' ` +
|
|
260
|
-
`for ${this.downstreamProtocol} protocol`);
|
|
261
|
-
return await this.proxyFunc(rewrittenUrl, method, body);
|
|
262
|
-
}
|
|
263
|
-
// No matches found. Proceed normally
|
|
264
|
-
return await this.proxyFunc(url, method, body);
|
|
265
|
-
}
|
|
266
217
|
}
|
|
267
|
-
exports.
|
|
268
|
-
/**
|
|
269
|
-
* @typedef {(url: string, method: string, body?: import('@appium/types').HTTPBody) => Promise<[import('@appium/types').ProxyResponse, import('@appium/types').HTTPBody]>} ProxyFunction
|
|
270
|
-
*/
|
|
218
|
+
exports.ProtocolConverter = ProtocolConverter;
|
|
271
219
|
//# sourceMappingURL=protocol-converter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol-converter.js","sourceRoot":"","sources":["../../../lib/jsonwp-proxy/protocol-converter.
|
|
1
|
+
{"version":3,"file":"protocol-converter.js","sourceRoot":"","sources":["../../../lib/jsonwp-proxy/protocol-converter.ts"],"names":[],"mappings":";;;;;;AACA,oDAAuB;AACvB,6CAA6C;AAC7C,mDAAoD;AACpD,4CAA6E;AAQhE,QAAA,sBAAsB,GAAG;IACpC;QACE,YAAY,EAAE,CAAC,SAAS,EAAE,cAAc,CAAC;QACzC,eAAe,EAAE,CAAC,GAAW,EAAE,EAAE,CAC/B,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,UAAU,CAAC;QACnF,YAAY,EAAE,CAAC,GAAW,EAAE,EAAE,CAC5B,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,eAAe,CAAC;KACzF;IACD;QACE,YAAY,EAAE,CAAC,sBAAsB,CAAC;QACtC,eAAe,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,iCAAiC,EAAE,gBAAgB,CAAC;QAClG,YAAY,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,uBAAuB,EAAE,wBAAwB,CAAC;KAC9F;IACD;QACE,YAAY,EAAE,CAAC,kBAAkB,EAAE,iBAAiB,CAAC;QACrD,eAAe,CAAC,GAAW;YACzB,OAAO,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC;gBAC5B,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,gBAAgB,CAAC;gBAC5C,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,uBAAuB,EAAE,kBAAkB,CAAC,CAAC;QAC/D,CAAC;QACD,YAAY,CAAC,GAAW;YACtB,OAAO,GAAG,CAAC,QAAQ,C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AE,2BAAe,CAAC,CACvE,CAAC;QACJ,CAAC;QACD,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IAEO,KAAK,CAAC,mBAAmB,CAC/B,GAAW,EACX,MAAc;QAEd,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC;CACF;AAvOD,8CAuOC"}
|
|
@@ -122,7 +122,7 @@ export type Protocol = (typeof PROTOCOLS)[keyof typeof PROTOCOLS];
|
|
|
122
122
|
import { ProxyRequest } from './proxy-request';
|
|
123
123
|
import http from 'node:http';
|
|
124
124
|
import https from 'node:https';
|
|
125
|
-
import ProtocolConverter from './protocol-converter';
|
|
125
|
+
import { ProtocolConverter } from './protocol-converter';
|
|
126
126
|
import nodeUrl from 'node:url';
|
|
127
127
|
import { PROTOCOLS } from '../constants';
|
|
128
128
|
//# sourceMappingURL=proxy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../../lib/jsonwp-proxy/proxy.js"],"names":[],"mappings":"AAuCA;IAsBE;;OAEG;IACH,mBAFW,OAAO,eAAe,EAAE,YAAY,EAgC9C;IAtDD,qBAAqB;IACrB,QADW,MAAM,CACV;IACP,qBAAqB;IACrB,QADW,MAAM,CACV;IACP,qBAAqB;IACrB,MADW,MAAM,CACZ;IACL,qBAAqB;IACrB,MADW,MAAM,CACZ;IACL,qBAAqB;IACrB,aADW,MAAM,CACL;IACZ,sBAAsB;IACtB,WADW,MAAM,OAAC,CACR;IACV,qBAAqB;IACrB,SADW,MAAM,CACT;IACR,8DAA8D;IAC9D,SADW,OAAO,eAAe,EAAE,WAAW,GAAG,SAAS,CAClD;IACR,0CAA0C;IAC1C,qBADW,QAAQ,GAAG,IAAI,GAAG,SAAS,CAClB;IACpB,6BAA6B;IAC7B,iBADW,YAAY,EAAE,CAC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
|
const errors_1 = require("../protocol/errors");
|
|
11
11
|
const protocol_1 = require("../protocol");
|
|
12
12
|
const constants_1 = require("../constants");
|
|
13
|
-
const protocol_converter_1 =
|
|
13
|
+
const protocol_converter_1 = require("./protocol-converter");
|
|
14
14
|
const helpers_1 = require("../protocol/helpers");
|
|
15
15
|
const node_http_1 = __importDefault(require("node:http"));
|
|
16
16
|
const node_https_1 = __importDefault(require("node:https"));
|
|
@@ -82,7 +82,7 @@ class JWProxy {
|
|
|
82
82
|
};
|
|
83
83
|
this.httpAgent = new node_http_1.default.Agent(agentOpts);
|
|
84
84
|
this.httpsAgent = new node_https_1.default.Agent(agentOpts);
|
|
85
|
-
this.protocolConverter = new protocol_converter_1.
|
|
85
|
+
this.protocolConverter = new protocol_converter_1.ProtocolConverter(this.proxy.bind(this), opts.log);
|
|
86
86
|
this._log = opts.log;
|
|
87
87
|
this.log.debug(`${this.constructor.name} options: ${JSON.stringify(options)}`);
|
|
88
88
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../../lib/jsonwp-proxy/proxy.js"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,6CAA6C;AAC7C,oDAAyD;AACzD,+CAM4B;AAC5B,0CAAiE;AACjE,4CAA+E;AAC/E,8EAAqD;AACrD,iDAA2E;AAC3E,0DAA6B;AAC7B,4DAA+B;AAC/B,mDAA2D;AAC3D,wDAA+B;AAC/B,mDAA+C;AAE/C,MAAM,WAAW,GAAG,gBAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;AACjD,MAAM,uBAAuB,GAAG,MAAM,CAAC;AACvC,MAAM,+BAA+B,GAAG,IAAA,sBAAgB,EAAC,0CAA0C,CAAC,CAAC;AAErG,MAAM,EAAC,OAAO,EAAE,GAAG,EAAC,GAAG,qBAAS,CAAC;AAEjC,MAAM,YAAY,GAAG;IACnB,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,MAAM;IACN,aAAa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AE,CAAC,CAAC,CAAC,EAAE,CAAC;QACxF,CAAC;QACD,OAAO,gBAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChC,CAAC;CACF;AA7bD,0BA6bC;AAED,kBAAe,OAAO,CAAC;AAEvB;;;;GAIG"}
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import type {AppiumLogger, HTTPBody, ProxyResponse} from '@appium/types';
|
|
2
|
+
import _ from 'lodash';
|
|
3
|
+
import {logger, util} from '@appium/support';
|
|
4
|
+
import {duplicateKeys} from '../basedriver/helpers';
|
|
5
|
+
import {MJSONWP_ELEMENT_KEY, W3C_ELEMENT_KEY, PROTOCOLS} from '../constants';
|
|
6
|
+
|
|
7
|
+
export type ProxyFunction = (
|
|
8
|
+
url: string,
|
|
9
|
+
method: string,
|
|
10
|
+
body?: HTTPBody
|
|
11
|
+
) => Promise<[ProxyResponse, HTTPBody]>;
|
|
12
|
+
|
|
13
|
+
export const COMMAND_URLS_CONFLICTS = [
|
|
14
|
+
{
|
|
15
|
+
commandNames: ['execute', 'executeAsync'],
|
|
16
|
+
jsonwpConverter: (url: string) =>
|
|
17
|
+
url.replace(/\/execute.*/, url.includes('async') ? '/execute_async' : '/execute'),
|
|
18
|
+
w3cConverter: (url: string) =>
|
|
19
|
+
url.replace(/\/execute.*/, url.includes('async') ? '/execute/async' : '/execute/sync'),
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
commandNames: ['getElementScreenshot'],
|
|
23
|
+
jsonwpConverter: (url: string) => url.replace(/\/element\/([^/]+)\/screenshot$/, '/screenshot/$1'),
|
|
24
|
+
w3cConverter: (url: string) => url.replace(/\/screenshot\/([^/]+)/, '/element/$1/screenshot'),
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
commandNames: ['getWindowHandles', 'getWindowHandle'],
|
|
28
|
+
jsonwpConverter(url: string) {
|
|
29
|
+
return url.endsWith('/window')
|
|
30
|
+
? url.replace(/\/window$/, '/window_handle')
|
|
31
|
+
: url.replace(/\/window\/handle(s?)$/, '/window_handle$1');
|
|
32
|
+
},
|
|
33
|
+
w3cConverter(url: string) {
|
|
34
|
+
return url.endsWith('/window_handle')
|
|
35
|
+
? url.replace(/\/window_handle$/, '/window')
|
|
36
|
+
: url.replace(/\/window_handles$/, '/window/handles');
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
commandNames: ['getProperty'],
|
|
41
|
+
jsonwpConverter: (w3cUrl: string) => {
|
|
42
|
+
const w3cPropertyRegex = /\/element\/([^/]+)\/property\/([^/]+)/;
|
|
43
|
+
return w3cUrl.replace(w3cPropertyRegex, '/element/$1/attribute/$2');
|
|
44
|
+
},
|
|
45
|
+
// Don't convert JSONWP URL to W3C. W3C accepts /attribute and /property
|
|
46
|
+
w3cConverter: (jsonwpUrl: string) => jsonwpUrl,
|
|
47
|
+
},
|
|
48
|
+
] as const;
|
|
49
|
+
|
|
50
|
+
const {MJSONWP, W3C} = PROTOCOLS;
|
|
51
|
+
const DEFAULT_LOG = logger.getLogger('Protocol Converter');
|
|
52
|
+
|
|
53
|
+
export class ProtocolConverter {
|
|
54
|
+
private _downstreamProtocol: string | null | undefined = null;
|
|
55
|
+
private readonly _log: AppiumLogger | null;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @param proxyFunc - Function to perform the actual proxy request
|
|
59
|
+
* @param log - Logger instance, or null to use the default
|
|
60
|
+
*/
|
|
61
|
+
constructor(
|
|
62
|
+
public proxyFunc: ProxyFunction,
|
|
63
|
+
log: AppiumLogger | null = null
|
|
64
|
+
) {
|
|
65
|
+
this._log = log;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
get log(): AppiumLogger {
|
|
69
|
+
return this._log ?? DEFAULT_LOG;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
set downstreamProtocol(value: string | null | undefined) {
|
|
73
|
+
this._downstreamProtocol = value;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
get downstreamProtocol(): string | null | undefined {
|
|
77
|
+
return this._downstreamProtocol;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Handle "crossing" endpoints for the case when upstream and downstream
|
|
82
|
+
* drivers operate different protocols.
|
|
83
|
+
*/
|
|
84
|
+
async convertAndProxy(
|
|
85
|
+
commandName: string,
|
|
86
|
+
url: string,
|
|
87
|
+
method: string,
|
|
88
|
+
body?: HTTPBody
|
|
89
|
+
): Promise<[ProxyResponse, HTTPBody]> {
|
|
90
|
+
if (!this.downstreamProtocol) {
|
|
91
|
+
return await this.proxyFunc(url, method, body);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Same url, but different arguments
|
|
95
|
+
switch (commandName) {
|
|
96
|
+
case 'timeouts':
|
|
97
|
+
return await this.proxySetTimeouts(url, method, body);
|
|
98
|
+
case 'setWindow':
|
|
99
|
+
return await this.proxySetWindow(url, method, body);
|
|
100
|
+
case 'setValue':
|
|
101
|
+
return await this.proxySetValue(url, method, body);
|
|
102
|
+
case 'performActions':
|
|
103
|
+
return await this.proxyPerformActions(url, method, body);
|
|
104
|
+
case 'releaseActions':
|
|
105
|
+
return await this.proxyReleaseActions(url, method);
|
|
106
|
+
case 'setFrame':
|
|
107
|
+
return await this.proxySetFrame(url, method, body);
|
|
108
|
+
default:
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Same arguments, but different URLs
|
|
113
|
+
for (const {commandNames, jsonwpConverter, w3cConverter} of COMMAND_URLS_CONFLICTS) {
|
|
114
|
+
if (!(commandNames as readonly string[]).includes(commandName)) {
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
const rewrittenUrl =
|
|
118
|
+
this.downstreamProtocol === MJSONWP ? jsonwpConverter(url) : w3cConverter(url);
|
|
119
|
+
if (rewrittenUrl === url) {
|
|
120
|
+
this.log.debug(
|
|
121
|
+
`Did not know how to rewrite the original URL '${url}' for ${this.downstreamProtocol} protocol`
|
|
122
|
+
);
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
this.log.info(
|
|
126
|
+
`Rewrote the original URL '${url}' to '${rewrittenUrl}' for ${this.downstreamProtocol} protocol`
|
|
127
|
+
);
|
|
128
|
+
return await this.proxyFunc(rewrittenUrl, method, body);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// No matches found. Proceed normally
|
|
132
|
+
return await this.proxyFunc(url, method, body);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* W3C /timeouts can take as many as 3 timeout types at once, MJSONWP /timeouts only takes one
|
|
137
|
+
* at a time. So if we're using W3C and proxying to MJSONWP and there's more than one timeout type
|
|
138
|
+
* provided in the request, we need to do 3 proxies and combine the result.
|
|
139
|
+
*/
|
|
140
|
+
private getTimeoutRequestObjects(body: HTTPBody): Record<string, unknown>[] {
|
|
141
|
+
if (_.isNil(body)) {
|
|
142
|
+
return [];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const bodyObj = (util.safeJsonParse(body) as Record<string, unknown>) ?? {};
|
|
146
|
+
if (this.downstreamProtocol === W3C && _.has(bodyObj, 'ms') && _.has(bodyObj, 'type')) {
|
|
147
|
+
const typeToW3C = (x: string) => (x === 'page load' ? 'pageLoad' : x);
|
|
148
|
+
return [
|
|
149
|
+
{
|
|
150
|
+
[typeToW3C(bodyObj.type as string)]: bodyObj.ms,
|
|
151
|
+
},
|
|
152
|
+
];
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (this.downstreamProtocol === MJSONWP && (!_.has(bodyObj, 'ms') || !_.has(bodyObj, 'type'))) {
|
|
156
|
+
const typeToJSONWP = (x: string) => (x === 'pageLoad' ? 'page load' : x);
|
|
157
|
+
return _.toPairs(bodyObj)
|
|
158
|
+
// Only transform the entry if ms value is a valid positive float number
|
|
159
|
+
.filter((pair) => /^\d+(?:[.,]\d*?)?$/.test(`${pair[1]}`))
|
|
160
|
+
.map((pair) => ({
|
|
161
|
+
type: typeToJSONWP(pair[0]),
|
|
162
|
+
ms: pair[1],
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return [bodyObj];
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Proxy an array of timeout objects and merge the result.
|
|
171
|
+
*/
|
|
172
|
+
private async proxySetTimeouts(
|
|
173
|
+
url: string,
|
|
174
|
+
method: string,
|
|
175
|
+
body?: HTTPBody
|
|
176
|
+
): Promise<[ProxyResponse, HTTPBody]> {
|
|
177
|
+
const timeoutRequestObjects = this.getTimeoutRequestObjects(body);
|
|
178
|
+
if (timeoutRequestObjects.length === 0) {
|
|
179
|
+
return await this.proxyFunc(url, method, body);
|
|
180
|
+
}
|
|
181
|
+
this.log.debug(
|
|
182
|
+
`Will send the following request bodies to /timeouts: ${JSON.stringify(timeoutRequestObjects)}`
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
let response!: ProxyResponse;
|
|
186
|
+
let resBody!: HTTPBody;
|
|
187
|
+
for (const timeoutObj of timeoutRequestObjects) {
|
|
188
|
+
[response, resBody] = await this.proxyFunc(url, method, timeoutObj as HTTPBody);
|
|
189
|
+
|
|
190
|
+
// If we got a non-MJSONWP response, return the result, nothing left to do
|
|
191
|
+
if (this.downstreamProtocol !== MJSONWP) {
|
|
192
|
+
return [response, resBody];
|
|
193
|
+
}
|
|
194
|
+
// If we got an error, return the error right away
|
|
195
|
+
if (response.statusCode >= 400) {
|
|
196
|
+
return [response, resBody];
|
|
197
|
+
}
|
|
198
|
+
// ...Otherwise, continue to the next timeouts call
|
|
199
|
+
}
|
|
200
|
+
return [response, resBody];
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
private async proxySetWindow(
|
|
204
|
+
url: string,
|
|
205
|
+
method: string,
|
|
206
|
+
body: HTTPBody
|
|
207
|
+
): Promise<[ProxyResponse, HTTPBody]> {
|
|
208
|
+
const bodyObj = util.safeJsonParse(body);
|
|
209
|
+
if (_.isPlainObject(bodyObj)) {
|
|
210
|
+
const obj = bodyObj as Record<string, unknown>;
|
|
211
|
+
if (this.downstreamProtocol === W3C && _.has(bodyObj, 'name') && !_.has(bodyObj, 'handle')) {
|
|
212
|
+
this.log.debug(`Copied 'name' value '${obj.name}' to 'handle' as per W3C spec`);
|
|
213
|
+
return await this.proxyFunc(url, method, {...obj, handle: obj.name});
|
|
214
|
+
}
|
|
215
|
+
if (
|
|
216
|
+
this.downstreamProtocol === MJSONWP &&
|
|
217
|
+
_.has(bodyObj, 'handle') &&
|
|
218
|
+
!_.has(bodyObj, 'name')
|
|
219
|
+
) {
|
|
220
|
+
this.log.debug(`Copied 'handle' value '${obj.handle}' to 'name' as per JSONWP spec`);
|
|
221
|
+
return await this.proxyFunc(url, method, {...obj, name: obj.handle});
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return await this.proxyFunc(url, method, body);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
private async proxySetValue(
|
|
228
|
+
url: string,
|
|
229
|
+
method: string,
|
|
230
|
+
body: HTTPBody
|
|
231
|
+
): Promise<[ProxyResponse, HTTPBody]> {
|
|
232
|
+
const bodyObj = util.safeJsonParse(body) as Record<string, unknown> | undefined;
|
|
233
|
+
if (_.isPlainObject(bodyObj) && (util.hasValue(bodyObj?.text) || util.hasValue(bodyObj?.value))) {
|
|
234
|
+
let {text, value} = bodyObj;
|
|
235
|
+
if (util.hasValue(text) && !util.hasValue(value)) {
|
|
236
|
+
value = _.isString(text) ? [...text] : _.isArray(text) ? text : [];
|
|
237
|
+
this.log.debug(`Added 'value' property to 'setValue' request body`);
|
|
238
|
+
} else if (!util.hasValue(text) && util.hasValue(value)) {
|
|
239
|
+
text = _.isArray(value) ? value.join('') : _.isString(value) ? value : '';
|
|
240
|
+
this.log.debug(`Added 'text' property to 'setValue' request body`);
|
|
241
|
+
}
|
|
242
|
+
return await this.proxyFunc(url, method, {...bodyObj, text, value});
|
|
243
|
+
}
|
|
244
|
+
return await this.proxyFunc(url, method, body);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
private async proxySetFrame(
|
|
248
|
+
url: string,
|
|
249
|
+
method: string,
|
|
250
|
+
body: HTTPBody
|
|
251
|
+
): Promise<[ProxyResponse, HTTPBody]> {
|
|
252
|
+
const bodyObj = util.safeJsonParse(body);
|
|
253
|
+
if (_.has(bodyObj, 'id') && _.isPlainObject(bodyObj.id)) {
|
|
254
|
+
return await this.proxyFunc(url, method, {
|
|
255
|
+
...(bodyObj as object),
|
|
256
|
+
id: duplicateKeys(bodyObj.id as object, MJSONWP_ELEMENT_KEY, W3C_ELEMENT_KEY),
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
return await this.proxyFunc(url, method, body);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
private async proxyPerformActions(
|
|
263
|
+
url: string,
|
|
264
|
+
method: string,
|
|
265
|
+
body: HTTPBody
|
|
266
|
+
): Promise<[ProxyResponse, HTTPBody]> {
|
|
267
|
+
const bodyObj = util.safeJsonParse(body);
|
|
268
|
+
if (_.isPlainObject(bodyObj)) {
|
|
269
|
+
return await this.proxyFunc(
|
|
270
|
+
url,
|
|
271
|
+
method,
|
|
272
|
+
duplicateKeys(bodyObj as object, MJSONWP_ELEMENT_KEY, W3C_ELEMENT_KEY)
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
return await this.proxyFunc(url, method, body);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
private async proxyReleaseActions(
|
|
279
|
+
url: string,
|
|
280
|
+
method: string
|
|
281
|
+
): Promise<[ProxyResponse, HTTPBody]> {
|
|
282
|
+
return await this.proxyFunc(url, method);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from '../protocol/errors';
|
|
11
11
|
import {isSessionCommand, routeToCommandName} from '../protocol';
|
|
12
12
|
import {MAX_LOG_BODY_LENGTH, DEFAULT_BASE_PATH, PROTOCOLS} from '../constants';
|
|
13
|
-
import ProtocolConverter from './protocol-converter';
|
|
13
|
+
import {ProtocolConverter} from './protocol-converter';
|
|
14
14
|
import {formatResponseValue, ensureW3cResponse} from '../protocol/helpers';
|
|
15
15
|
import http from 'node:http';
|
|
16
16
|
import https from 'node:https';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appium/base-driver",
|
|
3
|
-
"version": "10.2.
|
|
3
|
+
"version": "10.2.2",
|
|
4
4
|
"description": "Base driver class for Appium drivers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"publishConfig": {
|
|
75
75
|
"access": "public"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "c745352c6500937a4590d1ef6ef19785143a8870",
|
|
78
78
|
"tsd": {
|
|
79
79
|
"directory": "test/types"
|
|
80
80
|
}
|
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
import {logger, util} from '@appium/support';
|
|
3
|
-
import {duplicateKeys} from '../basedriver/helpers';
|
|
4
|
-
import {MJSONWP_ELEMENT_KEY, W3C_ELEMENT_KEY, PROTOCOLS} from '../constants';
|
|
5
|
-
|
|
6
|
-
export const COMMAND_URLS_CONFLICTS = [
|
|
7
|
-
{
|
|
8
|
-
commandNames: ['execute', 'executeAsync'],
|
|
9
|
-
jsonwpConverter: (url) =>
|
|
10
|
-
url.replace(/\/execute.*/, url.includes('async') ? '/execute_async' : '/execute'),
|
|
11
|
-
w3cConverter: (url) =>
|
|
12
|
-
url.replace(/\/execute.*/, url.includes('async') ? '/execute/async' : '/execute/sync'),
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
commandNames: ['getElementScreenshot'],
|
|
16
|
-
jsonwpConverter: (url) => url.replace(/\/element\/([^/]+)\/screenshot$/, '/screenshot/$1'),
|
|
17
|
-
w3cConverter: (url) => url.replace(/\/screenshot\/([^/]+)/, '/element/$1/screenshot'),
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
commandNames: ['getWindowHandles', 'getWindowHandle'],
|
|
21
|
-
jsonwpConverter(url) {
|
|
22
|
-
return url.endsWith('/window')
|
|
23
|
-
? url.replace(/\/window$/, '/window_handle')
|
|
24
|
-
: url.replace(/\/window\/handle(s?)$/, '/window_handle$1');
|
|
25
|
-
},
|
|
26
|
-
w3cConverter(url) {
|
|
27
|
-
return url.endsWith('/window_handle')
|
|
28
|
-
? url.replace(/\/window_handle$/, '/window')
|
|
29
|
-
: url.replace(/\/window_handles$/, '/window/handles');
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
commandNames: ['getProperty'],
|
|
34
|
-
jsonwpConverter: (w3cUrl) => {
|
|
35
|
-
const w3cPropertyRegex = /\/element\/([^/]+)\/property\/([^/]+)/;
|
|
36
|
-
const jsonwpUrl = w3cUrl.replace(w3cPropertyRegex, '/element/$1/attribute/$2');
|
|
37
|
-
return jsonwpUrl;
|
|
38
|
-
},
|
|
39
|
-
w3cConverter: (jsonwpUrl) => jsonwpUrl, // Don't convert JSONWP URL to W3C. W3C accepts /attribute and /property
|
|
40
|
-
},
|
|
41
|
-
];
|
|
42
|
-
const {MJSONWP, W3C} = PROTOCOLS;
|
|
43
|
-
const DEFAULT_LOG = logger.getLogger('Protocol Converter');
|
|
44
|
-
|
|
45
|
-
class ProtocolConverter {
|
|
46
|
-
/**
|
|
47
|
-
*
|
|
48
|
-
* @param {ProxyFunction} proxyFunc
|
|
49
|
-
* @param {import('@appium/types').AppiumLogger | null} [log=null]
|
|
50
|
-
*/
|
|
51
|
-
constructor(proxyFunc, log = null) {
|
|
52
|
-
this.proxyFunc = proxyFunc;
|
|
53
|
-
this._downstreamProtocol = null;
|
|
54
|
-
this._log = log;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
get log() {
|
|
58
|
-
return this._log ?? DEFAULT_LOG;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
set downstreamProtocol(value) {
|
|
62
|
-
this._downstreamProtocol = value;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
get downstreamProtocol() {
|
|
66
|
-
return this._downstreamProtocol;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* W3C /timeouts can take as many as 3 timeout types at once, MJSONWP /timeouts only takes one
|
|
71
|
-
* at a time. So if we're using W3C and proxying to MJSONWP and there's more than one timeout type
|
|
72
|
-
* provided in the request, we need to do 3 proxies and combine the result
|
|
73
|
-
*
|
|
74
|
-
* @param {Object} body Request body
|
|
75
|
-
* @return {Object[]} Array of W3C + MJSONWP compatible timeout objects
|
|
76
|
-
*/
|
|
77
|
-
getTimeoutRequestObjects(body) {
|
|
78
|
-
if (this.downstreamProtocol === W3C && _.has(body, 'ms') && _.has(body, 'type')) {
|
|
79
|
-
const typeToW3C = (x) => (x === 'page load' ? 'pageLoad' : x);
|
|
80
|
-
return [
|
|
81
|
-
{
|
|
82
|
-
[typeToW3C(body.type)]: body.ms,
|
|
83
|
-
},
|
|
84
|
-
];
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (this.downstreamProtocol === MJSONWP && (!_.has(body, 'ms') || !_.has(body, 'type'))) {
|
|
88
|
-
const typeToJSONWP = (x) => (x === 'pageLoad' ? 'page load' : x);
|
|
89
|
-
return (
|
|
90
|
-
_.toPairs(body)
|
|
91
|
-
// Only transform the entry if ms value is a valid positive float number
|
|
92
|
-
.filter((pair) => /^\d+(?:[.,]\d*?)?$/.test(`${pair[1]}`))
|
|
93
|
-
.map(function (pair) {
|
|
94
|
-
return {
|
|
95
|
-
type: typeToJSONWP(pair[0]),
|
|
96
|
-
ms: pair[1],
|
|
97
|
-
};
|
|
98
|
-
})
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return [body];
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Proxy an array of timeout objects and merge the result
|
|
107
|
-
* @param {string} url Endpoint url
|
|
108
|
-
* @param {string} method Endpoint method
|
|
109
|
-
* @param {import('@appium/types').HTTPBody} body Request body
|
|
110
|
-
* @returns {Promise<[import('@appium/types').ProxyResponse, import('@appium/types').HTTPBody]>}
|
|
111
|
-
*/
|
|
112
|
-
async proxySetTimeouts(url, method, body) {
|
|
113
|
-
let response, resBody;
|
|
114
|
-
|
|
115
|
-
const timeoutRequestObjects = this.getTimeoutRequestObjects(body);
|
|
116
|
-
this.log.debug(
|
|
117
|
-
`Will send the following request bodies to /timeouts: ${JSON.stringify(
|
|
118
|
-
timeoutRequestObjects
|
|
119
|
-
)}`
|
|
120
|
-
);
|
|
121
|
-
for (const timeoutObj of timeoutRequestObjects) {
|
|
122
|
-
[response, resBody] = await this.proxyFunc(url, method, timeoutObj);
|
|
123
|
-
|
|
124
|
-
// If we got a non-MJSONWP response, return the result, nothing left to do
|
|
125
|
-
if (this.downstreamProtocol !== MJSONWP) {
|
|
126
|
-
return [response, resBody];
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// If we got an error, return the error right away
|
|
130
|
-
if (response.statusCode >= 400) {
|
|
131
|
-
return [response, resBody];
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// ...Otherwise, continue to the next timeouts call
|
|
135
|
-
}
|
|
136
|
-
return [/** @type {import('@appium/types').ProxyResponse} */(response), resBody];
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
*
|
|
141
|
-
* @param {string} url
|
|
142
|
-
* @param {string} method
|
|
143
|
-
* @param {import('@appium/types').HTTPBody} body
|
|
144
|
-
* @returns {Promise<[import('@appium/types').ProxyResponse, import('@appium/types').HTTPBody]>}
|
|
145
|
-
*/
|
|
146
|
-
async proxySetWindow(url, method, body) {
|
|
147
|
-
const bodyObj = util.safeJsonParse(body);
|
|
148
|
-
if (_.isPlainObject(bodyObj)) {
|
|
149
|
-
if (this.downstreamProtocol === W3C && _.has(bodyObj, 'name') && !_.has(bodyObj, 'handle')) {
|
|
150
|
-
this.log.debug(
|
|
151
|
-
`Copied 'name' value '${/** @type {import('@appium/types').StringRecord} */ (bodyObj).name}' to 'handle' as per W3C spec`
|
|
152
|
-
);
|
|
153
|
-
return await this.proxyFunc(url, method, {
|
|
154
|
-
.../** @type {import('@appium/types').StringRecord} */ (bodyObj),
|
|
155
|
-
handle: /** @type {import('@appium/types').StringRecord} */ (bodyObj).name,
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
if (
|
|
159
|
-
this.downstreamProtocol === MJSONWP &&
|
|
160
|
-
_.has(bodyObj, 'handle') &&
|
|
161
|
-
!_.has(bodyObj, 'name')
|
|
162
|
-
) {
|
|
163
|
-
this.log.debug(
|
|
164
|
-
`Copied 'handle' value '${/** @type {import('@appium/types').StringRecord} */ (bodyObj).handle}' to 'name' as per JSONWP spec`
|
|
165
|
-
);
|
|
166
|
-
return await this.proxyFunc(url, method, {
|
|
167
|
-
.../** @type {import('@appium/types').StringRecord} */ (bodyObj),
|
|
168
|
-
name: /** @type {import('@appium/types').StringRecord} */ (bodyObj).handle,
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
return await this.proxyFunc(url, method, body);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
*
|
|
178
|
-
* @param {string} url
|
|
179
|
-
* @param {string} method
|
|
180
|
-
* @param {import('@appium/types').HTTPBody} body
|
|
181
|
-
* @returns {Promise<[import('@appium/types').ProxyResponse, import('@appium/types').HTTPBody]>}
|
|
182
|
-
*/
|
|
183
|
-
async proxySetValue(url, method, body) {
|
|
184
|
-
const bodyObj = util.safeJsonParse(body);
|
|
185
|
-
if (_.isPlainObject(bodyObj) && (util.hasValue(bodyObj.text) || util.hasValue(bodyObj.value))) {
|
|
186
|
-
let {text, value} = bodyObj;
|
|
187
|
-
if (util.hasValue(text) && !util.hasValue(value)) {
|
|
188
|
-
value = _.isString(text) ? [...text] : _.isArray(text) ? text : [];
|
|
189
|
-
this.log.debug(`Added 'value' property to 'setValue' request body`);
|
|
190
|
-
} else if (!util.hasValue(text) && util.hasValue(value)) {
|
|
191
|
-
text = _.isArray(value) ? value.join('') : _.isString(value) ? value : '';
|
|
192
|
-
this.log.debug(`Added 'text' property to 'setValue' request body`);
|
|
193
|
-
}
|
|
194
|
-
return await this.proxyFunc(
|
|
195
|
-
url,
|
|
196
|
-
method,
|
|
197
|
-
{
|
|
198
|
-
...bodyObj,
|
|
199
|
-
text,
|
|
200
|
-
value,
|
|
201
|
-
}
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
return await this.proxyFunc(url, method, body);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
*
|
|
210
|
-
* @param {string} url
|
|
211
|
-
* @param {string} method
|
|
212
|
-
* @param {import('@appium/types').HTTPBody} body
|
|
213
|
-
* @returns {Promise<[import('@appium/types').ProxyResponse, import('@appium/types').HTTPBody]>}
|
|
214
|
-
*/
|
|
215
|
-
async proxySetFrame(url, method, body) {
|
|
216
|
-
const bodyObj = util.safeJsonParse(body);
|
|
217
|
-
return _.has(bodyObj, 'id') && _.isPlainObject(bodyObj.id)
|
|
218
|
-
? await this.proxyFunc(url, method, {
|
|
219
|
-
...bodyObj,
|
|
220
|
-
id: duplicateKeys(bodyObj.id, MJSONWP_ELEMENT_KEY, W3C_ELEMENT_KEY),
|
|
221
|
-
})
|
|
222
|
-
: await this.proxyFunc(url, method, body);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
*
|
|
227
|
-
* @param {string} url
|
|
228
|
-
* @param {string} method
|
|
229
|
-
* @param {import('@appium/types').HTTPBody} body
|
|
230
|
-
* @returns {Promise<[import('@appium/types').ProxyResponse, import('@appium/types').HTTPBody]>}
|
|
231
|
-
*/
|
|
232
|
-
async proxyPerformActions(url, method, body) {
|
|
233
|
-
const bodyObj = util.safeJsonParse(body);
|
|
234
|
-
return _.isPlainObject(bodyObj)
|
|
235
|
-
? await this.proxyFunc(
|
|
236
|
-
url,
|
|
237
|
-
method,
|
|
238
|
-
duplicateKeys(bodyObj, MJSONWP_ELEMENT_KEY, W3C_ELEMENT_KEY)
|
|
239
|
-
)
|
|
240
|
-
: await this.proxyFunc(url, method, body);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
*
|
|
245
|
-
* @param {string} url
|
|
246
|
-
* @param {string} method
|
|
247
|
-
* @returns {Promise<[import('@appium/types').ProxyResponse, import('@appium/types').HTTPBody]>}
|
|
248
|
-
*/
|
|
249
|
-
async proxyReleaseActions(url, method) {
|
|
250
|
-
return await this.proxyFunc(url, method);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Handle "crossing" endpoints for the case
|
|
255
|
-
* when upstream and downstream drivers operate different protocols
|
|
256
|
-
*
|
|
257
|
-
* @param {string} commandName
|
|
258
|
-
* @param {string} url
|
|
259
|
-
* @param {string} method
|
|
260
|
-
* @param {import('@appium/types').HTTPBody} [body]
|
|
261
|
-
* @returns {Promise<[import('@appium/types').ProxyResponse, import('@appium/types').HTTPBody]>}
|
|
262
|
-
*/
|
|
263
|
-
async convertAndProxy(commandName, url, method, body) {
|
|
264
|
-
if (!this.downstreamProtocol) {
|
|
265
|
-
return await this.proxyFunc(url, method, body);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// Same url, but different arguments
|
|
269
|
-
switch (commandName) {
|
|
270
|
-
case 'timeouts':
|
|
271
|
-
return await this.proxySetTimeouts(url, method, body);
|
|
272
|
-
case 'setWindow':
|
|
273
|
-
return await this.proxySetWindow(url, method, body);
|
|
274
|
-
case 'setValue':
|
|
275
|
-
return await this.proxySetValue(url, method, body);
|
|
276
|
-
case 'performActions':
|
|
277
|
-
return await this.proxyPerformActions(url, method, body);
|
|
278
|
-
case 'releaseActions':
|
|
279
|
-
return await this.proxyReleaseActions(url, method);
|
|
280
|
-
case 'setFrame':
|
|
281
|
-
return await this.proxySetFrame(url, method, body);
|
|
282
|
-
default:
|
|
283
|
-
break;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
// Same arguments, but different URLs
|
|
287
|
-
for (const {commandNames, jsonwpConverter, w3cConverter} of COMMAND_URLS_CONFLICTS) {
|
|
288
|
-
if (!commandNames.includes(commandName)) {
|
|
289
|
-
continue;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
const rewrittenUrl =
|
|
293
|
-
this.downstreamProtocol === MJSONWP ? jsonwpConverter(url) : w3cConverter(url);
|
|
294
|
-
if (rewrittenUrl === url) {
|
|
295
|
-
this.log.debug(
|
|
296
|
-
`Did not know how to rewrite the original URL '${url}' ` +
|
|
297
|
-
`for ${this.downstreamProtocol} protocol`
|
|
298
|
-
);
|
|
299
|
-
break;
|
|
300
|
-
}
|
|
301
|
-
this.log.info(
|
|
302
|
-
`Rewrote the original URL '${url}' to '${rewrittenUrl}' ` +
|
|
303
|
-
`for ${this.downstreamProtocol} protocol`
|
|
304
|
-
);
|
|
305
|
-
return await this.proxyFunc(rewrittenUrl, method, body);
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
// No matches found. Proceed normally
|
|
309
|
-
return await this.proxyFunc(url, method, body);
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
export default ProtocolConverter;
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* @typedef {(url: string, method: string, body?: import('@appium/types').HTTPBody) => Promise<[import('@appium/types').ProxyResponse, import('@appium/types').HTTPBody]>} ProxyFunction
|
|
317
|
-
*/
|