mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Cleanup and timing changes
This commit is contained in:
parent
0fe411a6da
commit
b276b27a8f
8 changed files with 8 additions and 10 deletions
1
.rspec
1
.rspec
|
@ -1,5 +1,4 @@
|
|||
--color
|
||||
--require fuubar
|
||||
--format Fuubar
|
||||
# --format documentation
|
||||
--order random
|
|
@ -1,6 +1,6 @@
|
|||
source 'https://rubygems.org'
|
||||
|
||||
gem 'bundler', '~> 1.1'
|
||||
gem 'bundler', '< 3.0'
|
||||
gemspec path: '..'
|
||||
|
||||
gem 'xpath', github: 'teamcapybara/xpath'
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -15,7 +15,7 @@ module Capybara
|
|||
while window.exists?
|
||||
return false if timer.expired?
|
||||
|
||||
sleep 0.05
|
||||
sleep 0.01
|
||||
end
|
||||
true
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue