Created
August 8, 2012 19:49
-
-
Save monfresh/3298026 to your computer and use it in GitHub Desktop.
Custom step definition for Calabash iOS to swipe a cell in any orientation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Then /^I swipe on cell number (\d+) in "([^\"]*)"$/ do |index, orientation| | |
| index = index.to_i | |
| screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0) | |
| if orientation == "landscape" | |
| swipe("up", {:query => "tableViewCell index:#{index-1}"}) | |
| elsif orientation == "portrait" | |
| swipe("right", {:query => "tableViewCell index:#{index-1}"}) | |
| end | |
| sleep(STEP_PAUSE) | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a modification of the predefined step definition that comes with the calabash gem. This modification is necessary because the original step definition calls the "cell_swipe" function, which only works in portrait. At least, that was my experience on an actual iPad. I verified that my custom step definition works in both landscape and portrait.