Skip to content

Commit

Permalink
fix: Add base path to proxy options (#865)
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach authored Feb 21, 2025
1 parent 695142c commit 30a6ac3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ class AndroidUiautomator2Driver
disableWindowAnimation: !!this.opts.disableWindowAnimation,
disableSuppressAccessibilityService: this.opts.disableSuppressAccessibilityService,
readTimeout: this.opts.uiautomator2ServerReadTimeout,
basePath: this.basePath,
};
// now that we have package and activity, we can create an instance of
// uiautomator2 with the appropriate options
Expand Down
6 changes: 5 additions & 1 deletion lib/uiautomator2.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class UiAutomator2Server {
* @param {UiAutomator2ServerOptions} opts
*/
constructor (log, opts) {
for (let req of REQD_PARAMS) {
for (const req of REQD_PARAMS) {
if (!opts || !util.hasValue(opts[req])) {
throw new Error(`Option '${req}' is required!`);
}
Expand All @@ -75,6 +75,9 @@ class UiAutomator2Server {
port: this.systemPort,
keepAlive: true,
};
if (opts.basePath) {
proxyOpts.reqBasePath = opts.basePath;
}
if (opts.readTimeout && opts.readTimeout > 0) {
proxyOpts.timeout = opts.readTimeout;
}
Expand Down Expand Up @@ -453,4 +456,5 @@ export default UiAutomator2Server;
* @property {number} [readTimeout]
* @property {boolean} [disableSuppressAccessibilityService]
* @property {string} [apk]
* @property {string} [basePath]
*/

0 comments on commit 30a6ac3

Please # to comment.