Maintenance: Custom method Capybara::Node::Element#in_fixed_postion is error prone due to a race condition because first check is performed without a sleep.

This commit is contained in:
Thorsten Eckel 2020-08-24 15:38:58 +02:00
parent b58225a19a
commit 3bcd5e71a1

View file

@ -18,7 +18,7 @@ class Capybara::Node::Element
# @return [Capybara::Node::Element] the element/node # @return [Capybara::Node::Element] the element/node
def in_fixed_postion(checks: 100) def in_fixed_postion(checks: 100)
previous = native.location previous = nil
(checks + 1).times do |check| (checks + 1).times do |check|
raise "Element still moving after #{checks} checks" if check == checks raise "Element still moving after #{checks} checks" if check == checks