mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Decrease wait in specs time unless spec requires js
This commit is contained in:
parent
b67f04e9bc
commit
1803a9f991
3 changed files with 17 additions and 12 deletions
|
@ -1,4 +1,4 @@
|
||||||
Capybara::SpecHelper.spec '#asser_selector?' do
|
Capybara::SpecHelper.spec '#assert_selector' do
|
||||||
before do
|
before do
|
||||||
@session.visit('/with_html')
|
@session.visit('/with_html')
|
||||||
end
|
end
|
||||||
|
@ -60,7 +60,7 @@ Capybara::SpecHelper.spec '#asser_selector?' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Capybara::SpecHelper.spec '#has_no_selector?' do
|
Capybara::SpecHelper.spec '#assert_no_selector' do
|
||||||
before do
|
before do
|
||||||
@session.visit('/with_html')
|
@session.visit('/with_html')
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,6 +12,21 @@ module Capybara
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
config.filter_run_excluding :requires => filter
|
config.filter_run_excluding :requires => filter
|
||||||
|
config.before do
|
||||||
|
Capybara.app = TestApp
|
||||||
|
|
||||||
|
Capybara.configure do |config|
|
||||||
|
config.default_selector = :xpath
|
||||||
|
end
|
||||||
|
|
||||||
|
# set up a fast wait time so that most tests are faster
|
||||||
|
# but, if we require JS, increase it a bit.
|
||||||
|
if example.metadata[:requires] and example.metadata[:requires].include?(:js)
|
||||||
|
Capybara.default_wait_time = 1
|
||||||
|
else
|
||||||
|
Capybara.default_wait_time = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def spec(name, options={}, &block)
|
def spec(name, options={}, &block)
|
||||||
|
|
|
@ -7,12 +7,6 @@ require 'rspec'
|
||||||
require 'capybara'
|
require 'capybara'
|
||||||
|
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
config.before do
|
|
||||||
Capybara.configure do |config|
|
|
||||||
config.default_selector = :xpath
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Workaround for http://code.google.com/p/selenium/issues/detail?id=3147:
|
# Workaround for http://code.google.com/p/selenium/issues/detail?id=3147:
|
||||||
# Rerun the example if we hit a transient "docElement is null" error
|
# Rerun the example if we hit a transient "docElement is null" error
|
||||||
config.around(:each) do |example|
|
config.around(:each) do |example|
|
||||||
|
@ -32,14 +26,10 @@ end
|
||||||
|
|
||||||
# Required here instead of in rspec_spec to avoid RSpec deprecation warning
|
# Required here instead of in rspec_spec to avoid RSpec deprecation warning
|
||||||
require 'capybara/rspec'
|
require 'capybara/rspec'
|
||||||
|
|
||||||
require 'capybara/spec/session'
|
require 'capybara/spec/session'
|
||||||
|
|
||||||
alias :running :lambda
|
alias :running :lambda
|
||||||
|
|
||||||
Capybara.app = TestApp
|
|
||||||
Capybara.default_wait_time = 1 # less timeout so tests run faster
|
|
||||||
|
|
||||||
module TestSessions
|
module TestSessions
|
||||||
RackTest = Capybara::Session.new(:rack_test, TestApp)
|
RackTest = Capybara::Session.new(:rack_test, TestApp)
|
||||||
Selenium = Capybara::Session.new(:selenium, TestApp)
|
Selenium = Capybara::Session.new(:selenium, TestApp)
|
||||||
|
|
Loading…
Add table
Reference in a new issue