Useful Custom Steps for Calabash Android

Bitbar, the mobile devops company. Logo, large

Calabash Android has wide range of predefined steps (README for steps), but sometimes there might be some step missing. Here is described few useful custom steps for Calabash Android.

Download Our Calabash 101 Here to Learn Basics and Advanced Tips.

Change the orientation

It is crucial to test how your app performs if the orientation changes.

Add this to features/step_definitions/calabash_steps.rb.
Then /^I set the screen to portrait$/ do
perform_action('set_activity_orientation', 'portrait')

Then /^I set the screen to landscape$/ do
perform_action('set_activity_orientation', 'landscape')

Now you can change the orientation in your test.
Then I set the screen to landscape


Hide the keyboard

Many times the keyboard is on the way and your tests will fail, because the keyboard hides the button you are trying to click. Here is the custom step to hide the keyboard.
Then /^I hide the keyboard$/ do

Now you can hide the keyboard in your test.
Then I hide the keyboard

Calabash 101: Basics, Getting Started and Advanced Tips

Go through the basics of Calabash, how to create proper Calabash tests and how to make the most of them.