1

I could not get swipe left to work to go from view to view. so I am now trying to use the pagination dot at the bottom of the screen to change the view.

Can someone please tell me how i can touch dot 'n' using calabash?

I am going to go back to the code and try to see if I can set a accessibility label to the dot. But would love it if there was some way that someone out there in the wide world has already solved this.

i used the following code:

Then /^I swipe left on the cell with name "([^\"]*)"$/ do |arg|
swipe :left, :query => "view marked:'#{arg}'",force: :strongs
end

THIS passes, but it does not actually swipe.

edit:

from what i noticed, the dot was drawn and is not an object, but i could be mistaken. so i could not give it a label. i am still trying to use swipe to change the page-

swipe :left, :query => "view marked:'#{arg}'", :offset => {:x => 0, :y => 0}, :"swipe-delta" => {:horizontal => {:dx=> 1000, :dy=>0} },force: :strong
s5v
  • 495
  • 5
  • 20

2 Answers2

1

What happens when you user the default swipe left? Does it swipe a little but not make it to the next page? We've found that the default swipes are too small to actually switch page views, and defined custom ones, which looks to be what you did above. What do you mean it doesn't actually swipe? Check out this page for more info on swiping.

Setting an accessibility is definitely going to be the best way to press the "dot" but if you can find a unique class structure you could also use that:

touch("CellScrollView child * child UIImage")

I don't recommend this route though, will make your code more sensitive to UI changes. Just add the accessibility label.

astrok
  • 198
  • 1
  • 8
  • thank you. i will take a look at the test case and see check. – s5v Apr 28 '15 at 11:09
  • i used the following - the statement passes, but the swipe does not take me to the next page- swipe :left, :query => "view marked:'#{arg}'", :offset => {:x => 2, :y => 3}, :"swipe-delta" =>{:horizontal => {:dx=> 250, :dy=>0} },force: :strong end – s5v Apr 30 '15 at 07:23
  • also, that link that you provided was what i used to create the command i used above. – s5v Apr 30 '15 at 10:59
  • 1
    Ohh, well the step will pass as long as the action you specified was carried out. You'll probably need to mess around with it in the console to see what works: https://github.com/calabash/calabash-ios/wiki/05-Query-syntax – astrok Apr 30 '15 at 18:50
  • Also, what do you mean the "dot was drawn and is not an object"? If you do a query("*") on the page can you find anything that resembles it? Maybe UIImage? Once you find a query that might be it, check it with flash("my query") – astrok Apr 30 '15 at 18:52
  • what i meant was that , from what i understood, we used CGContextFillEllipseInRect to draw the pagination dot. i will try to make the swipe left by other methods and hope something works. will get back once i get something that works – s5v May 05 '15 at 09:14
1

thank you astray for your help and guidance. the solution that worked for me was this:

Then I swipe to the right

with the definition:

Then /^I swipe to the (left|right|up|down)$/ do |direction|
scroll("scrollView marked:'SCROLL VIEW'", direction)
sleep(STEP_PAUSE) # optional
end 

I will be making this more dynamic, but thought i might as well post the answer here and close the question. also, i would also like to say that though we are 'swiping' left, as we have to move to the page or object on the right, we have to swipe right to move to the object on the right.

s5v
  • 495
  • 5
  • 20