Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to scroll a ListView until I see a specific string with Calabash-Android

I have exact same question as the post below, except that I need it to work for Android and the post below is for iOS. I have tried both solutions given in that post, but they don't seem to work for Android. All help is appreciated!

How do i scroll a UITable view down until i see a cell with label "Value" in Calabash

like image 496
Anna Avatar asked May 14 '13 16:05

Anna


2 Answers

you can add this new step definition and it should do the trick for Android:

Then /^I scroll until I see the "([^\"]*)" text$/ do |text|
  q = query("TextView text:'#{text}'")
  while q.empty?
    scroll_down
    q = query("TextView text:'#{text}'")
  end 
end

It works for me and I hope it does the same for you!

like image 186
Proghero Avatar answered Nov 19 '22 03:11

Proghero


performAction('scroll_down')

In the statement, performAction() is deprecated since calabash 0.5 so not valid with the latest version

My solution will be,

def scroll_until_I_see(id)
  until element_exists("* marked:'#{id}'") do
    scroll("ScrollView", :down)
  end
end
like image 1
Narendra Chandratre Avatar answered Nov 19 '22 01:11

Narendra Chandratre