Search code examples
iospaginationcalabash-ios

how to swipe from page to page on an iOS pagination view using calabash


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

Solution

  • 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.