UITest does not pickup simulated location setup up in scheme when running from Xcodebuild
As part of our effort to move our CI from a locally run Jenkins to GitHub actions, we are trying to run all UITests from command line without touching the Xcode UI. Some of our UI Tests require a simulated location so we have setup a simulated location in the scheme, as shown below
We then run the UITests from Xcode and everything is OK
However when we try to run it from the command line, using Xcodebuild, it no longer seem to pick up the location. The test that rely on receiving a simulated location fail as a result.
Detailed steps to reproduce are given further below
We tested using Xcode 11.4 on a MacBook Pro (15-inch, 2017) running macOS version 10.15.4 (19E287) (Catolina) Simulator version iPhone 11 Pro running iOS 13.4
-
Clone the github project
-
Start the simulator "iPhone 11 Pro"
-
On the simulator menu, features, location, make sure ‘None’ is selected
-
On the simulator menu, Under device, choose “Erase all content and settings”
-
Start Xcode
-
Run the UI Tests
-
All the tests should be green
-
On the simulator menu, features, location, make sure ‘None’ is selected
-
On the simulator menu, Under device, choose “Erase all content and settings”
-
Open the terminal
-
go to the directory where the project has been cloned
-
Run the UI test from the command line with the following command:
xcodebuild -destination "platform=iOS Simulator,name=iPhone 11 Pro" -scheme LocIssue test
12: The UI Tests fail
It looks like when running from Xcodebuild, the location setup in the scheme is not picked up
