Skip to content

Instantly share code, notes, and snippets.

@markrickert
Created July 30, 2013 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markrickert/6115693 to your computer and use it in GitHub Desktop.
Save markrickert/6115693 to your computer and use it in GitHub Desktop.
Trying to loop through a UITableView... it prints out the "puts" line all at once.
it "should select all cells and go back" do
wait 0.5 do #Wait for the view to load
ips = []
(1..@screen.table_view.numberOfSections-1).to_a.each do |section| # (skip the first section)
rows = @screen.table_view.numberOfRowsInSection(section)
(0..rows-1).to_a.each do |row|
ips << NSIndexPath.indexPathForRow(row, inSection:section)
end
end
ips.each do |ip|
wait 0.75 do
@screen.table_view.scrollToRowAtIndexPath(ip, atScrollPosition:UITableViewScrollPositionMiddle, animated:false)
wait 1.5 do
puts "#{section}, #{row} (#{indexPath})"
tap(@screen.table_view.cellForRowAtIndexPath(indexPath))
wait 0.75 do
tap("Back")
end
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment