mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-10-30 10:49:03 -04:00
18 lines
625 B
Ruby
18 lines
625 B
Ruby
# frozen_string_literal: true
|
|
|
|
# When a page navigates while Capybara is querying it, Chrome can answer with
|
|
# "Node with given id does not belong to the document" rather than a stale
|
|
# element error. Capybara only retries the latter, so the spec fails on a page
|
|
# that was about to be fine. Retry this one as well.
|
|
module DetachedNodeRetry
|
|
DETACHED = 'Node with given id does not belong to the document'
|
|
|
|
protected
|
|
|
|
def catch_error?(error, errors = nil)
|
|
super || (error.is_a?(Selenium::WebDriver::Error::UnknownError) && error.message.include?(DETACHED))
|
|
end
|
|
end
|
|
|
|
Capybara::Node::Base.prepend(DetachedNodeRetry)
|