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')
end

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

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

screen_orientation

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
hide_soft_keyboard()
end

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

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close