From d841bdf0f4c93bf5e4fa8327a204521297ef5cf5 Mon Sep 17 00:00:00 2001 From: Edgars Eglitis Date: Tue, 25 Jun 2024 16:45:55 +0300 Subject: [PATCH 1/2] fix: fix RecheckAfterScrolls behavior --- lib/core/device.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/core/device.rb b/lib/core/device.rb index d360bc5c..d06b9e9d 100644 --- a/lib/core/device.rb +++ b/lib/core/device.rb @@ -804,9 +804,9 @@ def scroll_until_element_visible(action) bg_el = wait_for(action["ScrollTarget"]) y_top = bg_el.location.y y_bottom = bg_el.location.y + bg_el.size.height - x_point = bg_el.location.x + (bg_el.size.width * x_frac) - y_start = y_top + (bg_el.size.height * y_start_frac) - y_end = y_top + (bg_el.size.height * y_end_frac) + x_point = bg_el.location.x + (bg_el.size.width * (0.5 + x_frac)) + y_start = y_top + (bg_el.size.height * (0.5 + y_start_frac)) + y_end = y_top + (bg_el.size.height * (0.5 + y_end_frac)) end # raise error if timeout exceeded return if original_noraise From 4ac4b9b390e015ce9a6171407ec6272231c43bfd Mon Sep 17 00:00:00 2001 From: Edgars Eglitis Date: Wed, 26 Jun 2024 11:02:13 +0300 Subject: [PATCH 2/2] fix: use global timeout in scroll_until_element_visible --- README.md | 2 +- lib/core/device.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f0e2ba1a..4147209b 100644 --- a/README.md +++ b/README.md @@ -834,7 +834,7 @@ Set the scrolling timeout: Role: role1 Strategy: id/css/xpath/uiautomator/class_chain/... Id: //some/path - ScrollTimeout: 90 (In seconds - default is 60) + ScrollTimeout: 90 (In seconds - default is the global timeout) Instruct the target element to be scrolled into full view. This means that once the element is visible, one additional swipe will be executed from the element location, to either the top or the bottom of the scroll target (depending on the scroll direction configured in the swipe action). diff --git a/lib/core/device.rb b/lib/core/device.rb index d06b9e9d..ce9bcf4d 100644 --- a/lib/core/device.rb +++ b/lib/core/device.rb @@ -743,7 +743,7 @@ def scroll_until_element_visible(action) scroll_mul /= convert_value(sw_action["SwipeSpeedMultiplier"]).to_f if sw_action.key?("SwipeSpeedMultiplier") scroll_pause = convert_value(sw_action["SwipePauseDuration"]).to_f if sw_action.key?("SwipePauseDuration") end - scroll_timeout = action.key?("ScrollTimeout") ? convert_value(action["ScrollTimeout"]).to_f : 60 + scroll_timeout = action.key?("ScrollTimeout") ? convert_value(action["ScrollTimeout"]).to_f : @timeout # calculate the exact coordinates for swiping, # depending on whether a specific element to swipe on is provided if action.key?("ScrollTarget")