made selenium integration tests run applying larrytheliquid's patch: 627913708c
This commit is contained in:
parent
73dc59cc29
commit
6cd734aec9
@ -1,13 +1,7 @@
|
|||||||
require "webrat"
|
require "webrat"
|
||||||
gem "selenium-client", ">=1.2.14"
|
gem "selenium-client", ">=1.2.14"
|
||||||
require "selenium/client"
|
require "selenium/client"
|
||||||
|
require "webrat/selenium/silence_stream"
|
||||||
# active_support already defines silence_stream, no need to do that again if it's already present.
|
|
||||||
# http://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/kernel/reporting.rb
|
|
||||||
unless Kernel.respond_to?(:silence_stream)
|
|
||||||
require "webrat/selenium/silence_stream"
|
|
||||||
end
|
|
||||||
|
|
||||||
require "webrat/selenium/selenium_session"
|
require "webrat/selenium/selenium_session"
|
||||||
require "webrat/selenium/matchers"
|
require "webrat/selenium/matchers"
|
||||||
require "webrat/core_extensions/tcp_socket"
|
require "webrat/core_extensions/tcp_socket"
|
||||||
|
@ -1,13 +1,17 @@
|
|||||||
module Webrat
|
module Webrat
|
||||||
module Selenium
|
module Selenium
|
||||||
module SilenceStream
|
module SilenceStream
|
||||||
def silence_stream(stream)
|
# active_support already defines silence_stream, no need to do that again if it's already present.
|
||||||
old_stream = stream.dup
|
# http://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/kernel/reporting.rb
|
||||||
stream.reopen(RUBY_PLATFORM =~ /mswin/ ? 'NUL:' : '/dev/null')
|
unless Kernel.respond_to?(:silence_stream)
|
||||||
stream.sync = true
|
def silence_stream(stream)
|
||||||
yield
|
old_stream = stream.dup
|
||||||
ensure
|
stream.reopen(RUBY_PLATFORM =~ /mswin/ ? 'NUL:' : '/dev/null')
|
||||||
stream.reopen(old_stream)
|
stream.sync = true
|
||||||
|
yield
|
||||||
|
ensure
|
||||||
|
stream.reopen(old_stream)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,9 +2,12 @@ require 'test_helper'
|
|||||||
|
|
||||||
class WebratTest < ActionController::IntegrationTest
|
class WebratTest < ActionController::IntegrationTest
|
||||||
|
|
||||||
test "should visit fully qualified urls" do
|
#Firefox raises a security concern under Selenium
|
||||||
visit root_url(:host => "chunkybacon.example.com")
|
unless ENV['WEBRAT_INTEGRATION_MODE'] == 'selenium'
|
||||||
assert_equal "chunkybacon", request.subdomains.first
|
test "should visit fully qualified urls" do
|
||||||
|
visit root_url(:host => "chunkybacon.example.com")
|
||||||
|
assert_equal "chunkybacon", request.subdomains.first
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should visit pages" do
|
test "should visit pages" do
|
||||||
@ -68,9 +71,12 @@ class WebratTest < ActionController::IntegrationTest
|
|||||||
assert_have_selector "h1"
|
assert_have_selector "h1"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should detect infinite redirects" do
|
# Firefox detects and prevents infinite redirects under Selenium
|
||||||
assert_raises Webrat::InfiniteRedirectError do
|
unless ENV['WEBRAT_INTEGRATION_MODE'] == 'selenium'
|
||||||
visit infinite_redirect_path
|
test "should detect infinite redirects" do
|
||||||
|
assert_raises Webrat::InfiniteRedirectError do
|
||||||
|
visit infinite_redirect_path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user