Skip to content

Instantly share code, notes, and snippets.

@savishy
Last active July 6, 2016 04:53
Show Gist options
  • Save savishy/1f97f0278e1ec4da1faa30654b6fb87a to your computer and use it in GitHub Desktop.
Save savishy/1f97f0278e1ec4da1faa30654b6fb87a to your computer and use it in GitHub Desktop.
List of useful calabash commands

Table of Contents

  1. FAQ
  2. Commands
  3. How Tos

Introduction

This is a list of useful commands in Calabash for Android. The Ruby API is assumed. :exclamation: many of the cheats here are Ruby and not Calabash. This is probably because my Ruby sucks :)

References

  1. https://github.com/calabash/calabash-android/blob/master/documentation/ruby_api.md

FAQ

  1. Where do I use these? In the step_definitions.rb file

Commands

  1. print things: p some_command
  2. query the element hierarchy and print it out: p query("*")
  3. get current activity: current_activity

How Tos

Perform Assertions

This is a Ruby feature. Use the rspec-expectations RubyGem as documented here: 1 and 2.

  • First install this gem: gem install rspec-expectations
  • then in features/support/env.rb: require 'rspec/expectations'
  • finally, you can assert like so: expect(actual_value).to eq("expected value")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment