Skip to content

Commit

Permalink
Added wait_for_nothing_visible_to_be_animating helper which checks …
Browse files Browse the repository at this point in the history
…for views that are animating and are also `FEX_isVisible`.

This resolves the issues with the UIRefreshControl (Issue moredip#266).
  • Loading branch information
Sam Ward committed Mar 13, 2014
1 parent 0bc4aab commit c2165f2
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions gem/lib/frank-cucumber/frank_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module Frank module Cucumber
# * {#wait_for_element_to_exist}
# * {#wait_for_element_to_exist_and_then_touch_it}
# * {#wait_for_nothing_to_be_animating}
# * {#wait_for_nothing_visible_to_be_animating}
# * {#app_exec}
#
# == Configuring the Frank driver
Expand Down Expand Up @@ -230,6 +231,24 @@ def wait_for_nothing_to_be_animating( timeout = false )
end
end

# Waits for there to be no frank visible views which are animating
#
# @param timeout [Number] number of seconds to wait for nothing to be animating before timeout out. Defaults to {WaitHelper::TIMEOUT}
#
# Raises an exception if there were still visible views animating after {timeout} seconds.
def wait_for_nothing_visible_to_be_animating( timeout = false )

wait_until :timeout => timeout do

visibleViews = frankly_map( 'view', 'FEX_isVisible' )
animatingViews = frankly_map( 'view','isAnimating' )

hash = visibleViews.zip( animatingViews )

visibleAnimatingViews = hash.select { | visibleView, animatingView | visibleView && animatingView }
visibleAnimatingViews.empty?
end
end

# Checks that the specified selector matches at least one view, and that at least one of the matched
# views has an isHidden property set to false
Expand Down

0 comments on commit c2165f2

Please sign in to comment.