Skip to content

Commit

Permalink
fix: Skip chromedriver proxy suspend if the proxy is not initialized …
Browse files Browse the repository at this point in the history
…yet (#754)
  • Loading branch information
mykola-mokhnach authored Mar 20, 2024
1 parent f749f93 commit a6d9146
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/commands/app-management.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export async function mobileInstallMultipleApks(opts) {
/**
* Puts the app to background and waits the given number of seconds Then restores the app
* if necessary. The call is blocking.
* @this {AndroidUiautomator2Driver}=
* @this {AndroidUiautomator2Driver}
* @param {import('./types').BackgroundAppOptions} [opts={}]
* @returns {Promise<void>}
*/
Expand Down
4 changes: 4 additions & 0 deletions lib/commands/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ export async function openNotifications() {
* @returns {void}
*/
export function suspendChromedriverProxy() {
if (!this.uiautomator2?.proxyReqRes || !this.uiautomator2?.proxyCommand) {
return;
}

this.chromedriver = undefined;
this.proxyReqRes = this.uiautomator2.proxyReqRes.bind(
this.uiautomator2
Expand Down
2 changes: 1 addition & 1 deletion lib/driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ class AndroidUiautomator2Driver
setOrientation = setOrientation;
getClipboard = getClipboard;
openNotifications = openNotifications;
suspendChromedriverProxy = suspendChromedriverProxy;
suspendChromedriverProxy = suspendChromedriverProxy as any;
mobileGetDeviceInfo = mobileGetDeviceInfo;

setUrl = setUrl;
Expand Down

0 comments on commit a6d9146

Please sign in to comment.