Wynn Netherland changelog.com/posts

Bwoken - iOS UIAutomation testing in CoffeeScript

Testing iOS apps is hard. Appleā€™s UI Automation lets you write test scripts in JavaScript and simulate user interaction, but who wants to hang out in the Instruments GUI app? Bendyworks has improved on the process, however, bringing the simplicity of Rake and the elegance of CoffeeScript to your UI Automation tests:

#import "../../../../Pods/tuneup_js/tuneup.js"

#import "helpers/TravisCI.js"

test 'Favoriting a repository', (target, app) ->
  RepositoriesScreen.tapRepositoryNamed 'CITravis by Travis-ci'
  BuildsScreen.addToFavorites(app)
  BuildsScreen.back()
  RepositoriesScreen.tapFavorites()
  FavoritesScreen.assertFavoriteNamed 'CITravis by Travis-ci'
  FavoritesScreen.tapAll()

test 'Unfavoriting a repository', (target, app) ->
  RepositoriesScreen.tapFavorites()
  FavoritesScreen.assertFavoriteNamed 'CITravis by Travis-ci'
  FavoritesScreen.tapFavoriteNamed 'CITravis by Travis-ci'
  BuildsScreen.removeFromFavorites(app)
  BuildsScreen.back()
  FavoritesScreen.assertNoFavoriteNamed 'CITravis by Travis-ci'
  FavoritesScreen.tapAll()

This single test can be run from the command line with:

$ RUN=iphone/favorites rake

Check out the project website, source on GitHub, or introductory video for more. Also be sure to check out their TravisCI.app, a mobile client for Travis CI, for a real-world example.


Discussion

Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00