Module: Frank::Cucumber::GestureHelper

Included in:
FrankHelper
Defined in:
lib/frank-cucumber/gesture_helper.rb

Instance Method Summary collapse

Instance Method Details

#double_tap(selector) ⇒ Array<Boolean>

Double tap the selector

Parameters:

  • selector (String)

    a view selector.

Returns:

  • (Array<Boolean>)

    an array indicating for each view which matched the selector whether it was touched or not.

Raises:

  • an expection if no views matched the selector

  • an expection if no views which matched the selector could be touched



45
46
47
48
49
# File 'lib/frank-cucumber/gesture_helper.rb', line 45

def double_tap( selector )
	touch_successes = frankly_map( selector, "doubleTap"  )
	raise "Could not find anything matching [#{selector}] to double tap" if touch_successes.empty?
    raise "Some views could not be double tap (probably because they are not within the current viewport)" if touch_successes.include?(false)
end

#double_tap_point(selector, x, y) ⇒ Array<Boolean>

Double tap the selector at a specific point

Parameters:

  • selector (String)

    a view selector.

  • x (Number)

    the x-coordinate to touch

  • y (Number)

    the y-coordinate to touch

Returns:

  • (Array<Boolean>)

    an array indicating for each view which matched the selector whether it was touched or not.

Raises:

  • an expection if no views matched the selector

  • an expection if no views which matched the selector could be touched



61
62
63
64
65
# File 'lib/frank-cucumber/gesture_helper.rb', line 61

def double_tap_point( selector, x, y )
	touch_successes = frankly_map( selector, "doubleTapx:y:", x, y )
	raise "Could not find anything matching [#{selector}] to double tap" if touch_successes.empty?
    raise "Some views could not be double tap (probably because they are not within the current viewport)" if touch_successes.include?(false)
end

#drag_thumb_in_slider(selector, value, duration) ⇒ Object

Drag the slider thumb to required value, taking the specified time

Parameters:

  • selector (String)

    A view selector

  • value (Number)

    The value up to which the slider should be dragged

  • duration (Number)

    The time interval that the drag should take

    @return [Array<Boolean>] an array indicating for each view which matched the selector if the value was acceptable or not

Raises:

  • an expection if no views matched the selector

  • an expection if no views which matched the selector could have their thumbs dragged



77
78
79
80
81
# File 'lib/frank-cucumber/gesture_helper.rb', line 77

def drag_thumb_in_slider( selector, value, duration )
	touch_successes = frankly_map( selector, "FEX_dragThumbToValue:withDuration:", value, duration)
	raise "Could not find anything matching [#{selector}] to have its thumb dragged" if touch_successes.empty?
    raise "Some views could not had their thumbs dragged (are they even UISLiders?)" if touch_successes.include?(false)
end

#drag_thumb_in_slider_with_default_duration(selector, value) ⇒ Object

Drag the slider thumb to required value

Parameters:

  • selector (String)

    A view selector

  • value (Number)

    The value up to which the slider should be dragged

    @return [Array<Boolean>] an array indicating for each view which matched the selector if the value was acceptable or not

Raises:

  • an expection if no views matched the selector

  • an expection if no views which matched the selector could have their thumbs dragged



92
93
94
95
96
# File 'lib/frank-cucumber/gesture_helper.rb', line 92

def drag_thumb_in_slider_with_default_duration( selector, value )
	touch_successes = frankly_map( selector, "FEX_dragThumbToValue:", value )
	raise "Could not find anything matching [#{selector}] to have its thumb dragged" if touch_successes.empty?
    raise "Some views could not had their thumbs dragged (are they even UISLiders?)" if touch_successes.include?(false)
end

#tap_and_hold(selector, duration = 1) ⇒ Array<Boolean>

Touch and hold the selector for a given duration

Parameters:

  • selector (String)

    a view selector.

  • duration (Number) (defaults to: 1)

    the duration of the touch, the default is 1.

Returns:

  • (Array<Boolean>)

    an array indicating for each view which matched the selector whether it was touched or not.

Raises:

  • an expection if no views matched the selector

  • an expection if no views which matched the selector could be touched



14
15
16
17
18
# File 'lib/frank-cucumber/gesture_helper.rb', line 14

def tap_and_hold( selector, duration = 1 )
	touch_successes = frankly_map( selector, "touchAndHold:", duration )
	raise "Could not find anything matching [#{selector}] to long touch" if touch_successes.empty?
    raise "Some views could not be long touched (probably because they are not within the current viewport)" if touch_successes.include?(false)
end

#tap_and_hold_point(selector, x, y, duration = 1) ⇒ Array<Boolean>

Touch and hold the selector at a specific point for a given duration

Parameters:

  • selector (String)

    a view selector.

  • duration (Number) (defaults to: 1)

    the duration of the touch, the default is 1.

  • x (Number)

    the x-coordinate to touch

  • y (Number)

    the y-coordinate to touch

Returns:

  • (Array<Boolean>)

    an array indicating for each view which matched the selector whether it was touched or not.

Raises:

  • an expection if no views matched the selector

  • an expection if no views which matched the selector could be touched



31
32
33
34
35
# File 'lib/frank-cucumber/gesture_helper.rb', line 31

def tap_and_hold_point( selector, x, y, duration = 1 )
	touch_successes = frankly_map( selector, "touchAndHold:x:y:", duration, x, y )
	raise "Could not find anything matching [#{selector}] to long touch" if touch_successes.empty?
    raise "Some views could not be long touched (probably because they are not within the current viewport)" if touch_successes.include?(false)
end