Running REPL:
ruby repl.rb <path to your iOS.app> <device name>
The REPL will start, and you can enter the same commands that you would enter in an Instruments UI Automation script.
The easiest way I know of to find the full path to your iOS app (in simulator) is here: https://github.com/tue-savvy/SimulatorManager (doesn't quite find it, but gets you very close).
You can find device names by typing instruments -s
into your console.
FIXME: actually give some examples here.
You can execute any Javascript statement that you can write in an instruments script, such as:
target.frontMostApp().mainWindow().tabBar()[0].tap()
to tap on the first element in the app's tab bar.
The REPL process:
- Starts up a DRb server
- Generates a Javascript file for Instruments that is described below
- Pushes any commands into the DRb server's queue
The Instruments client is composed of two parts:
-
A simple script that will pop (it's not really LIFO) commands from the DRb server and print them out.
-
A (generated) Javascript file that loops the script and executes each command that is retrieved from the DRb server via
eval