calabash/calabash-android — pull request #113 by plaa (2012-09-12 11:56:49+00:00)
Title: Asynchronous JavaScript execution action

This commit adds an 'execute_async_javascript' action to Calabash. Instead of expecting the JavaScript to immediately return with a specific return value, this action waits for the JavaScript to signal when it's ready and optionally return a value.

Returning a value is done by calling 'returnValue(value)'. Alternatively the last item in 'arguments' can be used, which is compatible with how WebDriver works. Normal timeouts apply, so the asynchronous JavaScript needs to call returnValue within 30 seconds or it fails.

Example usage:
performAction('execute_async_javascript', 'setTimeout(function() { returnValue("Hello world") }, 1000)')

The other commit changes ExecuteJavascript.java so that it returns a better error message if a WebView component is not found (instead of a NullPointerException).