|
1 | 1 | import { AndroidUiautomator2Driver } from 'appium-uiautomator2-driver'; |
| 2 | +// @ts-ignore |
| 3 | +import { XCUITestDriver } from 'appium-xcuitest-driver'; |
| 4 | +// @ts-ignore |
| 5 | +import { Mac2Driver } from 'appium-mac2-driver'; |
2 | 6 | import { findAPortNotInUse } from 'portscanner'; |
3 | 7 | import { waitForCondition } from 'asyncbox'; |
4 | 8 | import { JWProxy } from '@appium/base-driver'; |
@@ -29,13 +33,28 @@ export async function getProxyDriver( |
29 | 33 | strategy: string, |
30 | 34 | ): Promise<JWProxy | undefined> { |
31 | 35 | if (strategy.startsWith('-flutter') || FLUTTER_LOCATORS.includes(strategy)) { |
| 36 | + this.log.debug( |
| 37 | + `getProxyDriver: using flutter driver, strategy: ${strategy}`, |
| 38 | + ); |
32 | 39 | return this.proxy; |
33 | 40 | } else if (this.proxydriver instanceof AndroidUiautomator2Driver) { |
| 41 | + this.log.debug( |
| 42 | + 'getProxyDriver: using AndroidUiautomator2Driver driver for Android', |
| 43 | + ); |
34 | 44 | // @ts-ignore Proxy instance is OK |
35 | 45 | return this.proxydriver.uiautomator2.jwproxy; |
36 | | - } else { |
| 46 | + } else if (this.proxydriver instanceof XCUITestDriver) { |
| 47 | + this.log.debug('getProxyDriver: using XCUITestDriver driver for iOS'); |
37 | 48 | // @ts-ignore Proxy instance is OK |
38 | 49 | return this.proxydriver.wda.jwproxy; |
| 50 | + } else if (this.proxydriver instanceof Mac2Driver) { |
| 51 | + this.log.debug('getProxyDriver: using Mac2Driver driver for mac'); |
| 52 | + // @ts-ignore Proxy instance is OK |
| 53 | + return this.proxydriver.wda.proxy; |
| 54 | + } else { |
| 55 | + throw new Error( |
| 56 | + `proxydriver is unknown type (${typeof this.proxydriver})`, |
| 57 | + ); |
39 | 58 | } |
40 | 59 | } |
41 | 60 |
|
|
0 commit comments