Reputation: 2846
I'm using Calabash to do some automated UI testing for my app, and I'm trying to touch some views which are embedded inside of a larger view, so I can't access their exact name to touch them directly.
So I'm trying to touch them using the relative center of the view they're embedded in, however, I'm just blindly adjusting my offset to try and hit these views without knowing if I'm getting farther or closer to the view.
So, my question, is there a way to show where a touch even occurred in the iOS simulator? I'm thinking something like a dot or some way to indicate that a touch occurred and where it occurred.
Any help is appreciated, thanks!
Upvotes: 23
Views: 8470
Reputation: 22055
"Show single touches" can be enabled and disabled in the Simulator settings.
Don't know when it was first introduced, but probably long after the question was asked.
Upvotes: 3
Reputation: 998
defaults write com.apple.iphonesimulator ShowSingleTouches 1
Execute this command in terminal and restart the simulator
Upvotes: 32
Reputation: 2480
It sounds like there are not embedded views, but just a single view that responds to touches in various locations.
The Calabash query language can find views that are embedded in other views.
In addition to visualizing the touch, you might try logging where the touches are occurring. The Briar iOS Example app has an example of how to do this. The gist is to create a UIWindow subclass, add a method to intercept the sendEvent:
selector, log the touch point, and then call UIWindow's sendEvent:
.
You can view device logs in Xcode's Device Window (Shift+Command+2) or with ideviceinstaller:
$ idevicesyslog -u < udid >
You can use run-loop to tail the log of a simulator.
# Simulator must be launched. App does not have to be running.
$ run-loop simctl tail
Upvotes: 0