Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions lib/core/device.rb
Original file line number Diff line number Diff line change
Expand Up @@ -447,17 +447,17 @@ def end_record(action)
# OffsetFractionY
# NoRaise
def click(action)
start = Time.now
before_find = Time.now
el = wait_for(action)
return unless el

now = Time.now
log_info("Time to find element: #{now - start}s") if action["CheckTime"]
after_find = Time.now
log_info("Time to find element: #{after_find - before_find}s") if action["CheckTime"]
error = nil

wait_time = (action["CheckTime"] ? action["CheckTime"] : @timeout)

while (Time.now - start) < wait_time
loop do
begin
@platform == "iOS" ?
@driver.action.move_to(el) :
Expand All @@ -478,11 +478,12 @@ def click(action)
else
el.click
end
log_info("Time for click: #{Time.now - start}s") if action["CheckTime"]
log_info("Time for click: #{Time.now - after_find}s") if action["CheckTime"]
return
rescue => e
error = e
end
break if (Time.now - before_find) >= wait_time
end

if error && !action["NoRaise"]
Expand Down Expand Up @@ -535,24 +536,25 @@ def tap_by_coord(action)
# CheckTime
# NoRaise
def press(action)
start = Time.now
before_find = Time.now
el = wait_for(action)
return unless el

now = Time.now
log_info("Time to find element: #{now - start}s") if action["CheckTime"]
after_find = Time.now
log_info("Time to find element: #{after_find - before_find}s") if action["CheckTime"]
error = nil

wait_time = (action["CheckTime"] ? action["CheckTime"] : @timeout)

while (Time.now - start) < wait_time
loop do
begin
@driver.action.move_to(el).pointer_down(:left).release.perform
log_info("Time for click: #{Time.now - start}s") if action["CheckTime"]
log_info("Time for click: #{Time.now - after_find}s") if action["CheckTime"]
return
rescue => e
error = e
end
break if (Time.now - before_find) >= wait_time
end
if error && !action["NoRaise"]
path = take_error_screenshot()
Expand All @@ -568,17 +570,17 @@ def press(action)
# CheckTime
# NoRaise
def click_and_hold(action)
start = Time.now
before_find = Time.now
el = wait_for(action)
return unless el

now = Time.now
log_info("Time to find element: #{now - start}s") if action["CheckTime"]
after_find = Time.now
log_info("Time to find element: #{after_find - before_find}s") if action["CheckTime"]
error = nil

wait_time = (action["CheckTime"] ? action["CheckTime"] : @timeout)

while (Time.now - start) < wait_time
loop do
begin
@platform == "iOS" ?
@driver.action.move_to(el) :
Expand All @@ -588,11 +590,12 @@ def click_and_hold(action)
end
begin
@driver.action.click_and_hold(el).perform
log_info("Time for click and hold: #{Time.now - start}s") if action["CheckTime"]
log_info("Time for click and hold: #{Time.now - after_find}s") if action["CheckTime"]
return
rescue => e
error = e
end
break if (Time.now - before_find) >= wait_time
end
if error && !action["NoRaise"]
path = take_error_screenshot()
Expand Down