For UI Automation testing, I want to have a Reset iOS Simulator and then add a few photos to it before being my automation scripts begin.
When I run this:
xcrun simctl erase device_UUID
xcrun simctl addphoto device_UUID ~/Desktop/photos/photo1.PNG
I get this error:
An error was encountered processing the command (code=146):
Invalid device state
How can I erase the simulator and then add photos to it programmatically?
After erasing the simulator, you have to launch it first before the 'addphoto' command will work.
It doesn't work to launch it programmatically with the command
xcrun simctl bootSo far this is the only thing I've gotten to work.
Since I loop through all of the simulators to set them all up with photos, I have to kill the simulator before opening the next one.