I'll be the first so
(Nice initiative
)
(appium@1.6.4. ruby_lib@9.3.1 Working on android 6 and ios 10)
RUBY:
def do_swipe(x1, y1, x2, y2, duration)
action = Appium::TouchAction.new
action.swipe({start_x: x1, start_y: y1, offset_x: x2, offset_y: y2, duration: duration}).perform if is_ios?
action.swipe({start_x: x1, start_y: y1, end_x: x2, end_y: y2, duration: duration}).perform if is_android?
end
def scroll(direction)
width = Appium::Common.window_size.width
height = Appium::Common.window_size.height
x = end_x = width / 4
y = end_y = height / 4
offset_x = 2 * x
offset_y = 2 * y
case direction
when "up"
offset_x = 0
end_y *= 3
when "down"
y *= 3
offset_y*= -1
offset_x = 0
when "right"
offset_y = 0
x *= 3
when "left"
end_x *= 3
offset_x *= -1
offset_y = 0
else
puts "Direction not allowed"
end
do_swipe(x, y, offset_x, offset_y, 800) if is_ios?
do_swipe(x, y, end_x, end_y, 800) if is_android?
end
def drag_and_drop(element_to_drop, dropping_zone)
action = Appium::TouchAction.new
action.press({element: player1}).wait(1000) if is_ios?
action.long_press({element: element_to_drop}) if is_android?
action.move_to({element: dropping_zone}).release.perform
end
I hope this helps someone 