Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
inject events into titanium mobile apps
Java Objective-C Python JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
android `tapText()` for Android, added to README
iphone Working `find()` and `tapText()` on iOS
README.md

README.md

spade

Spade is a native iOS and Android module for Titanium which allows you to inject events into your application. It is one component of a system for automated user interface testing for Titanium apps. This is accomplished with Square's Keep It Functional on iPhone and Jayway's Robotium on Android.

Currently, this is not a test framework; it is just a collection of functions which can be used to inject events. The module provides the following functions on both iOS and Android:

tap (view)

Tap a view in the center.

tapAt (view, point)

Tap a view at a set of coordinates in relation to the view.

drag (view, from, to)

Drag along a view, again, local coords.

visible (view)

Check if a view is visible on screen.

type (view, string)

Attempt to type the specified string into the specified view.

tapText (string)

Search for a view displaying the given string and tap it if found. The string argument will be interpereted internally as a regex.

Usage

You can extract the module zip files into your project directory and edit the tiapp.xml file. Then, do something like this

var spade = require('org.russfrank.spade');

var win = Ti.UI.createWindow();
var button = Ti.UI.createButton({title: 'hello'});
win.add(button);
win.open();

button.addEventListener('click', function () { Ti.API.debug('world') });

setTimeout(function () {
  spade.tap(button);
}, 5000);

After five seconds, you should see 'world' in your console.

Future

The functionality of this module is currently very limited; for use in a real testing situation, it still needs the ability to press buttons on Android, enter text, search for views, etc.

This isn't all that difficult though. The frameworks I chose are pretty featureful.

After that, it needs some kindof harness. Appcelerator's Drillbit might do for this.

Note about the Apple App Store

Your app will be rejected if you submit it with this module linked in. This should be obvious.

License

My additions are MIT. Jayway and KIF are both Apache 2, the LICENSEs / NOTICEs are in the project directories where I used those projects.

Something went wrong with that request. Please try again.