Cleanup and timing changes

This commit is contained in:
Thomas Walpole 2019-01-15 11:05:35 -08:00
parent 0fe411a6da
commit b276b27a8f
8 changed files with 8 additions and 10 deletions

1
.rspec
View File

@ -1,5 +1,4 @@
--color
--require fuubar
--format Fuubar
# --format documentation
--order random

View File

@ -1,6 +1,6 @@
source 'https://rubygems.org'
gem 'bundler', '~> 1.1'
gem 'bundler', '< 3.0'
gemspec path: '..'
gem 'xpath', github: 'teamcapybara/xpath'

View File

@ -86,7 +86,7 @@ module Capybara
raise err unless driver.wait? && catch_error?(err, errors)
raise err if timer.expired?
sleep(0.05)
sleep(0.01)
reload if session_options.automatic_reload
retry
ensure

View File

@ -15,7 +15,7 @@ module Capybara
while window.exists?
return false if timer.expired?
sleep 0.05
sleep 0.01
end
true
end

View File

@ -385,7 +385,7 @@ private
until find_xpath('/html/body/*').empty?
raise Capybara::ExpectationNotMet, 'Timed out waiting for Selenium session reset' if timer.expired?
sleep 0.05
sleep 0.01
end
end

View File

@ -23,7 +23,7 @@ module Capybara::Selenium::Driver::ChromeDriver
# Chromedriver doesn't wait long enough for state to change when coming out of fullscreen
# and raises unnecessary error. Wait a bit and try again.
sleep 0.5
sleep 0.25
super
end

View File

@ -14,7 +14,7 @@ class Capybara::Selenium::Node < Capybara::Driver::Node
end
def all_text
text = driver.execute_script('return arguments[0].textContent', self)
text = driver.evaluate_script('arguments[0].textContent', self)
text.gsub(/[\u200b\u200e\u200f]/, '')
.gsub(/[\ \n\f\t\v\u2028\u2029]+/, ' ')
.gsub(/\A[[:space:]&&[^\u00a0]]+/, '')
@ -289,7 +289,7 @@ private
# Ensure we are focused on the element
click
script = <<-JS
driver.execute_script <<-JS, self
var range = document.createRange();
var sel = window.getSelection();
arguments[0].focus();
@ -297,7 +297,6 @@ private
sel.removeAllRanges();
sel.addRange(range);
JS
driver.execute_script script, self
# The action api has a speed problem but both chrome and firefox 58 raise errors
# if we use the faster direct send_keys. For now just send_keys to the element

View File

@ -132,7 +132,7 @@ module Capybara
timer = Capybara::Helpers.timer(expire_in: seconds)
loop do
prev_size = size
sleep 0.05
sleep 0.025
return res if prev_size == size
break if timer.expired?
end