Skip to content

Commit 30a6ac3

Browse files
fix: Add base path to proxy options (#865)
1 parent 695142c commit 30a6ac3

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/driver.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,7 @@ class AndroidUiautomator2Driver
701701
disableWindowAnimation: !!this.opts.disableWindowAnimation,
702702
disableSuppressAccessibilityService: this.opts.disableSuppressAccessibilityService,
703703
readTimeout: this.opts.uiautomator2ServerReadTimeout,
704+
basePath: this.basePath,
704705
};
705706
// now that we have package and activity, we can create an instance of
706707
// uiautomator2 with the appropriate options

lib/uiautomator2.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class UiAutomator2Server {
6161
* @param {UiAutomator2ServerOptions} opts
6262
*/
6363
constructor (log, opts) {
64-
for (let req of REQD_PARAMS) {
64+
for (const req of REQD_PARAMS) {
6565
if (!opts || !util.hasValue(opts[req])) {
6666
throw new Error(`Option '${req}' is required!`);
6767
}
@@ -75,6 +75,9 @@ class UiAutomator2Server {
7575
port: this.systemPort,
7676
keepAlive: true,
7777
};
78+
if (opts.basePath) {
79+
proxyOpts.reqBasePath = opts.basePath;
80+
}
7881
if (opts.readTimeout && opts.readTimeout > 0) {
7982
proxyOpts.timeout = opts.readTimeout;
8083
}
@@ -453,4 +456,5 @@ export default UiAutomator2Server;
453456
* @property {number} [readTimeout]
454457
* @property {boolean} [disableSuppressAccessibilityService]
455458
* @property {string} [apk]
459+
* @property {string} [basePath]
456460
*/

0 commit comments

Comments
 (0)