Skip to content

Instantly share code, notes, and snippets.

@monfresh
Created August 8, 2012 19:49
Show Gist options
  • Select an option

  • Save monfresh/3298026 to your computer and use it in GitHub Desktop.

Select an option

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
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
@monfresh
Copy link
Copy Markdown
Author

monfresh commented Aug 8, 2012

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment