-
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
2,874 additions
and
2,499 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,32 @@ | ||
import getPort from 'get-port'; | ||
import { isPortBusy } from './helpers'; | ||
|
||
export async function androidCapabilities( | ||
caps: { firstMatch: { [x: string]: number }[] }, | ||
freeDevice: { udid: any } | ||
caps: { firstMatch: { [x: string]: number | string }[] }, | ||
freeDevice: { udid: any; name: string } | ||
) { | ||
caps.firstMatch[0]['appium:udid'] = freeDevice.udid; | ||
caps.firstMatch[0]['appium:deviceName'] = freeDevice.udid; | ||
caps.firstMatch[0]['appium:systemPort'] = await getPort(); | ||
caps.firstMatch[0]['appium:chromeDriverPort'] = await getPort(); | ||
caps.firstMatch[0]['appium:mjpegServerPort'] = await getPort(); | ||
} | ||
|
||
export async function iOSCapabilities( | ||
caps: { firstMatch: { [x: string]: number }[] }, | ||
freeDevice: { udid: any } | ||
caps: { firstMatch: { [x: string]: number | string }[] }, | ||
freeDevice: { udid: any; name: string; realDevice: boolean; mjpegServerPort?: number } | ||
) { | ||
caps.firstMatch[0]['appium:udid'] = freeDevice.udid; | ||
caps.firstMatch[0]['appium:deviceName'] = freeDevice.udid; | ||
caps.firstMatch[0]['appium:deviceName'] = freeDevice.name; | ||
caps.firstMatch[0]['appium:wdaLocalPort'] = await getPort(); | ||
if (freeDevice.realDevice) { | ||
caps.firstMatch[0]['appium:mjpegServerPort'] = await getPort(); | ||
} else { | ||
/* In simulator, port forwarding won't happen for each session. So mjpegServerPort will be used only for 1st time. | ||
* So set the port for the first time and resuse the same port for subsequent sessions. | ||
*/ | ||
let existingPort = freeDevice.mjpegServerPort; | ||
caps.firstMatch[0]['appium:mjpegServerPort'] = | ||
existingPort && (await isPortBusy(existingPort)) ? existingPort : await getPort(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.