Appium not creating new Simulator since v1.10.0
See original GitHub issueThe problem
When running iOS tests, Appium no longer creates new Simulators.
Environment
- Appium version (or git revision) that exhibits the issue: 1.10.0
- Last Appium version that did not exhibit the issue (if applicable): 1.9.1
- Node.js version (unless using Appium.app|exe): 11.5.0
- Mobile platform/version under test: iOS
- Real device or emulator/simulator: Simulator
- Appium CLI or Appium.app|exe: CLI
Details
We were previously using v1.9.1. We would used desired capabilities as follows for iOS tests:
{
"platformName": "ios",
"version": "11.4",
"platformVersion": "11.4",
"browserName": "iPhone 8",
"deviceName": "iPhone 8"
}
Note: browserName
and version
caps are required as we’re running on a grid.
When running tests, Appium would create a new Simulator named something like appiumTest-iPhone 8
and then delete it after the run. I can see this happening in the logs:
[debug] [simctl] Creating simulator with name 'appiumTest-iPhone 8', device type id 'iPhone 8' and runtime id '11.4'
[iOSSim] Constructing iOS simulator for Xcode version 10.1 with udid '2BF4D537-CAF7-40C2-A19A-C9E56A59B645'
[XCUITest] Created simulator with udid '2BF4D537-CAF7-40C2-A19A-C9E56A59B645'.
and deletion:
[iOSSim] Cleaning simulator 2BF4D537-CAF7-40C2-A19A-C9E56A59B645
[debug] [BaseDriver] Event 'resetComplete' logged at 1547725730425 (11:48:50 GMT+0000 (Greenwich Mean Time))
[debug] [XCUITest] Deleting simulator created for this run (udid: '2BF4D537-CAF7-40C2-A19A-C9E56A59B645')
This is useful for parallel tests where a single Appium server could create multiple instances of the same spec Simulator and we could for example split 80 tests over 4 iPhone 8 11.4 Simulators.
Having upgraded to 1.10.0, this no longer seems to work. Appium just uses whichever Simulator already exists that matches the device name and version and just cleans it after rather than deleting:
[iOSSim] Constructing iOS simulator for Xcode version 10.1 with udid '0D1BB17E-B4EA-47E6-A4EC-F04EEDAD1EED'
[XCUITest] Determining device to run tests on: udid: '0D1BB17E-B4EA-47E6-A4EC-F04EEDAD1EED', real device: false
The downside of this is that if we try to run tests in parallel (either with single or multiple Appium servers) then the tests conflict with each other and fail as they’re trying to use the same Simulator.
If I remove the platformVersion
capability and leave version
there then it looks like the functionality is still somewhat there but fails on the missing capability and Appium logs print an error:
[XCUITest] Simulator udid not provided, using desired caps to create a new simulator
[debug] [simctl] Creating simulator with name 'appiumTest-iPhone 8', device type id 'iPhone 8' and runtime id 'null'
[simctl] Error: simctl error running 'create': Invalid runtime: null
It looks like the workaround for this is to manually create multiple Simulators, run multiple Appium nodes and pass a unique udid with the default-capabilities
flag when starting each node, with each node controlling a different Simulator. This is a lot more messing around though. Is this an intentional change?
Link to Appium logs
https://gist.github.com/marcjones/23aec7e30ea91a9561622874bb824b72
Issue Analytics
- State:
- Created 5 years ago
- Comments:15 (6 by maintainers)
Top GitHub Comments
Finally got to testing this again. The new capability does work now, so thank you for that 👍
I did come across scenarios where it does not currently work though and that appears to be due to Xcode changes. Basically Appium is not able to create a simulators for iOS 12.2. I think this will be resolved by an update to the latest version of node-simctl following this change: https://github.com/appium/node-simctl/pull/81
@akifhazarvi This has nothing to do with the issue at hand. Please create a new issue with all the pertinent information.