@appium/execute-driver-plugin 1.0.1
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/LICENSE +201 -0
- package/README.md +65 -0
- package/build/index.js +10 -0
- package/build/lib/execute-child.js +129 -0
- package/build/lib/plugin.js +132 -0
- package/build/test/e2e/plugin-e2e-specs.js +137 -0
- package/build/test/unit/plugin-specs.js +16 -0
- package/build/tsconfig.tsbuildinfo +1 -0
- package/index.js +3 -0
- package/lib/execute-child.js +141 -0
- package/lib/plugin.js +147 -0
- package/package.json +47 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2021 OpenJS Foundation
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Appium Execute Driver Script Plugin
|
|
2
|
+
|
|
3
|
+
One downside of Appium's client-server architecture is that each command must travel across a network with potentially high latency. This is especially the case in situations where the Appium session takes place on a service provider's host machine rather than locally.
|
|
4
|
+
|
|
5
|
+
This command enables the batching of many commands together, to be executed in one go on the Appium server. The way this is accomplished is on the model of `executeScript`: the client will send in a string representing code to be executed. The Appium server will execute that code in the context of the current session, and return any values specified by the script.
|
|
6
|
+
|
|
7
|
+
## Prerequisites
|
|
8
|
+
|
|
9
|
+
* Appium Server 2.0+
|
|
10
|
+
|
|
11
|
+
## Installation - Server
|
|
12
|
+
|
|
13
|
+
Install the plugin using Appium's plugin CLI:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
appium plugin install execute-driver
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Installation - Client
|
|
20
|
+
|
|
21
|
+
No special action is needed to make the features available in the various Appium clients, as this plugin used to be a core Appium feature and its commands are already supported in the official clients.
|
|
22
|
+
|
|
23
|
+
## Activation
|
|
24
|
+
|
|
25
|
+
The plugin will not be active unless turned on when invoking the Appium server:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
appium --use-plugins=execute-driver
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
The command itself looks different based on the client you are using, so refer to your client docs. In WebdriverIO, for example, it would look something like:
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
await driver.executeDriver(script, timeout, type)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
There are three parameters accepted by this command (which may be collected by each client in its own way):
|
|
40
|
+
* `script`: the string consisting of the script itself
|
|
41
|
+
* `timeout`: a number representing the number of milliseconds to wait before killing the process running the driver script. Default is equivalent to 1 hour.
|
|
42
|
+
* `type`: a string representing the script language/API. Currently only one type, `webdriverio`, is supported (and it is the default).
|
|
43
|
+
|
|
44
|
+
Not just any code can run in this context. The code must be written in Javascript, and it will have access to a context with three objects:
|
|
45
|
+
* `driver`: a [WebdriverIO](https://webdriver.io/) driver object. It may be assumed this driver has already connected with the Appium server and is ready to run commands. The version of WebdriverIO used is the one installed according to the specification in `appium-base-driver`'s `package.json` file.
|
|
46
|
+
* `console`: a custom `console` object, with methods `log`, `warn`, and `error`, so that logging may take place.
|
|
47
|
+
* `Promise`: a Promise library ([Bluebird](http://bluebirdjs.com/docs/getting-started.html)), to make asynchronous work easier.
|
|
48
|
+
|
|
49
|
+
The code will be placed inside an `async` function, as below, so you are free to use `await`:
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
(async function (driver, console, Promise) {
|
|
53
|
+
// --> your script here <--
|
|
54
|
+
})()
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Any errors will result in an error response to the call to this command. Any return values will be wrapped up and sent back to your client in the following form:
|
|
58
|
+
|
|
59
|
+
```js
|
|
60
|
+
{result: <return value>, logs: {log: [], warn: [], error: []}}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Using this response object you can gather the return value as well as the output of any log statements you made.
|
|
64
|
+
|
|
65
|
+
The advantage of this approach of using WebdriverIO code is that you have access to a full programming language and Appium API, and can use any language or API features you need, including loops, conditionals, and explicit waits. The WebdriverIO API cannot be enumerated here, so visit the [WebdriverIO documentation](https://webdriver.io/docs/api.html) for more info.
|
package/build/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ExecuteDriverPlugin = void 0;
|
|
7
|
+
const plugin_1 = __importDefault(require("./lib/plugin"));
|
|
8
|
+
exports.ExecuteDriverPlugin = plugin_1.default;
|
|
9
|
+
exports.default = plugin_1.default;
|
|
10
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9pbmRleC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQSwwREFBK0M7QUFFdEMsOEJBRkYsZ0JBQW1CLENBRUU7QUFENUIsa0JBQWUsZ0JBQW1CLENBQUMifQ==
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MJSONWP_ELEMENT_KEY = exports.W3C_ELEMENT_KEY = void 0;
|
|
7
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
const bluebird_1 = __importDefault(require("bluebird"));
|
|
9
|
+
const vm2_1 = require("vm2");
|
|
10
|
+
const support_1 = require("@appium/support");
|
|
11
|
+
const webdriverio_1 = require("webdriverio");
|
|
12
|
+
const log = support_1.logger.getLogger('ExecuteDriver Child');
|
|
13
|
+
let send;
|
|
14
|
+
// duplicate defining these keys here so we don't need to re-load a huge appium
|
|
15
|
+
// dependency tree into memory just to run a wdio script
|
|
16
|
+
exports.W3C_ELEMENT_KEY = support_1.util.W3C_WEB_ELEMENT_IDENTIFIER;
|
|
17
|
+
exports.MJSONWP_ELEMENT_KEY = 'ELEMENT';
|
|
18
|
+
async function runScript(driverOpts, script, timeoutMs) {
|
|
19
|
+
if (!lodash_1.default.isNumber(timeoutMs)) {
|
|
20
|
+
throw new TypeError('Timeout parameter must be a number');
|
|
21
|
+
}
|
|
22
|
+
// set up fake logger
|
|
23
|
+
const logLevels = ['error', 'warn', 'log'];
|
|
24
|
+
const logs = {};
|
|
25
|
+
const consoleFns = {};
|
|
26
|
+
for (const level of logLevels) {
|
|
27
|
+
logs[level] = [];
|
|
28
|
+
consoleFns[level] = (...logMsgs) => logs[level].push(...logMsgs);
|
|
29
|
+
}
|
|
30
|
+
const driver = await (0, webdriverio_1.attach)(driverOpts);
|
|
31
|
+
const fullScript = buildScript(script);
|
|
32
|
+
log.info('Running driver script in Node vm');
|
|
33
|
+
const vmCtx = new vm2_1.NodeVM({ timeout: timeoutMs });
|
|
34
|
+
const vmFn = vmCtx.run(fullScript);
|
|
35
|
+
// run the driver script, giving user access to the driver object, a fake
|
|
36
|
+
// console logger, and a promise library
|
|
37
|
+
let result = await vmFn(driver, consoleFns, bluebird_1.default);
|
|
38
|
+
result = coerceScriptResult(result);
|
|
39
|
+
log.info('Successfully ensured driver script result is appropriate type for return');
|
|
40
|
+
return { result, logs };
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Embed a user-generated script inside a method which takes only the
|
|
44
|
+
* predetermined objects we specify
|
|
45
|
+
*
|
|
46
|
+
* @param {string} script - the javascript to execute
|
|
47
|
+
*
|
|
48
|
+
* @return {string} - the full script to execute
|
|
49
|
+
*/
|
|
50
|
+
function buildScript(script) {
|
|
51
|
+
return `module.exports = async function execute (driver, console, Promise) {
|
|
52
|
+
${script}
|
|
53
|
+
}`;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* We can get any manner of crazy thing back from a vm executing untrusted
|
|
57
|
+
* code. We might also get WebdriverIO objects that aren't suitable for JSON
|
|
58
|
+
* response. So make sure we convert the things we know about to their
|
|
59
|
+
* appropriate response format, and squash other weird things.
|
|
60
|
+
*
|
|
61
|
+
* @param {Object} obj - object to convert and sanitize
|
|
62
|
+
*
|
|
63
|
+
* @return {Object} - safely converted object
|
|
64
|
+
*/
|
|
65
|
+
function coerceScriptResult(obj) {
|
|
66
|
+
// first ensure obj is of a type that can be JSON encoded safely. This will
|
|
67
|
+
// get rid of custom objects, functions, etc... and turn them into POJOs
|
|
68
|
+
try {
|
|
69
|
+
obj = JSON.parse(JSON.stringify(obj));
|
|
70
|
+
}
|
|
71
|
+
catch (e) {
|
|
72
|
+
log.warn('Could not convert executeDriverScript to safe response!' +
|
|
73
|
+
`Result was: ${JSON.stringify(obj)}. Will make it null`);
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
let res;
|
|
77
|
+
// now we begin our recursive case options
|
|
78
|
+
if (lodash_1.default.isPlainObject(obj)) {
|
|
79
|
+
// if we have an object, it's either an element object or something else
|
|
80
|
+
// webdriverio has no monadic object types other than element and driver,
|
|
81
|
+
// and we don't want to allow special casing return of driver
|
|
82
|
+
res = {};
|
|
83
|
+
if (obj[exports.MJSONWP_ELEMENT_KEY] || obj[exports.W3C_ELEMENT_KEY]) {
|
|
84
|
+
// if it's an element object, clear out anything that's not the key, and then return the
|
|
85
|
+
// object. Note that if the element object contains only one element key type (MJSONWP or
|
|
86
|
+
// W3C), keep it that way in our response. But if the element contains both key types
|
|
87
|
+
// (because the client is being backwards compatible) then keep both keys in our response as
|
|
88
|
+
// well.
|
|
89
|
+
if (obj[exports.MJSONWP_ELEMENT_KEY]) {
|
|
90
|
+
res[exports.MJSONWP_ELEMENT_KEY] = obj[exports.MJSONWP_ELEMENT_KEY];
|
|
91
|
+
}
|
|
92
|
+
if (obj[exports.W3C_ELEMENT_KEY]) {
|
|
93
|
+
res[exports.W3C_ELEMENT_KEY] = obj[exports.W3C_ELEMENT_KEY];
|
|
94
|
+
}
|
|
95
|
+
return res;
|
|
96
|
+
}
|
|
97
|
+
// otherwise, recurse into the object
|
|
98
|
+
for (const key of Object.keys(obj)) {
|
|
99
|
+
res[key] = coerceScriptResult(obj[key]);
|
|
100
|
+
}
|
|
101
|
+
return res;
|
|
102
|
+
}
|
|
103
|
+
// also handle arrays
|
|
104
|
+
if (lodash_1.default.isArray(obj)) {
|
|
105
|
+
return obj.map(coerceScriptResult);
|
|
106
|
+
}
|
|
107
|
+
// base case, if it's not an object or array, return straightaway
|
|
108
|
+
return obj;
|
|
109
|
+
}
|
|
110
|
+
async function main(driverOpts, script, timeoutMs) {
|
|
111
|
+
let res;
|
|
112
|
+
try {
|
|
113
|
+
res = { success: await runScript(driverOpts, script, timeoutMs) };
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
res = { error: { message: error.message, stack: error.stack } };
|
|
117
|
+
}
|
|
118
|
+
await send(res);
|
|
119
|
+
}
|
|
120
|
+
// ensure we're running this script in IPC mode
|
|
121
|
+
if (require.main === module && lodash_1.default.isFunction(process.send)) {
|
|
122
|
+
send = bluebird_1.default.promisify(process.send, { context: process });
|
|
123
|
+
log.info('Running driver execution in child process');
|
|
124
|
+
process.on('message', ({ driverOpts, script, timeoutMs }) => {
|
|
125
|
+
log.info('Parameters received from parent process');
|
|
126
|
+
main(driverOpts, script, timeoutMs);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjoz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QyxJQUFJLENBQUMsMkNBQTJDLENBQUMsQ0FBQztJQUN0RCxPQUFPLENBQUMsRUFBRSxDQUFDLFNBQVMsRUFBRSxDQUFDLEVBQUMsVUFBVSxFQUFFLE1BQU0sRUFBRSxTQUFTLEVBQUMsRUFBRSxFQUFFO1FBQ3hELEdBQUcsQ0FBQyxJQUFJLENBQUMseUNBQXlDLENBQUMsQ0FBQztRQUNwRCxJQUFJLENBQUMsVUFBVSxFQUFFLE1BQU0sRUFBRSxTQUFTLENBQUMsQ0FBQztJQUN0QyxDQUFDLENBQUMsQ0FBQztDQUNKIn0=
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ExecuteDriverPlugin = void 0;
|
|
7
|
+
const base_plugin_1 = __importDefault(require("@appium/base-plugin"));
|
|
8
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
9
|
+
const child_process_1 = __importDefault(require("child_process"));
|
|
10
|
+
const support_1 = require("@appium/support");
|
|
11
|
+
const bluebird_1 = __importDefault(require("bluebird"));
|
|
12
|
+
const FEAT_FLAG = 'execute_driver_script';
|
|
13
|
+
const DEFAULT_SCRIPT_TIMEOUT_MS = 1000 * 60 * 60; // default to 1 hour timeout
|
|
14
|
+
const SCRIPT_TYPE_WDIO = 'webdriverio';
|
|
15
|
+
class ExecuteDriverPlugin extends base_plugin_1.default {
|
|
16
|
+
/**
|
|
17
|
+
* This method takes a string which is executed as javascript in the context of
|
|
18
|
+
* a new nodejs VM, and which has available a webdriverio driver object, having
|
|
19
|
+
* already been attached to the currently running session.
|
|
20
|
+
*
|
|
21
|
+
* @param {function} next - standard behaviour for executeDriverScript
|
|
22
|
+
* @param {BaseDriver} driver - Appium driver handling this command
|
|
23
|
+
* @param {string} script - the string representing the driver script to run
|
|
24
|
+
* @param {string} [scriptType='webdriverio'] - the name of the driver script
|
|
25
|
+
* library (currently only webdriverio is supported)
|
|
26
|
+
* @param {number} [timeoutMs=3600000] - timeout for the script process
|
|
27
|
+
*
|
|
28
|
+
* @returns {Object} - a JSONifiable object representing the return value of
|
|
29
|
+
* the script
|
|
30
|
+
*/
|
|
31
|
+
async executeDriverScript(next, driver, script, scriptType = 'webdriverio', timeoutMs = DEFAULT_SCRIPT_TIMEOUT_MS) {
|
|
32
|
+
if (!driver.isFeatureEnabled(FEAT_FLAG)) {
|
|
33
|
+
throw new Error(`Execute driver script functionality is not available ` +
|
|
34
|
+
`unless server is started with --allow-insecure including ` +
|
|
35
|
+
`the '${FEAT_FLAG}' flag, e.g., --allow-insecure=${FEAT_FLAG}`);
|
|
36
|
+
}
|
|
37
|
+
if (scriptType !== SCRIPT_TYPE_WDIO) {
|
|
38
|
+
throw new TypeError(`Only the '${SCRIPT_TYPE_WDIO}' script type is currently supported`);
|
|
39
|
+
}
|
|
40
|
+
if (!driver.serverHost || !driver.serverPort) {
|
|
41
|
+
throw new Error('Address or port of running server were not defined; this ' +
|
|
42
|
+
'is required. This is probably a programming error in the driver');
|
|
43
|
+
}
|
|
44
|
+
if (!lodash_1.default.isNumber(timeoutMs)) {
|
|
45
|
+
throw new TypeError('Timeout parameter must be a number');
|
|
46
|
+
}
|
|
47
|
+
const driverOpts = {
|
|
48
|
+
sessionId: driver.sessionId,
|
|
49
|
+
// Appium probably won't be behind ssl locally; if it ever is, might need to update this to
|
|
50
|
+
// provide a user configurable parameter
|
|
51
|
+
protocol: 'http',
|
|
52
|
+
hostname: driver.serverHost,
|
|
53
|
+
port: driver.serverPort,
|
|
54
|
+
path: driver.serverPath,
|
|
55
|
+
isW3C: true,
|
|
56
|
+
isMobile: true,
|
|
57
|
+
capabilities: driver.caps
|
|
58
|
+
};
|
|
59
|
+
this.logger.info(`Constructed webdriverio driver options; W3C mode is ${driverOpts.isW3C ? 'on' : 'off'}`);
|
|
60
|
+
// fork the execution script as a child process
|
|
61
|
+
const childScript = require.resolve('./execute-child.js');
|
|
62
|
+
this.logger.info(`Forking process to run webdriver script as child using ${childScript}`);
|
|
63
|
+
const scriptProc = child_process_1.default.fork(childScript);
|
|
64
|
+
// keep track of whether we have canceled the script timeout, so we can stop
|
|
65
|
+
// waiting for it and allow this process to finish gracefully
|
|
66
|
+
let timeoutCanceled = false;
|
|
67
|
+
try {
|
|
68
|
+
const timer = new support_1.timing.Timer();
|
|
69
|
+
timer.start();
|
|
70
|
+
// promise that deals with the result from the child process
|
|
71
|
+
const waitForResult = async () => {
|
|
72
|
+
const res = await new bluebird_1.default((res) => {
|
|
73
|
+
scriptProc.on('message', res); // this is node IPC
|
|
74
|
+
});
|
|
75
|
+
this.logger.info('Received execute driver script result from child process, shutting it down');
|
|
76
|
+
if (res.error) {
|
|
77
|
+
throw new Error(res.error.message);
|
|
78
|
+
}
|
|
79
|
+
return res.success;
|
|
80
|
+
};
|
|
81
|
+
// promise that waits up to the timeout and throws an error if so, or does
|
|
82
|
+
// nothing if the timeout is canceled because we got a result from the
|
|
83
|
+
// child script
|
|
84
|
+
const waitForTimeout = async () => {
|
|
85
|
+
while (!timeoutCanceled && timer.getDuration().asMilliSeconds < timeoutMs) {
|
|
86
|
+
await bluebird_1.default.delay(500);
|
|
87
|
+
}
|
|
88
|
+
if (timeoutCanceled) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
throw new Error(`Execute driver script timed out after ${timeoutMs}ms. ` +
|
|
92
|
+
`You can adjust this with the 'timeout' parameter.`);
|
|
93
|
+
};
|
|
94
|
+
// now that the child script is alive, send it the data it needs to start
|
|
95
|
+
// running the driver script
|
|
96
|
+
this.logger.info('Sending driver and script data to child');
|
|
97
|
+
scriptProc.send({ driverOpts, script, timeoutMs });
|
|
98
|
+
// and set up a race between the response from the child and the timeout
|
|
99
|
+
return await bluebird_1.default.race([waitForResult(), waitForTimeout()]);
|
|
100
|
+
}
|
|
101
|
+
catch (err) {
|
|
102
|
+
throw new Error(`Could not execute driver script. Original error was: ${err}`);
|
|
103
|
+
}
|
|
104
|
+
finally {
|
|
105
|
+
// ensure we always cancel the timeout so that the timeout promise stops
|
|
106
|
+
// spinning and allows this process to die gracefully
|
|
107
|
+
timeoutCanceled = true;
|
|
108
|
+
if (scriptProc.connected) {
|
|
109
|
+
this.logger.info('Disconnecting from child proc');
|
|
110
|
+
scriptProc.disconnect();
|
|
111
|
+
}
|
|
112
|
+
if (scriptProc.exitCode === null) {
|
|
113
|
+
this.logger.info('Disconnecting from and killing driver script child proc');
|
|
114
|
+
scriptProc.kill();
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
this.logger.info('Script already ended on its own, no need to kill it');
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
exports.default = ExecuteDriverPlugin;
|
|
123
|
+
exports.ExecuteDriverPlugin = ExecuteDriverPlugin;
|
|
124
|
+
ExecuteDriverPlugin.newMethodMap = {
|
|
125
|
+
'/session/:sessionId/appium/execute_driver': {
|
|
126
|
+
POST: {
|
|
127
|
+
command: 'executeDriverScript',
|
|
128
|
+
payloadParams: { required: ['script'], optional: ['type', 'timeout'] }
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2luLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vbGliL3BsdWdpbi5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQSxzRUFBNkM7QUFDN0Msb0RBQXVCO0FBQ3ZCLGtFQUErQjtBQUMvQiw2Q0FBeUM7QUFDekMsd0RBQXlCO0FBRXpCLE1BQU0sU0FBUyxHQUFHLHVCQUF1QixDQUFDO0FBQzFDLE1BQU0seUJBQXlCLEdBQUcsSUFBSSxH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esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const path_1 = __importDefault(require("path"));
|
|
7
|
+
const APPIUM_HOME = path_1.default.resolve(__dirname, '..', '..', '..', 'local_appium_home');
|
|
8
|
+
// need to assign this before appium is imported via e2eSetup
|
|
9
|
+
process.env.APPIUM_HOME = APPIUM_HOME;
|
|
10
|
+
const helpers_1 = require("@appium/base-plugin/build/test/helpers");
|
|
11
|
+
const webdriverio_1 = require("webdriverio");
|
|
12
|
+
const chai_1 = __importDefault(require("chai"));
|
|
13
|
+
const chai_as_promised_1 = __importDefault(require("chai-as-promised"));
|
|
14
|
+
const execute_child_1 = require("../../lib/execute-child");
|
|
15
|
+
chai_1.default.use(chai_as_promised_1.default);
|
|
16
|
+
const should = chai_1.default.should();
|
|
17
|
+
const THIS_PLUGIN_DIR = path_1.default.resolve(__dirname, '..', '..', '..');
|
|
18
|
+
const TEST_HOST = 'localhost';
|
|
19
|
+
const TEST_FAKE_APP = path_1.default.join(APPIUM_HOME, '@appium', 'fake-driver', 'node_modules', '@appium', 'fake-driver', 'test', 'fixtures', 'app.xml');
|
|
20
|
+
const TEST_CAPS = {
|
|
21
|
+
platformName: 'Fake',
|
|
22
|
+
'appium:automationName': 'Fake',
|
|
23
|
+
'appium:deviceName': 'Fake',
|
|
24
|
+
'appium:app': TEST_FAKE_APP
|
|
25
|
+
};
|
|
26
|
+
const WDIO_OPTS = {
|
|
27
|
+
hostname: TEST_HOST,
|
|
28
|
+
connectionRetryCount: 0,
|
|
29
|
+
capabilities: TEST_CAPS
|
|
30
|
+
};
|
|
31
|
+
describe('ExecuteDriverPlugin', function () {
|
|
32
|
+
let server, driver;
|
|
33
|
+
const basicScript = `return 'foo'`;
|
|
34
|
+
const e2eSetupOpts = {
|
|
35
|
+
before, after, server, host: TEST_HOST, driverName: 'fake', driverSource: 'npm',
|
|
36
|
+
driverSpec: '@appium/fake-driver', pluginName: 'execute-driver', pluginSource: 'local',
|
|
37
|
+
pluginSpec: THIS_PLUGIN_DIR,
|
|
38
|
+
};
|
|
39
|
+
describe('without --allow-insecure set', function () {
|
|
40
|
+
after(async function () { driver && await driver.deleteSession(); });
|
|
41
|
+
(0, helpers_1.e2eSetup)({ ...e2eSetupOpts, serverArgs: { allowInsecure: false } });
|
|
42
|
+
it('should not work unless the allowInsecure feature flag is set', async function () {
|
|
43
|
+
driver = await (0, webdriverio_1.remote)({ ...WDIO_OPTS, port: this.port });
|
|
44
|
+
await driver.driverScript(basicScript).should.eventually.be
|
|
45
|
+
.rejectedWith(/allow-insecure.+execute_driver_script/i);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
describe('with --allow-insecure set', function () {
|
|
49
|
+
after(async function () { driver && await driver.deleteSession(); });
|
|
50
|
+
(0, helpers_1.e2eSetup)({ ...e2eSetupOpts, serverArgs: { allowInsecure: ['execute_driver_script'] } });
|
|
51
|
+
before(async function () { driver = await (0, webdriverio_1.remote)({ ...WDIO_OPTS, port: this.port }); });
|
|
52
|
+
it('should execute a webdriverio script in the context of session', async function () {
|
|
53
|
+
const script = `
|
|
54
|
+
const timeouts = await driver.getTimeouts();
|
|
55
|
+
const status = await driver.status();
|
|
56
|
+
return [timeouts, status];
|
|
57
|
+
`;
|
|
58
|
+
const expectedTimeouts = { command: 60000, implicit: 0 };
|
|
59
|
+
const { result, logs } = await driver.driverScript(script);
|
|
60
|
+
result[0].should.eql(expectedTimeouts);
|
|
61
|
+
should.exist(result[1].build);
|
|
62
|
+
should.exist(result[1].build.version);
|
|
63
|
+
logs.should.eql({ error: [], warn: [], log: [] });
|
|
64
|
+
});
|
|
65
|
+
it('should fail with any script type other than webdriverio currently', async function () {
|
|
66
|
+
const script = `return 'foo'`;
|
|
67
|
+
await driver.driverScript(script, 'wd')
|
|
68
|
+
.should.eventually.be.rejectedWith(/webdriverio/);
|
|
69
|
+
});
|
|
70
|
+
it('should execute a webdriverio script that returns elements correctly', async function () {
|
|
71
|
+
const script = `
|
|
72
|
+
return await driver.$("#Button1");
|
|
73
|
+
`;
|
|
74
|
+
const { result } = await driver.driverScript(script);
|
|
75
|
+
result.should.eql({
|
|
76
|
+
[execute_child_1.W3C_ELEMENT_KEY]: '1',
|
|
77
|
+
[execute_child_1.MJSONWP_ELEMENT_KEY]: '1',
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
it('should execute a webdriverio script that returns elements in deep structure', async function () {
|
|
81
|
+
const script = `
|
|
82
|
+
const el = await driver.$("#Button1");
|
|
83
|
+
return {element: el, elements: [el, el]};
|
|
84
|
+
`;
|
|
85
|
+
const { result } = await driver.driverScript(script);
|
|
86
|
+
const elObj = {
|
|
87
|
+
[execute_child_1.W3C_ELEMENT_KEY]: '1',
|
|
88
|
+
[execute_child_1.MJSONWP_ELEMENT_KEY]: '1'
|
|
89
|
+
};
|
|
90
|
+
result.should.eql({ element: elObj, elements: [elObj, elObj] });
|
|
91
|
+
});
|
|
92
|
+
it('should store and return logs to the user', async function () {
|
|
93
|
+
const script = `
|
|
94
|
+
console.log("foo");
|
|
95
|
+
console.log("foo2");
|
|
96
|
+
console.warn("bar");
|
|
97
|
+
console.error("baz");
|
|
98
|
+
return null;
|
|
99
|
+
`;
|
|
100
|
+
const { logs } = await driver.driverScript(script);
|
|
101
|
+
logs.should.eql({ log: ['foo', 'foo2'], warn: ['bar'], error: ['baz'] });
|
|
102
|
+
});
|
|
103
|
+
it('should have appium specific commands available', async function () {
|
|
104
|
+
const script = `
|
|
105
|
+
return typeof driver.lock;
|
|
106
|
+
`;
|
|
107
|
+
const { result } = await driver.driverScript(script);
|
|
108
|
+
result.should.eql('function');
|
|
109
|
+
});
|
|
110
|
+
it('should correctly handle errors that happen in a webdriverio script', async function () {
|
|
111
|
+
const script = `
|
|
112
|
+
return await driver.$("~notfound");
|
|
113
|
+
`;
|
|
114
|
+
const { result } = await driver.driverScript(script);
|
|
115
|
+
result.error.error.should.equal('no such element');
|
|
116
|
+
result.error.message.should.match(/element could not be located/);
|
|
117
|
+
result.error.stacktrace.should.includes('NoSuchElementError:');
|
|
118
|
+
result.selector.should.equal('~notfound');
|
|
119
|
+
result.sessionId.should.equal(driver.sessionId);
|
|
120
|
+
});
|
|
121
|
+
it('should correctly handle errors that happen when a script cannot be compiled', async function () {
|
|
122
|
+
const script = `
|
|
123
|
+
return {;
|
|
124
|
+
`;
|
|
125
|
+
await driver.driverScript(script).should.eventually.be.rejectedWith(/Could not execute driver script.+Unexpected token/);
|
|
126
|
+
});
|
|
127
|
+
it('should be able to set a timeout on a driver script', async function () {
|
|
128
|
+
const script = `
|
|
129
|
+
await Promise.delay(1000);
|
|
130
|
+
return true;
|
|
131
|
+
`;
|
|
132
|
+
await driver.driverScript(script, 'webdriverio', 50)
|
|
133
|
+
.should.eventually.be.rejectedWith(/.+50.+timeout.+/);
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2luLWUyZS1zcGVjcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Rlc3QvZTJlL3BsdWdpbi1lMmUtc3BlY3MuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSxnREFBd0I7QUFDeEIsTUFBTSxXQUFXLEdBQUcsY0FBSSxDQUFDLE9BQU8sQ0FBQyxTQUFTLEVBQUUsSUFBSSxFQUFFLElBQUksRUFBRSxJQUFJLEVBQUUsbUJBQW1CLENBQUMsQ0FBQztBQUNuRiw2REFBNkQ7QUFDN0QsT0FBTyxDQUFDLEdBQUcsQ0FBQyxXQUFXLEdBQUcsV0FBVyxDQUFDO0FBRXRDLG9FQUFrRTtBQUNsRSw2Q0FBNkM7QUFDN0MsZ0RBQXdCO0FBQ3hCLHdFQUE4QztBQUM5QywyREFBK0U7QUFFL0UsY0FBSSxDQUFDLEdBQUc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UMscUJBQXFCLENBQUMsQ0FBQztZQUMvRCxNQUFNLENBQUMsUUFBUSxDQUFDLE1BQU0sQ0FBQyxLQUFLLENBQUMsV0FBVyxDQUFDLENBQUM7WUFDMUMsTUFBTSxDQUFDLFNBQVMsQ0FBQyxNQUFNLENBQUMsS0FBSyxDQUFDLE1BQU0sQ0FBQyxTQUFTLENBQUMsQ0FBQztRQUNsRCxDQUFDLENBQUMsQ0FBQztRQUVILEVBQUUsQ0FBQyw2RUFBNkUsRUFBRSxLQUFLO1lBQ3JGLE1BQU0sTUFBTSxHQUFHOztPQUVkLENBQUM7WUFDRixNQUFNLE1BQU0sQ0FBQyxZQUFZLENBQUMsTUFBTSxDQUFDLENBQUMsTUFBTSxDQUFDLFVBQVUsQ0FBQyxFQUFFLENBQUMsWUFBWSxDQUNoRSxtREFBbUQsQ0FBQyxDQUFDO1FBQzFELENBQUMsQ0FBQyxDQUFDO1FBRUgsRUFBRSxDQUFDLG9EQUFvRCxFQUFFLEtBQUs7WUFDNUQsTUFBTSxNQUFNLEdBQUc7OztPQUdkLENBQUM7WUFDRixNQUFNLE1BQU0sQ0FBQyxZQUFZLENBQUMsTUFBTSxFQUFFLGFBQWEsRUFBRSxFQUFFLENBQUM7aUJBQ2pELE1BQU0sQ0FBQyxVQUFVLENBQUMsRUFBRSxDQUFDLFlBQVksQ0FBQyxpQkFBaUIsQ0FBQyxDQUFDO1FBQzFELENBQUMsQ0FBQyxDQUFDO0lBQ0wsQ0FBQyxDQUFDLENBQUM7QUFDTCxDQUFDLENBQUMsQ0FBQyJ9
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const index_1 = require("../../index");
|
|
7
|
+
const chai_1 = __importDefault(require("chai"));
|
|
8
|
+
const chai_as_promised_1 = __importDefault(require("chai-as-promised"));
|
|
9
|
+
chai_1.default.use(chai_as_promised_1.default);
|
|
10
|
+
const should = chai_1.default.should();
|
|
11
|
+
describe('execute driver plugin', function () {
|
|
12
|
+
it('should exist', function () {
|
|
13
|
+
should.exist(index_1.ExecuteDriverPlugin);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2luLXNwZWNzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vdGVzdC91bml0L3BsdWdpbi1zcGVjcy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLHVDQUFrRDtBQUNsRCxnREFBd0I7QUFDeEIsd0VBQThDO0FBRTlDLGNBQUksQ0FBQyxHQUFHLENBQUMsMEJBQWMsQ0FBQyxDQUFDO0FBQ3pCLE1BQU0sTUFBTSxHQUFHLGNBQUksQ0FBQyxNQUFNLEVBQUUsQ0FBQztBQUU3QixRQUFRLENBQUMsdUJBQXVCLEVBQUU7SUFDaEMsRUFBRSxDQUFDLGNBQWMsRUFBRTtRQUNqQixNQUFNLENBQUMsS0FBSyxDQUFDLDJCQUFtQixDQUFDLENBQUM7SUFDcEMsQ0FBQyxDQUFDLENBQUM7QUFDTCxDQUFDLENBQUMsQ0FBQyJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"program":{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../../node_modules/typescript/lib/lib.scripthost.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.full.d.ts","../../base/node_modules/@types/node/assert.d.ts","../../base/node_modules/@types/node/assert/strict.d.ts","../../base/node_modules/@types/node/globals.d.ts","../../base/node_modules/@types/node/async_hooks.d.ts","../../base/node_modules/@types/node/buffer.d.ts","../../base/node_modules/@types/node/child_process.d.ts","../../base/node_modules/@types/node/cluster.d.ts","../../base/node_modules/@types/node/console.d.ts","../../base/node_modules/@types/node/constants.d.ts","../../base/node_modules/@types/node/crypto.d.ts","../../base/node_modules/@types/node/dgram.d.ts","../../base/node_modules/@types/node/diagnostics_channel.d.ts","../../base/node_modules/@types/node/dns.d.ts","../../base/node_modules/@types/node/dns/promises.d.ts","../../base/node_modules/@types/node/domain.d.ts","../../base/node_modules/@types/node/events.d.ts","../../base/node_modules/@types/node/fs.d.ts","../../base/node_modules/@types/node/fs/promises.d.ts","../../base/node_modules/@types/node/http.d.ts","../../base/node_modules/@types/node/http2.d.ts","../../base/node_modules/@types/node/https.d.ts","../../base/node_modules/@types/node/inspector.d.ts","../../base/node_modules/@types/node/module.d.ts","../../base/node_modules/@types/node/net.d.ts","../../base/node_modules/@types/node/os.d.ts","../../base/node_modules/@types/node/path.d.ts","../../base/node_modules/@types/node/perf_hooks.d.ts","../../base/node_modules/@types/node/process.d.ts","../../base/node_modules/@types/node/punycode.d.ts","../../base/node_modules/@types/node/querystring.d.ts","../../base/node_modules/@types/node/readline.d.ts","../../base/node_modules/@types/node/repl.d.ts","../../base/node_modules/@types/node/stream.d.ts","../../base/node_modules/@types/node/stream/promises.d.ts","../../base/node_modules/@types/node/stream/consumers.d.ts","../../base/node_modules/@types/node/stream/web.d.ts","../../base/node_modules/@types/node/string_decoder.d.ts","../../base/node_modules/@types/node/timers.d.ts","../../base/node_modules/@types/node/timers/promises.d.ts","../../base/node_modules/@types/node/tls.d.ts","../../base/node_modules/@types/node/trace_events.d.ts","../../base/node_modules/@types/node/tty.d.ts","../../base/node_modules/@types/node/url.d.ts","../../base/node_modules/@types/node/util.d.ts","../../base/node_modules/@types/node/v8.d.ts","../../base/node_modules/@types/node/vm.d.ts","../../base/node_modules/@types/node/wasi.d.ts","../../base/node_modules/@types/node/worker_threads.d.ts","../../base/node_modules/@types/node/zlib.d.ts","../../base/node_modules/@types/node/globals.global.d.ts","../../base/node_modules/@types/node/index.d.ts","../../base/node_modules/@types/range-parser/index.d.ts","../../base/node_modules/@types/qs/index.d.ts","../../base/node_modules/@types/express-serve-static-core/index.d.ts","../../base/node_modules/@types/mime/index.d.ts","../../base/node_modules/@types/serve-static/index.d.ts","../../base/node_modules/@types/connect/index.d.ts","../../base/node_modules/@types/body-parser/index.d.ts","../../base/node_modules/@types/express/index.d.ts","../../base/node_modules/@appium/base-driver/index.d.ts","../../base/index.d.ts","../lib/plugin.js","../index.js","../node_modules/vm2/index.d.ts","../../../node_modules/make-error/index.d.ts","../../../node_modules/typescript/lib/typescript.d.ts","../../../node_modules/ts-node/dist/ts-compiler-types.d.ts","../../../node_modules/ts-node/dist/esm.d.ts","../../../node_modules/ts-node/dist/repl.d.ts","../../../node_modules/ts-node/dist/transpilers/types.d.ts","../../../node_modules/ts-node/dist/index.d.ts","../node_modules/@wdio/types/build/frameworks.d.ts","../node_modules/@wdio/types/build/services.d.ts","../node_modules/@wdio/types/build/reporters.d.ts","../node_modules/@wdio/types/build/options.d.ts","../node_modules/@wdio/types/build/capabilities.d.ts","../node_modules/@wdio/types/build/clients.d.ts","../node_modules/@wdio/types/build/workers.d.ts","../node_modules/@wdio/types/build/index.d.ts","../node_modules/webdriverio/build/utils/severeserviceerror.d.ts","../node_modules/devtools/build/constants.d.ts","../node_modules/@wdio/protocols/build/types.d.ts","../node_modules/@wdio/protocols/build/commands/appium.d.ts","../node_modules/@wdio/protocols/build/commands/chromium.d.ts","../node_modules/@wdio/protocols/build/commands/gecko.d.ts","../node_modules/@wdio/protocols/build/commands/jsonwp.d.ts","../node_modules/@wdio/protocols/build/commands/mjsonwp.d.ts","../node_modules/@wdio/protocols/build/commands/saucelabs.d.ts","../node_modules/@wdio/protocols/build/commands/selenium.d.ts","../node_modules/@wdio/protocols/build/commands/webdriver.d.ts","../node_modules/@wdio/protocols/build/index.d.ts","../node_modules/puppeteer-core/node_modules/devtools-protocol/types/protocol.d.ts","../node_modules/puppeteer-core/node_modules/devtools-protocol/types/protocol-mapping.d.ts","../node_modules/puppeteer-core/lib/types.d.ts","../node_modules/devtools/build/types.d.ts","../node_modules/devtools/build/index.d.ts","../node_modules/webdriver/build/request/index.d.ts","../node_modules/webdriver/build/types.d.ts","../node_modules/webdriver/build/command.d.ts","../node_modules/webdriver/build/constants.d.ts","../node_modules/webdriver/build/utils.d.ts","../node_modules/webdriver/build/index.d.ts","../node_modules/puppeteer-core/lib/cjs/vendor/mitt/src/index.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/eventemitter.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/connectiontransport.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/errors.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/connection.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/dialog.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/uskeyboardlayout.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/evaltypes.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/jshandle.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/helper.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/securitydetails.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/httpresponse.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/httprequest.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/lifecyclewatcher.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/timeoutsettings.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/input.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/domworld.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/executioncontext.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/networkmanager.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/framemanager.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/tracing.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/coverage.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/webworker.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/puppeteerviewport.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/accessibility.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/filechooser.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/consolemessage.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/pdfoptions.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/taskqueue.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/page.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/target.d.ts","../node_modules/puppeteer-core/lib/cjs/puppeteer/common/browser.d.ts","../node_modules/webdriverio/build/commands/browser/$$.d.ts","../node_modules/webdriverio/build/commands/browser/$.d.ts","../node_modules/webdriverio/build/commands/browser/call.d.ts","../node_modules/webdriverio/build/commands/browser/custom$$.d.ts","../node_modules/webdriverio/build/commands/browser/custom$.d.ts","../node_modules/webdriverio/build/commands/browser/debug.d.ts","../node_modules/webdriverio/build/commands/browser/deletecookies.d.ts","../node_modules/webdriverio/build/commands/browser/execute.d.ts","../node_modules/webdriverio/build/commands/browser/executeasync.d.ts","../node_modules/webdriverio/build/commands/browser/getcookies.d.ts","../node_modules/webdriverio/build/commands/browser/getpuppeteer.d.ts","../node_modules/webdriverio/build/commands/browser/getwindowsize.d.ts","../node_modules/webdriverio/build/commands/browser/keys.d.ts","../node_modules/webdriverio/build/utils/interception/types.d.ts","../node_modules/devtools-protocol/types/protocol.d.ts","../node_modules/webdriverio/build/utils/interception/index.d.ts","../node_modules/webdriverio/build/commands/browser/mock.d.ts","../node_modules/webdriverio/build/commands/browser/mockclearall.d.ts","../node_modules/webdriverio/build/commands/browser/mockrestoreall.d.ts","../node_modules/webdriverio/build/commands/browser/newwindow.d.ts","../node_modules/webdriverio/build/commands/browser/pause.d.ts","../node_modules/webdriverio/build/commands/browser/react$$.d.ts","../node_modules/webdriverio/build/commands/browser/react$.d.ts","../node_modules/webdriverio/build/commands/browser/reloadsession.d.ts","../node_modules/webdriverio/build/commands/browser/savepdf.d.ts","../node_modules/webdriverio/build/commands/browser/saverecordingscreen.d.ts","../node_modules/webdriverio/build/commands/browser/savescreenshot.d.ts","../node_modules/webdriverio/build/commands/browser/setcookies.d.ts","../node_modules/webdriverio/build/commands/browser/settimeout.d.ts","../node_modules/webdriverio/build/commands/browser/setwindowsize.d.ts","../node_modules/webdriverio/build/commands/browser/switchwindow.d.ts","../node_modules/webdriverio/build/commands/browser/throttle.d.ts","../node_modules/webdriverio/build/commands/browser/touchaction.d.ts","../node_modules/webdriverio/build/commands/browser/uploadfile.d.ts","../node_modules/webdriverio/build/commands/browser/url.d.ts","../node_modules/webdriverio/build/commands/browser/waituntil.d.ts","../node_modules/webdriverio/build/commands/browser.d.ts","../node_modules/webdriverio/build/commands/element/$$.d.ts","../node_modules/webdriverio/build/commands/element/$.d.ts","../node_modules/webdriverio/build/commands/element/addvalue.d.ts","../node_modules/webdriverio/build/commands/element/clearvalue.d.ts","../node_modules/webdriverio/build/commands/element/click.d.ts","../node_modules/webdriverio/build/commands/element/custom$$.d.ts","../node_modules/webdriverio/build/commands/element/custom$.d.ts","../node_modules/webdriverio/build/commands/element/doubleclick.d.ts","../node_modules/webdriverio/build/commands/element/draganddrop.d.ts","../node_modules/webdriverio/build/commands/element/getattribute.d.ts","../node_modules/webdriverio/build/commands/element/getcssproperty.d.ts","../node_modules/webdriverio/build/commands/element/getcomputedrole.d.ts","../node_modules/webdriverio/build/commands/element/getcomputedlabel.d.ts","../node_modules/webdriverio/build/commands/element/gethtml.d.ts","../node_modules/webdriverio/build/commands/element/getlocation.d.ts","../node_modules/webdriverio/build/commands/element/getproperty.d.ts","../node_modules/webdriverio/build/commands/element/getsize.d.ts","../node_modules/webdriverio/build/commands/element/gettagname.d.ts","../node_modules/webdriverio/build/commands/element/gettext.d.ts","../node_modules/webdriverio/build/commands/element/getvalue.d.ts","../node_modules/webdriverio/build/commands/element/isclickable.d.ts","../node_modules/webdriverio/build/commands/element/isdisplayed.d.ts","../node_modules/webdriverio/build/commands/element/isdisplayedinviewport.d.ts","../node_modules/webdriverio/build/commands/element/isenabled.d.ts","../node_modules/webdriverio/build/commands/element/isequal.d.ts","../node_modules/webdriverio/build/commands/element/isexisting.d.ts","../node_modules/webdriverio/build/commands/element/isfocused.d.ts","../node_modules/webdriverio/build/commands/element/isselected.d.ts","../node_modules/webdriverio/build/commands/element/moveto.d.ts","../node_modules/webdriverio/build/commands/element/nextelement.d.ts","../node_modules/webdriverio/build/commands/element/parentelement.d.ts","../node_modules/webdriverio/build/commands/element/previouselement.d.ts","../node_modules/webdriverio/build/commands/element/react$$.d.ts","../node_modules/webdriverio/build/commands/element/react$.d.ts","../node_modules/webdriverio/build/commands/element/savescreenshot.d.ts","../node_modules/webdriverio/build/commands/element/scrollintoview.d.ts","../node_modules/webdriverio/build/commands/element/selectbyattribute.d.ts","../node_modules/webdriverio/build/commands/element/selectbyindex.d.ts","../node_modules/webdriverio/build/commands/element/selectbyvisibletext.d.ts","../node_modules/webdriverio/build/commands/element/setvalue.d.ts","../node_modules/webdriverio/build/commands/element/shadow$$.d.ts","../node_modules/webdriverio/build/commands/element/shadow$.d.ts","../node_modules/webdriverio/build/commands/element/touchaction.d.ts","../node_modules/webdriverio/build/commands/element/waitforclickable.d.ts","../node_modules/webdriverio/build/commands/element/waitfordisplayed.d.ts","../node_modules/webdriverio/build/commands/element/waitforenabled.d.ts","../node_modules/webdriverio/build/commands/element/waitforexist.d.ts","../node_modules/webdriverio/build/commands/element/waituntil.d.ts","../node_modules/webdriverio/build/commands/element.d.ts","../node_modules/webdriverio/build/utils/interception/devtools.d.ts","../node_modules/webdriverio/build/types.d.ts","../node_modules/webdriverio/build/index.d.ts","../lib/execute-child.js","../test/e2e/plugin-e2e-specs.js","../test/unit/plugin-specs.js","../../../node_modules/@types/mocha/index.d.ts","../node_modules/webdriverio/async.d.ts","../node_modules/@types/node/index.d.ts"],"fileInfos":[{"version":"89f78430e422a0f06d13019d60d5a45b37ec2d28e67eb647f73b1b0d19a46b72","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940",{"version":"abba1071bfd89e55e88a054b0c851ea3e8a494c340d0f3fab19eb18f6afb0c9e","affectsGlobalScope":true},{"version":"927cb2b60048e1395b183bf74b2b80a75bdb1dbe384e1d9fac654313ea2fb136","affectsGlobalScope":true},{"version":"7fac8cb5fc820bc2a59ae11ef1c5b38d3832c6d0dfaec5acdb5569137d09a481","affectsGlobalScope":true},{"version":"097a57355ded99c68e6df1b738990448e0bf170e606707df5a7c0481ff2427cd","affectsGlobalScope":true},{"version":"d8996609230d17e90484a2dd58f22668f9a05a3bfe00bfb1d6271171e54a31fb","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"4378fc8122ec9d1a685b01eb66c46f62aba6b239ca7228bb6483bcf8259ee493","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"1b3fe904465430e030c93239a348f05e1be80640d91f2f004c3512c2c2c89f34","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"d071129cba6a5f2700be09c86c07ad2791ab67d4e5ed1eb301d6746c62745ea4","affectsGlobalScope":true},{"version":"10bbdc1981b8d9310ee75bfac28ee0477bb2353e8529da8cff7cb26c409cb5e8","affectsGlobalScope":true},"32b8443be144970b813b9dd72dcdba2059fbdfdae4d3a50c4d8a158ed6057bbe","0cba3a5d7b81356222594442753cf90dd2892e5ccfe1d262aaca6896ba6c1380","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"c2ab70bbc7a24c42a790890739dd8a0ba9d2e15038b40dff8163a97a5d148c00","affectsGlobalScope":true},"422dbb183fdced59425ca072c8bd09efaa77ce4e2ab928ec0d8a1ce062d2a45a",{"version":"2a801b0322994c3dd7f0ef30265d19b3dd3bae6d793596879166ed6219c3da68","affectsGlobalScope":true},"1dab5ab6bcf11de47ab9db295df8c4f1d92ffa750e8f095e88c71ce4c3299628","f71f46ccd5a90566f0a37b25b23bc4684381ab2180bdf6733f4e6624474e1894",{"version":"54e65985a3ee3cec182e6a555e20974ea936fc8b8d1738c14e8ed8a42bd921d4","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","bcc8caf03ee65fe8610d258752f255fbdddbb2e4de7b6c5628956a5a0d859ec8","34e5de87d983bc6aefef8b17658556e3157003e8d9555d3cb098c6bef0b5fbc8","cc0b61316c4f37393f1f9595e93b673f4184e9d07f4c127165a490ec4a928668","f27371653aded82b2b160f7a7033fb4a5b1534b6f6081ef7be1468f0f15327d3","c762cd6754b13a461c54b59d0ae0ab7aeef3c292c6cf889873f786ee4d8e75c9","f4ea7d5df644785bd9fbf419930cbaec118f0d8b4160037d2339b8e23c059e79",{"version":"c28e5baab1b53377c90d12970e207a2644bc3627840066449e37e2a59125d07e","affectsGlobalScope":true},"7a5459efa09ea82088234e6533a203d528c594b01787fb90fba148885a36e8b6","ae97e20f2e10dbeec193d6a2f9cd9a367a1e293e7d6b33b68bacea166afd7792","10d4796a130577d57003a77b95d8723530bbec84718e364aa2129fa8ffba0378","ad41bb744149e92adb06eb953da195115620a3f2ad48e7d3ae04d10762dae197","bf73c576885408d4a176f44a9035d798827cc5020d58284cb18d7573430d9022","7ae078ca42a670445ae0c6a97c029cb83d143d62abd1730efb33f68f0b2c0e82",{"version":"e8b18c6385ff784228a6f369694fcf1a6b475355ba89090a88de13587a9391d5","affectsGlobalScope":true},"5d0a9ea09d990b5788f867f1c79d4878f86f7384cb7dab38eecbf22f9efd063d","12eea70b5e11e924bb0543aea5eadc16ced318aa26001b453b0d561c2fd0bd1e","08777cd9318d294646b121838574e1dd7acbb22c21a03df84e1f2c87b1ad47f2","08a90bcdc717df3d50a2ce178d966a8c353fd23e5c392fd3594a6e39d9bb6304",{"version":"8207e7e6db9aa5fc7e61c8f17ba74cf9c115d26f51f91ee93f790815a7ea9dfb","affectsGlobalScope":true},"2a12d2da5ac4c4979401a3f6eaafa874747a37c365e4bc18aa2b171ae134d21b","002b837927b53f3714308ecd96f72ee8a053b8aeb28213d8ec6de23ed1608b66","1dc9c847473bb47279e398b22c740c83ea37a5c88bf66629666e3cf4c5b9f99c","a9e4a5a24bf2c44de4c98274975a1a705a0abbaad04df3557c2d3cd8b1727949","00fa7ce8bc8acc560dc341bbfdf37840a8c59e6a67c9bfa3fa5f36254df35db2","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff",{"version":"806ef4cac3b3d9fa4a48d849c8e084d7c72fcd7b16d76e06049a9ed742ff79c0","affectsGlobalScope":true},"cfe724f7c694aab65a9bdd1acb05997848c504548c9d4c71645c187a091cfa2a","5f0ed51db151c2cdc4fa3bb0f44ce6066912ad001b607a34e65a96c52eb76248",{"version":"3345c276cab0e76dda86c0fb79104ff915a4580ba0f3e440870e183b1baec476","affectsGlobalScope":true},"664d8f2d59164f2e08c543981453893bc7e003e4dfd29651ce09db13e9457980","e383ff72aabf294913f8c346f5da1445ae6ad525836d28efd52cbadc01a361a6","f52fbf64c7e480271a9096763c4882d356b05cab05bf56a64e68a95313cd2ce2","59bdb65f28d7ce52ccfc906e9aaf422f8b8534b2d21c32a27d7819be5ad81df7","1835259a20b9fa6b1882931375b69ae5978195f2b139b4e0db51ec8319261649","b52cd693219a63dd21282ac99a7bf55f77cbe8a91f097968856419cc2e05f017","3aff9c8c36192e46a84afe7b926136d520487155154ab9ba982a8b544ea8fc95","a880cf8d85af2e4189c709b0fea613741649c0e40fffb4360ec70762563d5de0","85bbf436a15bbeda4db888be3062d47f99c66fd05d7c50f0f6473a9151b6a070","9f9c49c95ecd25e0cb2587751925976cf64fd184714cb11e213749c80cf0f927","f0c75c08a71f9212c93a719a25fb0320d53f2e50ca89a812640e08f8ad8c408c",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"0b3eba6dca8c6e534d16ef7b7d76cb546cd3cbab616c8f71daa0a151b5412b9e","16d51f964ec125ad2024cf03f0af444b3bc3ec3614d9345cc54d09bab45c9a4c","ba601641fac98c229ccd4a303f747de376d761babb33229bb7153bed9356c9cc",{"version":"d2f7baf43dfa349d4010cbd9d64d84cdf3ec26c65fa5f44c8f74f052bedd0b49","affectsGlobalScope":true},"84e3bbd6f80983d468260fdbfeeb431cc81f7ea98d284d836e4d168e36875e86","0b85cb069d0e427ba946e5eb2d86ef65ffd19867042810516d16919f6c1a5aec","6d829824ead8999f87b6df21200df3c6150391b894b4e80662caa462bd48d073","afc559c1b93df37c25aef6b3dfa2d64325b0e112e887ee18bf7e6f4ec383fc90","15c88bfd1b8dc7231ff828ae8df5d955bae5ebca4cf2bcb417af5821e52299ae","ca2b0e915cf19c63c1398f6e1c43eba4300186469f12db857bb19d150d1d64de","951da31b03c64b86883e39585ae377374b2e69b5d6d63d16bb6efe262cbd46da","7f2c7fd1161a44d9514bab056726053e621842c787c94d42a13d27f72d357d00","8217c088bc6cdba944f18cb38e5f8a5f6b36ec52cce2c2f8ed5f0188f26e9301","8f833fb536ce9a3db56761ce5dbead5eb901326d7a15ee365fa34c21aa802bf0","2ced5214fb4159e282ccc5c84fa9eeac92a16ee70be4d2b0b099d460c765d72f","bbfbfa714a8f9fdf10e9483b4abd82ccb546fc0fc069ad80d0a254fa40930e98","4fe89ef54fee4b9502f3cbe712bf275155245b6c728bed6e5de56280ca2b5813","33c7c5147cc69b98472e52ee2d93399114fd8fb8bcfdcd4e23ad6ad862dc7445","1833b783a6ce2327137bc6e19548610b40bfe2c0ac23e51408c254a529d7fb9c","1a719edd0abb1f010bfb5ef8d926a5533021ed7837ea2ab87c3780fcc0448bce",{"version":"193124bd98f21119fdf26804fcea276f684a0ee3d32fcebd4260a3bbe3d0cba3","affectsGlobalScope":true},"0eb6f3388be6c67f6a4f415e62d9969b5f3511a89b4d1a34510eaf57b3e8ee29","05236771d920f9547b35fef8ad0fead4fefbe5c57eb00b454c6c822d67ebe507","dda8410786fe1a473b420c6b95ab797b3cdac5705806ada1e062754b13291e79","81a86bafa2a888244532a9c6fd6e2ceea9ef2407df8882a6bae00efbc1491065","b72233428d67dccfa728d2c65b77672dea9009ceb5f8bce0d6aabe172ff77912","db412fc192357cd4bff3e93e79030ea404b7d2cf8c089d2fe9d53ba010f1a916","7bc97e823dd70d66e9640998837ca0aad3480b415035dbd2074e3a450166e221",{"version":"aef0597f694334e5da630438a38b966d7da7b5265af8f0f3685d1baf42df5178","affectsGlobalScope":true},"61e8d97d995fc12d08b0db14799e91c0a849da510a3f488bbf2ab4ec463ee08e","625e5bc32aa08bbbe91b618d373b621434f0ae10c3f4a956f79f685a34211d3c","be7bff4f6d471926c613545d2cc8dfc6331ce0c685dbd545365b3b3b53d7cf67","a555f33dff1a905945e478aa7351940fc6839c789b6386c1f7cab1540ff7c1e9","14cebd75a4eb2c7bfddfc34f39e871219a4fe252e7f677bfd2a8f3513fa468a0","f14e53c947ac3f48b87cfdac17e3f2894c5b035dfe6d9c4354367f2fb584b50b","412953af5a2c116c7d21638260980db2ff5e27d8cb3c7a2ae2a57edd74eb5944","02bd5d3bfa6f2a11621faa02a4e410e34b88a69f4c970fbe180c7db8440106ac","91943331db391f5e695bd92c52e53e314e65b987e205e90b4eb4b2d7b4719a97","c03ca22b4601cfcbdbd469337b2b039d818c9156c3b106c6faf49401766a2f54","276c2039d803b9c423c6b439f906e694eb618ca95b47c22d9f5afc86df84dc39","4b3430cb51fcbe1b0ad007e63d572563526303c49438bc8df4f18b0528d52f56","048f50361b3948e92aca0148d6a7c566843164830c1aa70962179052f576479c","6d18352a53bff1aae48a9dd3b7111c442b41992354be6b6bcb24749bb9a02ddf",{"version":"e81b85c6436139bf569f41b12e89bdba4873ce0cd3a5f3150059849430246b69","affectsGlobalScope":true},"fea2a451e18f2380a257542ce9d79b1bd29f7ce939baca5637ad11a4a3a50c0f",{"version":"93ff305ef87c1324afcad66bcfd74c89b60195716901281551097a7013125f7d","affectsGlobalScope":true},"59760dae8af8c64c137136085640d8945972e8033d1532e33ac02fc041212906","a9799ce2b5f4b675db7e4a55cefb02b00ac2c3131d4779cfc06c79100d158779","84cba6cfcb7c71cdbb4afdfa9008ff6b1b1de794bdd2799244512c06625cc5f2","5df4ce1f33ad027e920e60b439d12d7a75fef328db30e0b1abeba3764779664f","4d5dffe9476dd465996c2ac7ef5a05b041d570e252324864eafac21221edfcf4","031da4cd5404883fa92d26250150333f0ff4c3c301c02c484f2b517908cdf46e","64ecb47b652529b7859c48d1d8f690ac516cc7e5e47cafb68d59f86b807cdee0","bdecd4f44d964969b22cea27c49b90d664f3866955af93c4bfc2450864b49d6b","7a67eb07ea745a4a05c0c37fd61a5a445dbf45120d239fa32dec4cbc59800b10","dab463b4e04b94ba09e8d64f604af579cc00494eca37e5833d95d4196721c900","731013f8efc1fccae7e7fc97a8462e241d3232dbb749fab08797c11a2b7a59f6","1224f4f7c32b3ef446723e7b03b3b7e382169799601e1ac31b33f800e3e41e98","62f6923e19ad850b8b28114be19fa44ec03ab0e6d0cc3b19eefe518240fe3f4e","5777de012f3b776535a35d0c5aec20923629abc8a3fec41bc4d231f85bc8d73a","3e18b620c757cc03969d229811a94f739d4b35ef40675df7d0dc3ebea29f4f79","5ea90acd24a259ac920f8f7a7d878b9defc0fe5007296ecbdff313472e7e9873","cbab8ec46a142d79596e6682a1a22a0057f63a6da6e85bad170bedb164486f16","f6850da76b72e24bd67484daf34150cb6ea98d8195549f3f3a26c12fbc48c6d5","0ed5def2c089235dfe74ce9293b30bb47f74a30e50bf5211e644a7923aa230be","f4482ae02e83c98c1b4d5990a4959813864c569519a6676a9e3c3bdf4ad27bc5","a4540bf83d0c760705c08033d0274d218c833eeb230774d1d6627e918272bd7f","1b8ebadab30605f4960bc2d54ed85cda42feae39ac0f0e79e4b63a1bd2cf737a","b372e7a6ce1c990bc6f7e859ee0e0611620642622b045df2ce5bd887067891a8","e182eeeb78d42bb9a5afc38539f2d674c20edad188b05db4414db76c2e67014b","e40390771baeb40fb453651bcaef1b90de9e28d4c57af717fb08c9696e82b1f3","74bc7ef1a7c43632b964cefb63ff5f9ddf5846c2ef09203916e2d33648729539","cfdae345f54854cb536dfaaa927c0bf8c9d3bdcb0ae83da31833e95191a7e6ee","09c5b4b0ceb95c84856fb6e879753012a1dd576e0b6538bdb05a1fd9812bb8da","e40c3e7f5f7ba93bc7e43e2dbd4d27b83c9bf802d264720a588ede46bf7d3597","f8ae59fdb3d989b4abc7cb9438a2ca38f7a162d198b894c9199df1771424f167","89df45dffa1d8402cc17ed702eb316b33e9154f40a9c5cefe211e94be73819e1","a86ff5d57a5fb772b00ec066e2647db63814956de4270be36e0667d84ce9920f","9789ca2b724331c7ae1d74f1cb22bbffa8f46af6a38d431d34cf5e1a42bd4303","7495cbc4e89f4d1382a2d5949b59faf96eead27ed1b92d13982342493a3db58a","21f9931bc56f7c6b785050d21fd98e7e0544d2b08cbe763439d5dcb6bbfe9e31","4a3ada3027654c2cd4c48f4a3cdc8648cef598e0ba5acfbc521b8b175d5e4abf","c3351f7ebb324b9abaab58013f3cd1046490ce89a40670a558108f3085bac44f","2bddacd42370df9bdd89fec414503247307fe64562bbb6bb2d5a5271a3d5b00b","62eeab5440f599ef1f67ecfa16db50b82e72e199edb804bf827d7cbfa3f51a27","ca89637e3622344bcf312b5b5e21d7e8b3556a5744b080bfc0e5889f903c4098","335fdccda93990309f4599c24c805d445ac8028ec5f8447c1adfa70d3cf6c4ae","46cfd51265795d50209d8f8d1979b5601c37ce1bb3ce0f5233698ba03d7db893","33b40550d40f4d6c055ceec738d9d543f3a28b639320621efa944dfcb75a38ac","d1cdba32f4c3987f1dc51e53cfc2a08e8a356cd30069127c570270f6d1cf2a44","af06f5da43477f3ab9f5a5a01c06945877af3203e69e6a769a173523890a8ca0","0e51671306b0c2250371eb82decaa0836cdc3ebe59b62e8a57642c204db8bbf3","7ffef9bccb69de03440fffaffb671b39efc8e6bcbdd13f3f53d4c15284000236","6dfc48bbb9fe02e504e9546e9c52447bef7c10834f91104de5a2e55a9fa92ea1","0ea08d6e7fe8bd9594c1e6b8e2579d87ce32f108e93239b9bdd1c80a48c7da6a","8e1907dbf07e0f199526d8c2597494cdb409890ea07229502cd04bd35199e237","4afb25e6753d5ca92493c8befcb72e94dab3c548007c2a7b722ccbcb57eb1a4b","79875e4a5347143e90a1b111bbd04c88ec8c3840619243617d92ba3e94c9bcd6","1bf9ea47caa72d61c3562e00e8dd171e349d0846415297ec1ad3ce8473bcdd9f","41aedaa1567e9ae7b3ae03febc98ef52382589fbac97772ef08dd80362965cac","9a6abce2647a191fe305ff36cd777d724af96cc627c4c518ad05c50570d5d806","5682be1a4c5e9c04421a5754bcae81d0a4b08a2c2996ac69ea6d4c2084416ac2","e22847c4711885e83f107f1aedab987cec7cac51431f2ac620ba0261a8b47c53","9ae519fca32f74c4310a843e5f85e22f030b5d896a89a1a85d8f8949e4b8ccc3","1a243d627115a222d53fa61ce56382513c5357e78c49e9b8cff2a9f0fc2b20c7","e3284cd3da983a703a0fa091403bb54084a4fa312c25df580ae89bb6d54557bf","d1e40ce6fffe96e3e9b92dccbae1e4779a644d892f573e227829f09791058d45","d53517c1c8060b75a5b0dc81afe58a25e07a36665716f717f58a1ecf3f8a02c6","31d92eda0a871bd8c4d4f8f757ab90c64b8ba36962c0e2a5aa42bbfc23f31a62","c20f9c1a60f2d3e83fe28e576c0ada94bc7407c4766e13e60dfdb8e0419dea69","cdab838868f8ee2b00b2a5f8edbd15bea64fd1b777435a350ed284659527ad14","014299e8a6d52eafc8b06f98615dac731f687ca08058c0d272f5b16f516a7bce","181b77254349b69a976685eb11fa71ede5414682822a745e9bb546e3e0ff9aa0","a2c9b31324f3a369d0416231e5f82bc7a3b654700e28ff15f51288b3b82ab74e","f5013aa644fac783db3b08d48ce1e93a652fb1e85ce0eda1f7b04af3a3a7493f","6e97c7bda89461a3c5cc053fe703c5d775b0abef54b53fe94f91da5c42175baa","4b3bbde332af169bbe17dfe56985a658a48b05d1faa12449fb2a5a04fda24d8b","46556b5def1e509d3b5c2f8a8d0356f3c7ced24c140234c9794630f4e126d226","e094c14795bc59875d02868dd26529263578e5498d1806421b84dbeb707f8870","c3e8235474f05430d207d7a3561764667592158dcdf0f590dbaf7be1fc0a0a1b","8f91717e23337eafce11012ac13ffb5a2b221f31ff4920f17088697cf09d03a8","e448b11835f06a3753149bcc4c800733c572825a6d5f3fe8df66b37d17553710","8d62fa383efbbe787e1ad2521c6ab42b6d2ef8f39fc0043e0110d10b87818068","1f85fab1c7871bea5bef60e655f357660e259bcb900a3161b47492d653ad0723","a3a0b1577ac939e586452994dd4eb901b2717a681e6d14cbb11b4bc92079624d","1c4054b73b14a788311db075708d29e6e4ef360d74e117ba9a1c6a5e9de32e50","52453091d085ee21e7508073027447c75b3f2db334b927b4f1cf152d6c18e524","0955d91b1b27bc72f311cf6b3c053b79be730a75f21cda1fc60d8a72805231e5","b943b6b36b1227bb31bb2617d2c19a9880d9118fe8210569c5ee716164335aef","d324aa8ca50030c493f5026e6a40b70e63d26796554e83fd27e95fd60dfa0990","53e2a4df328f4ec268f9bfb484934ced605a33abf255a0d5a16a412a122fab63","cfe0959c225e0fa03b2297c4642363efb99c162ed2d811782872fb0b4f0b39b9","33cc1a45b89e4eb2c8db7e94014066d5664ae6327a7657c62602fe9915abad7f","22b973f19791a479bc7794b7781e4b68915ca9bda3fece2e2d23f56e3d434d0b","682ab91fdcc1cfc31bc955d9c5600611662a025eb6748bedc4e02eee49f5a457","f2b70d69c82d8edfdc7b0e94b798554f282ada06021a38a5451f2c387261c0ab","b019df112932d1e4b9a176db75dc96b934182bbf4358411ba8e8ceda0873ecee","82e82cbd42108ee51548d21bfb461348743b85e460ebb4abef896eddc32f9094","722d88ff44f6031f0695fa46a171162b93183afe7c15855a9006b322b582cf55","94cc5eda3fd786dbd14c476c4bba1e062e98a0d4e333cb0fece656113a2de059","b9e97f43a96bb0f115b6e6a8ae3b108708ba42e077493b638f11e9db48527b58","65bba93acfd0cca3d26a3d816c8ffb23b28371d0bcb2ff8e21d7b25cba180d0e","4312414959d49ecd3571f6bbf26e9d57058eba69063e2bc25999167f3147298c","2b4b385517bf66c2fbe309f4535e3c95f2504117c9871e31c8b82fedc6265b26","6c7311c2bed8c762d6071bdeefb42aa425919a971e37c71505325b59d4a32340","266c897d5b61efad26adc7944b6a7449d75255caf8022e904bcde4256cc5f65f","389ebbbbf2e118f84d7a36e02a82d323ad30f0961f8d986a31db722a5730f536","679d5f0f36ecc6487b7a1dc5c19ce284331cde2ad8f770a605baa71db4aed8fe","2b560fb79e5ac4f5da8a12092bc0e9567e6c0eeea29c82c25887764a1ffb64d5","18b8e4fd79ebe8bd02e1119ecdb2275ed42e20dc274f9122ac3b0c0f166ebb8d","8277f3390c1c51708a9684b4f3089eb3993dc35ad0b6e914501222e003f6c4a5","7eb40cc318d5db707714e912285032c7847948df722f464da8721742cdc6ba9c","65a15e82eda0f3f37bb41fe4dc8c7276ae134a2428d54d235068c7ac8de7a6c8","d2736842b549acc3333e8587998fff952e1a2a9cf3b5305e1b23daf2528d1512","cbe2118fa4e26f0a60e256198ac9d75ab26e9160f947de8a231a87976087450f","4b0375a95d3ef34be6b72dc755042fac88e7b4b8da20ac3815a98f6390e04187","2274213717bfbf587bb0a5934c040878c5643e1e89ca8b0db6abd392b5ed7656","0702615a9779b1aa63f92bc3c5a5d811c56f9848b2616198b5fb72be44a3729b","a1bea30b13fb004eb705f16577d20a30ddd0579de2329d84ff175cf9cb2aa5b9","9e188ba1ebb788fde8d436b7be308121e57e64c81a411401ca497b7ef70085c1","7afbf8a689d37babe14bfdeab924f9d9f46434518df263a57d70db44d9a67848","efe164cbf8d6f50bb6aef78b9e71092046fbfd9275bda7b1791be9020d2f55a2","312b414e8d4bc1c6f0e4d95aac230c29270ee9eab15a3110e22cbe1862256c6c","3423b1f95dd5e2c83a26aa371adff6bd22607d5514681432c77f4732d004308d","ba675c7a67ba1e214e140f4e0bd4d7063d6d54f798fb6dc1975ebf5f564c3c1d","39bccbbf704903e77fbe80b94f17f89320490710e55e1c2b39d0943ad0309226","49d37caaf3485e5fc97731e9899ca979b5d34a74c5b0edb3c27b89be2194fbdf","572a49ace5734391ced070d0743fc904d9dfdc5f3f4382fc2ccb23c6751a6cbb","4573a79babbc296705c8bff397ec610040b113d373b6da0e103b9d289fcf1af5","58fd970ab1c2b165529bba0948b9c02637ab7a833c862bcd6dd85ea46621b6be","4c3dd72177c981806827744de7b234bc9bed2cc742728a76d02652a6274ec657","f1218ac78f857a639bc03d1d9529306f19993c4e75c69be09181e8cfbffc9edf","6ffd3ca9953d5bfac4d5c301c9d6e5c3e0e37ea03b5a04d38ca85ab9169cf0f6","71246be500c4b1e21edcfbe96764e4e535b628584e832878977975744d482cab","4c038317307f766d8e662cf013781229dd3786f0972c5f3f6f95a5d649fc97b2","8bdeecad632fb63445103db0139ac6900e4641b0f173d307e9627136036a73a9",{"version":"e8bf92aabac2b11e1bf60a0161039cd6f5f0cd9713863ca2289dd7b10eddece8","affectsGlobalScope":true},{"version":"b361e9e2d293622f9a9c0ef0a4bb2dd59f13fdfe1f5fea109c5fe75bbd1d0a2f","affectsGlobalScope":true}],"options":{"declaration":false,"esModuleInterop":true,"inlineSourceMap":true,"module":1,"outDir":"./","target":5},"fileIdsList":[[87],[87,114,272],[87,108,109,110,111,112,113],[87,109,114],[87,109],[62,87,102,103],[62,87,94,100],[62,87,94],[59,62,87,94,95,96],[87,96,97,99,101],[44,87],[47,87],[48,53,87],[49,59,60,67,76,86,87],[49,50,59,67,87],[51,87],[52,53,60,68,87],[53,76,83,87],[54,56,59,67,87],[55,87],[56,57,87],[58,59,87],[59,87],[59,60,61,76,86,87],[59,60,61,76,87],[62,67,76,86,87],[59,60,62,63,67,76,83,86,87],[62,64,76,83,86,87],[44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93],[59,65,87],[66,86,87],[56,59,67,76,87],[68,87],[69,87],[47,70,87],[71,85,87,91],[72,87],[73,87],[59,74,87],[74,75,87,89],[59,76,77,78,87],[76,78,87],[76,77,87],[79,87],[80,87],[59,81,82,87],[81,82,87],[53,67,76,83,87],[84,87],[67,85,87],[48,62,73,86,87],[53,87],[76,87,88],[87,89],[87,90],[48,53,59,61,70,76,86,87,89,91],[76,87,92],[62,87,94,98],[87,105],[87,107,266],[49,87,104],[87,125],[87,125,126,127,128,129,130,131,132,133],[87,118],[87,119],[87,115,116,117,118,119,120,121],[62,64,86,87,114,116,117,119,272],[59,60,87,272],[87,115,118,119,272],[59,87,118,119,272],[87,122],[87,122,124,138],[59,87,122,134,137,272],[87,150,154],[49,87,135,147,150,169,175,176,272],[87,135,136,147,148,149],[87,154],[87,135,150,155],[87,135,150],[87,150,153,154,159,160,161,163,165,272],[87,146],[87,135,150,153,154,162,165],[87,135,154],[87,135,147,150,153,154,157,159,160,161,162,163,164,175],[60,76,87,135,147,150,272],[87,135,150,157,165,272],[87,135,150,156,158,165,272],[87,135,150,152,154],[87,135,150,152,153,163,165,175,272],[87,149,155,157,158,165,272],[87,135,147,150,158,165],[76,87,135,147,150,151,153,154,157,158,159,161,164,165,166,167,168,169,170,171,172,173,174,176,177,272],[87,135],[87,135,150,168,169,174,175,177],[87,150,272],[87,135,147,150,153,154,163],[49,76,87,135,136],[87,134,140,141],[87,122,141,142,143,144],[59,86,87,122,272],[59,87,122,134,272],[87,122,140,141],[87,265],[87,178,179,180,181,182,183,184,185,186,187,188,189,190,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213],[87,134],[87,177],[87,191,193,265],[87,272],[87,191],[87,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262],[87,178],[87,179],[87,266],[87,217],[87,213],[87,122,123,191,265],[59,87,122,134,139,145,177,214,229,231,263,264,272],[87,150,191,192,193,272],[87,191,192,265],[87,122,150,272],[69,87,266,267],[87,106]],"referencedMap":[[270,1],[108,1],[111,2],[114,3],[112,2],[113,4],[110,5],[8,1],[9,1],[13,1],[12,1],[2,1],[14,1],[15,1],[16,1],[17,1],[18,1],[19,1],[20,1],[21,1],[3,1],[4,1],[25,1],[22,1],[23,1],[24,1],[26,1],[27,1],[28,1],[5,1],[43,1],[29,1],[30,1],[31,1],[32,1],[6,1],[33,1],[34,1],[35,1],[36,1],[7,1],[41,1],[37,1],[38,1],[39,1],[40,1],[1,1],[42,1],[11,1],[10,1],[109,1],[104,6],[103,1],[101,7],[100,8],[97,9],[102,10],[98,1],[44,11],[45,11],[47,12],[48,13],[49,14],[50,15],[51,16],[52,17],[53,18],[54,19],[55,20],[56,21],[57,21],[58,22],[59,23],[60,24],[61,25],[46,1],[93,1],[62,26],[63,27],[64,28],[94,29],[65,30],[66,31],[67,32],[68,33],[69,34],[70,35],[71,36],[72,37],[73,38],[74,39],[75,40],[76,41],[78,42],[77,43],[79,44],[80,45],[81,46],[82,47],[83,48],[84,49],[85,50],[86,51],[87,52],[88,53],[89,54],[90,55],[91,56],[92,57],[96,1],[95,1],[99,58],[106,59],[267,60],[105,61],[126,62],[127,62],[128,1],[129,62],[130,1],[131,62],[132,62],[133,62],[134,63],[125,1],[119,64],[120,65],[115,1],[122,66],[118,67],[117,68],[116,69],[121,70],[192,1],[124,71],[139,72],[138,73],[170,74],[177,75],[150,76],[148,1],[172,77],[167,78],[151,79],[162,80],[149,1],[153,77],[147,81],[163,82],[171,83],[165,84],[155,85],[158,86],[157,87],[161,88],[154,89],[159,90],[164,91],[175,92],[173,1],[169,1],[156,93],[176,94],[174,1],[160,1],[166,95],[152,1],[168,96],[146,1],[137,97],[136,93],[135,1],[107,23],[142,98],[143,71],[145,99],[140,100],[141,101],[144,102],[271,103],[214,104],[178,103],[179,103],[180,1],[181,103],[182,1],[183,1],[184,1],[185,1],[186,1],[187,105],[188,106],[189,1],[190,1],[194,107],[195,1],[196,1],[197,103],[198,1],[199,103],[200,103],[201,1],[202,108],[203,108],[204,108],[205,105],[206,105],[207,1],[208,1],[209,109],[210,103],[211,1],[212,1],[213,103],[263,110],[215,111],[216,112],[217,1],[218,1],[219,103],[220,103],[221,1],[222,1],[223,1],[224,1],[227,1],[226,1],[225,113],[228,1],[229,105],[230,1],[231,105],[232,1],[233,1],[234,1],[235,1],[236,1],[237,1],[238,1],[239,1],[240,1],[241,1],[242,1],[243,1],[244,113],[245,113],[246,113],[247,103],[248,103],[249,108],[250,1],[251,1],[252,1],[253,1],[254,114],[255,113],[256,1],[257,103],[258,103],[259,103],[260,103],[261,103],[262,115],[266,116],[265,117],[264,118],[193,119],[191,120],[123,1],[268,121],[269,122]],"exportedModulesMap":[[270,1],[108,1],[111,2],[114,3],[112,2],[113,4],[110,5],[8,1],[9,1],[13,1],[12,1],[2,1],[14,1],[15,1],[16,1],[17,1],[18,1],[19,1],[20,1],[21,1],[3,1],[4,1],[25,1],[22,1],[23,1],[24,1],[26,1],[27,1],[28,1],[5,1],[43,1],[29,1],[30,1],[31,1],[32,1],[6,1],[33,1],[34,1],[35,1],[36,1],[7,1],[41,1],[37,1],[38,1],[39,1],[40,1],[1,1],[42,1],[11,1],[10,1],[109,1],[104,6],[103,1],[101,7],[100,8],[97,9],[102,10],[98,1],[44,11],[45,11],[47,12],[48,13],[49,14],[50,15],[51,16],[52,17],[53,18],[54,19],[55,20],[56,21],[57,21],[58,22],[59,23],[60,24],[61,25],[46,1],[93,1],[62,26],[63,27],[64,28],[94,29],[65,30],[66,31],[67,32],[68,33],[69,34],[70,35],[71,36],[72,37],[73,38],[74,39],[75,40],[76,41],[78,42],[77,43],[79,44],[80,45],[81,46],[82,47],[83,48],[84,49],[85,50],[86,51],[87,52],[88,53],[89,54],[90,55],[91,56],[92,57],[96,1],[95,1],[99,58],[106,59],[267,60],[105,61],[126,62],[127,62],[128,1],[129,62],[130,1],[131,62],[132,62],[133,62],[134,63],[125,1],[119,64],[120,65],[115,1],[122,66],[118,67],[117,68],[116,69],[121,70],[192,1],[124,71],[139,72],[138,73],[170,74],[177,75],[150,76],[148,1],[172,77],[167,78],[151,79],[162,80],[149,1],[153,77],[147,81],[163,82],[171,83],[165,84],[155,85],[158,86],[157,87],[161,88],[154,89],[159,90],[164,91],[175,92],[173,1],[169,1],[156,93],[176,94],[174,1],[160,1],[166,95],[152,1],[168,96],[146,1],[137,97],[136,93],[135,1],[107,23],[142,98],[143,71],[145,99],[140,100],[141,101],[144,102],[271,103],[214,104],[178,103],[179,103],[180,1],[181,103],[182,1],[183,1],[184,1],[185,1],[186,1],[187,105],[188,106],[189,1],[190,1],[194,107],[195,1],[196,1],[197,103],[198,1],[199,103],[200,103],[201,1],[202,108],[203,108],[204,108],[205,105],[206,105],[207,1],[208,1],[209,109],[210,103],[211,1],[212,1],[213,103],[263,110],[215,111],[216,112],[217,1],[218,1],[219,103],[220,103],[221,1],[222,1],[223,1],[224,1],[227,1],[226,1],[225,113],[228,1],[229,105],[230,1],[231,105],[232,1],[233,1],[234,1],[235,1],[236,1],[237,1],[238,1],[239,1],[240,1],[241,1],[242,1],[243,1],[244,113],[245,113],[246,113],[247,103],[248,103],[249,108],[250,1],[251,1],[252,1],[253,1],[254,114],[255,113],[256,1],[257,103],[258,103],[259,103],[260,103],[261,103],[262,115],[266,116],[265,117],[264,118],[193,119],[191,120],[123,1],[268,121],[269,122]],"semanticDiagnosticsPerFile":[270,108,111,114,112,113,110,8,9,13,12,2,14,15,16,17,18,19,20,21,3,4,25,22,23,24,26,27,28,5,43,29,30,31,32,6,33,34,35,36,7,41,37,38,39,40,1,42,11,10,109,104,103,101,100,97,102,98,44,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,46,93,62,63,64,94,65,66,67,68,69,70,71,72,73,74,75,76,78,77,79,80,81,82,83,84,85,86,87,88,89,90,91,92,96,95,99,106,267,105,126,127,128,129,130,131,132,133,134,125,119,120,115,122,118,117,116,121,192,124,139,138,170,177,150,148,172,167,151,162,149,153,147,163,171,165,155,158,157,161,154,159,164,175,173,169,156,176,174,160,166,152,168,146,137,136,135,107,142,143,145,140,141,144,271,214,178,179,180,181,182,183,184,185,186,187,188,189,190,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,263,215,216,217,218,219,220,221,222,223,224,227,226,225,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,266,265,264,193,191,123,268,269]},"version":"4.5.5"}
|
package/index.js
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import B from 'bluebird';
|
|
3
|
+
import { NodeVM } from 'vm2';
|
|
4
|
+
import { logger, util } from '@appium/support';
|
|
5
|
+
import { attach } from 'webdriverio';
|
|
6
|
+
|
|
7
|
+
const log = logger.getLogger('ExecuteDriver Child');
|
|
8
|
+
let send;
|
|
9
|
+
|
|
10
|
+
// duplicate defining these keys here so we don't need to re-load a huge appium
|
|
11
|
+
// dependency tree into memory just to run a wdio script
|
|
12
|
+
export const W3C_ELEMENT_KEY = util.W3C_WEB_ELEMENT_IDENTIFIER;
|
|
13
|
+
export const MJSONWP_ELEMENT_KEY = 'ELEMENT';
|
|
14
|
+
|
|
15
|
+
async function runScript (driverOpts, script, timeoutMs) {
|
|
16
|
+
if (!_.isNumber(timeoutMs)) {
|
|
17
|
+
throw new TypeError('Timeout parameter must be a number');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// set up fake logger
|
|
21
|
+
const logLevels = ['error', 'warn', 'log'];
|
|
22
|
+
const logs = {};
|
|
23
|
+
const consoleFns = {};
|
|
24
|
+
for (const level of logLevels) {
|
|
25
|
+
logs[level] = [];
|
|
26
|
+
consoleFns[level] = (...logMsgs) => logs[level].push(...logMsgs);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const driver = await attach(driverOpts);
|
|
30
|
+
|
|
31
|
+
const fullScript = buildScript(script);
|
|
32
|
+
|
|
33
|
+
log.info('Running driver script in Node vm');
|
|
34
|
+
|
|
35
|
+
const vmCtx = new NodeVM({timeout: timeoutMs});
|
|
36
|
+
const vmFn = vmCtx.run(fullScript);
|
|
37
|
+
|
|
38
|
+
// run the driver script, giving user access to the driver object, a fake
|
|
39
|
+
// console logger, and a promise library
|
|
40
|
+
let result = await vmFn(driver, consoleFns, B);
|
|
41
|
+
|
|
42
|
+
result = coerceScriptResult(result);
|
|
43
|
+
log.info('Successfully ensured driver script result is appropriate type for return');
|
|
44
|
+
return {result, logs};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Embed a user-generated script inside a method which takes only the
|
|
49
|
+
* predetermined objects we specify
|
|
50
|
+
*
|
|
51
|
+
* @param {string} script - the javascript to execute
|
|
52
|
+
*
|
|
53
|
+
* @return {string} - the full script to execute
|
|
54
|
+
*/
|
|
55
|
+
function buildScript (script) {
|
|
56
|
+
return `module.exports = async function execute (driver, console, Promise) {
|
|
57
|
+
${script}
|
|
58
|
+
}`;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* We can get any manner of crazy thing back from a vm executing untrusted
|
|
63
|
+
* code. We might also get WebdriverIO objects that aren't suitable for JSON
|
|
64
|
+
* response. So make sure we convert the things we know about to their
|
|
65
|
+
* appropriate response format, and squash other weird things.
|
|
66
|
+
*
|
|
67
|
+
* @param {Object} obj - object to convert and sanitize
|
|
68
|
+
*
|
|
69
|
+
* @return {Object} - safely converted object
|
|
70
|
+
*/
|
|
71
|
+
function coerceScriptResult (obj) {
|
|
72
|
+
// first ensure obj is of a type that can be JSON encoded safely. This will
|
|
73
|
+
// get rid of custom objects, functions, etc... and turn them into POJOs
|
|
74
|
+
try {
|
|
75
|
+
obj = JSON.parse(JSON.stringify(obj));
|
|
76
|
+
} catch (e) {
|
|
77
|
+
log.warn('Could not convert executeDriverScript to safe response!' +
|
|
78
|
+
`Result was: ${JSON.stringify(obj)}. Will make it null`);
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
let res;
|
|
83
|
+
|
|
84
|
+
// now we begin our recursive case options
|
|
85
|
+
if (_.isPlainObject(obj)) {
|
|
86
|
+
// if we have an object, it's either an element object or something else
|
|
87
|
+
// webdriverio has no monadic object types other than element and driver,
|
|
88
|
+
// and we don't want to allow special casing return of driver
|
|
89
|
+
res = {};
|
|
90
|
+
|
|
91
|
+
if (obj[MJSONWP_ELEMENT_KEY] || obj[W3C_ELEMENT_KEY]) {
|
|
92
|
+
// if it's an element object, clear out anything that's not the key, and then return the
|
|
93
|
+
// object. Note that if the element object contains only one element key type (MJSONWP or
|
|
94
|
+
// W3C), keep it that way in our response. But if the element contains both key types
|
|
95
|
+
// (because the client is being backwards compatible) then keep both keys in our response as
|
|
96
|
+
// well.
|
|
97
|
+
if (obj[MJSONWP_ELEMENT_KEY]) {
|
|
98
|
+
res[MJSONWP_ELEMENT_KEY] = obj[MJSONWP_ELEMENT_KEY];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (obj[W3C_ELEMENT_KEY]) {
|
|
102
|
+
res[W3C_ELEMENT_KEY] = obj[W3C_ELEMENT_KEY];
|
|
103
|
+
}
|
|
104
|
+
return res;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// otherwise, recurse into the object
|
|
108
|
+
for (const key of Object.keys(obj)) {
|
|
109
|
+
res[key] = coerceScriptResult(obj[key]);
|
|
110
|
+
}
|
|
111
|
+
return res;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// also handle arrays
|
|
115
|
+
if (_.isArray(obj)) {
|
|
116
|
+
return obj.map(coerceScriptResult);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// base case, if it's not an object or array, return straightaway
|
|
120
|
+
return obj;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
async function main (driverOpts, script, timeoutMs) {
|
|
124
|
+
let res;
|
|
125
|
+
try {
|
|
126
|
+
res = {success: await runScript(driverOpts, script, timeoutMs)};
|
|
127
|
+
} catch (error) {
|
|
128
|
+
res = {error: {message: error.message, stack: error.stack}};
|
|
129
|
+
}
|
|
130
|
+
await send(res);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// ensure we're running this script in IPC mode
|
|
134
|
+
if (require.main === module && _.isFunction(process.send)) {
|
|
135
|
+
send = B.promisify(process.send, {context: process});
|
|
136
|
+
log.info('Running driver execution in child process');
|
|
137
|
+
process.on('message', ({driverOpts, script, timeoutMs}) => {
|
|
138
|
+
log.info('Parameters received from parent process');
|
|
139
|
+
main(driverOpts, script, timeoutMs);
|
|
140
|
+
});
|
|
141
|
+
}
|
package/lib/plugin.js
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import BasePlugin from '@appium/base-plugin';
|
|
2
|
+
import _ from 'lodash';
|
|
3
|
+
import cp from 'child_process';
|
|
4
|
+
import { timing } from '@appium/support';
|
|
5
|
+
import B from 'bluebird';
|
|
6
|
+
|
|
7
|
+
const FEAT_FLAG = 'execute_driver_script';
|
|
8
|
+
const DEFAULT_SCRIPT_TIMEOUT_MS = 1000 * 60 * 60; // default to 1 hour timeout
|
|
9
|
+
const SCRIPT_TYPE_WDIO = 'webdriverio';
|
|
10
|
+
|
|
11
|
+
export default class ExecuteDriverPlugin extends BasePlugin {
|
|
12
|
+
|
|
13
|
+
static newMethodMap = {
|
|
14
|
+
'/session/:sessionId/appium/execute_driver': {
|
|
15
|
+
POST: {
|
|
16
|
+
command: 'executeDriverScript',
|
|
17
|
+
payloadParams: {required: ['script'], optional: ['type', 'timeout']}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* This method takes a string which is executed as javascript in the context of
|
|
24
|
+
* a new nodejs VM, and which has available a webdriverio driver object, having
|
|
25
|
+
* already been attached to the currently running session.
|
|
26
|
+
*
|
|
27
|
+
* @param {function} next - standard behaviour for executeDriverScript
|
|
28
|
+
* @param {BaseDriver} driver - Appium driver handling this command
|
|
29
|
+
* @param {string} script - the string representing the driver script to run
|
|
30
|
+
* @param {string} [scriptType='webdriverio'] - the name of the driver script
|
|
31
|
+
* library (currently only webdriverio is supported)
|
|
32
|
+
* @param {number} [timeoutMs=3600000] - timeout for the script process
|
|
33
|
+
*
|
|
34
|
+
* @returns {Object} - a JSONifiable object representing the return value of
|
|
35
|
+
* the script
|
|
36
|
+
*/
|
|
37
|
+
async executeDriverScript (next, driver, script, scriptType = 'webdriverio',
|
|
38
|
+
timeoutMs = DEFAULT_SCRIPT_TIMEOUT_MS) {
|
|
39
|
+
|
|
40
|
+
if (!driver.isFeatureEnabled(FEAT_FLAG)) {
|
|
41
|
+
throw new Error(`Execute driver script functionality is not available ` +
|
|
42
|
+
`unless server is started with --allow-insecure including ` +
|
|
43
|
+
`the '${FEAT_FLAG}' flag, e.g., --allow-insecure=${FEAT_FLAG}`);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (scriptType !== SCRIPT_TYPE_WDIO) {
|
|
47
|
+
throw new TypeError(`Only the '${SCRIPT_TYPE_WDIO}' script type is currently supported`);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (!driver.serverHost || !driver.serverPort) {
|
|
51
|
+
throw new Error('Address or port of running server were not defined; this ' +
|
|
52
|
+
'is required. This is probably a programming error in the driver');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (!_.isNumber(timeoutMs)) {
|
|
56
|
+
throw new TypeError('Timeout parameter must be a number');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const driverOpts = {
|
|
60
|
+
sessionId: driver.sessionId,
|
|
61
|
+
// Appium probably won't be behind ssl locally; if it ever is, might need to update this to
|
|
62
|
+
// provide a user configurable parameter
|
|
63
|
+
protocol: 'http',
|
|
64
|
+
hostname: driver.serverHost,
|
|
65
|
+
port: driver.serverPort,
|
|
66
|
+
path: driver.serverPath,
|
|
67
|
+
isW3C: true,
|
|
68
|
+
isMobile: true,
|
|
69
|
+
capabilities: driver.caps
|
|
70
|
+
};
|
|
71
|
+
this.logger.info(`Constructed webdriverio driver options; W3C mode is ${driverOpts.isW3C ? 'on' : 'off'}`);
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
// fork the execution script as a child process
|
|
75
|
+
const childScript = require.resolve('./execute-child.js');
|
|
76
|
+
this.logger.info(`Forking process to run webdriver script as child using ${childScript}`);
|
|
77
|
+
const scriptProc = cp.fork(childScript);
|
|
78
|
+
|
|
79
|
+
// keep track of whether we have canceled the script timeout, so we can stop
|
|
80
|
+
// waiting for it and allow this process to finish gracefully
|
|
81
|
+
let timeoutCanceled = false;
|
|
82
|
+
|
|
83
|
+
try {
|
|
84
|
+
const timer = new timing.Timer();
|
|
85
|
+
timer.start();
|
|
86
|
+
|
|
87
|
+
// promise that deals with the result from the child process
|
|
88
|
+
const waitForResult = async () => {
|
|
89
|
+
const res = await new B((res) => {
|
|
90
|
+
scriptProc.on('message', res); // this is node IPC
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
this.logger.info('Received execute driver script result from child process, shutting it down');
|
|
94
|
+
|
|
95
|
+
if (res.error) {
|
|
96
|
+
throw new Error(res.error.message);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return res.success;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// promise that waits up to the timeout and throws an error if so, or does
|
|
103
|
+
// nothing if the timeout is canceled because we got a result from the
|
|
104
|
+
// child script
|
|
105
|
+
const waitForTimeout = async () => {
|
|
106
|
+
while (!timeoutCanceled && timer.getDuration().asMilliSeconds < timeoutMs) {
|
|
107
|
+
await B.delay(500);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (timeoutCanceled) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
throw new Error(`Execute driver script timed out after ${timeoutMs}ms. ` +
|
|
115
|
+
`You can adjust this with the 'timeout' parameter.`);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
// now that the child script is alive, send it the data it needs to start
|
|
119
|
+
// running the driver script
|
|
120
|
+
this.logger.info('Sending driver and script data to child');
|
|
121
|
+
scriptProc.send({driverOpts, script, timeoutMs});
|
|
122
|
+
|
|
123
|
+
// and set up a race between the response from the child and the timeout
|
|
124
|
+
return await B.race([waitForResult(), waitForTimeout()]);
|
|
125
|
+
} catch (err) {
|
|
126
|
+
throw new Error(`Could not execute driver script. Original error was: ${err}`);
|
|
127
|
+
} finally {
|
|
128
|
+
// ensure we always cancel the timeout so that the timeout promise stops
|
|
129
|
+
// spinning and allows this process to die gracefully
|
|
130
|
+
timeoutCanceled = true;
|
|
131
|
+
|
|
132
|
+
if (scriptProc.connected) {
|
|
133
|
+
this.logger.info('Disconnecting from child proc');
|
|
134
|
+
scriptProc.disconnect();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (scriptProc.exitCode === null) {
|
|
138
|
+
this.logger.info('Disconnecting from and killing driver script child proc');
|
|
139
|
+
scriptProc.kill();
|
|
140
|
+
} else {
|
|
141
|
+
this.logger.info('Script already ended on its own, no need to kill it');
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export { ExecuteDriverPlugin };
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@appium/execute-driver-plugin",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Plugin for batching and executing driver commands with Appiums",
|
|
5
|
+
"main": "./build/index.js",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/appium/appium-plugins.git"
|
|
9
|
+
},
|
|
10
|
+
"appium": {
|
|
11
|
+
"pluginName": "execute-driver",
|
|
12
|
+
"mainClass": "ExecuteDriverPlugin"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"appium",
|
|
16
|
+
"automation",
|
|
17
|
+
"webdriver"
|
|
18
|
+
],
|
|
19
|
+
"author": "Appium <maintainers@appium.io>",
|
|
20
|
+
"license": "Apache-2.0",
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/appium/appium-plugins/issues"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/appium/appium-plugins#readme",
|
|
25
|
+
"files": [
|
|
26
|
+
"build",
|
|
27
|
+
"docs",
|
|
28
|
+
"lib",
|
|
29
|
+
"index.js"
|
|
30
|
+
],
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@appium/base-plugin": "^1.8.1",
|
|
33
|
+
"@appium/support": "2.55.1",
|
|
34
|
+
"bluebird": "3.7.2",
|
|
35
|
+
"lodash": "4.17.21",
|
|
36
|
+
"vm2": "3.9.5",
|
|
37
|
+
"webdriverio": "7.16.8"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"test:unit": "mocha \"./build/test/unit/*-specs.js\"",
|
|
41
|
+
"test:e2e": "mocha -t 160s \"./build/test/e2e/*-specs.js\""
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"gitHead": "5efbd2840a4e5dd078a4646c026472a006ab2211"
|
|
47
|
+
}
|