Made Selenium Rails integration tests at least runnable, although
there are failures.
This commit is contained in:
parent
c3f067b551
commit
627913708c
@ -1,13 +1,7 @@
|
||||
require "webrat"
|
||||
gem "selenium-client", ">=1.2.14"
|
||||
require "selenium/client"
|
||||
|
||||
# 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/matchers"
|
||||
require "webrat/core_extensions/tcp_socket"
|
||||
|
@ -1,6 +1,9 @@
|
||||
module Webrat
|
||||
module Selenium
|
||||
module SilenceStream
|
||||
# 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)
|
||||
def silence_stream(stream)
|
||||
old_stream = stream.dup
|
||||
stream.reopen(RUBY_PLATFORM =~ /mswin/ ? 'NUL:' : '/dev/null')
|
||||
@ -12,3 +15,4 @@ module Webrat
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2,10 +2,13 @@ require 'test_helper'
|
||||
|
||||
class WebratTest < ActionController::IntegrationTest
|
||||
|
||||
# Firefox raises a security concern under Selenium
|
||||
unless ENV['WEBRAT_INTEGRATION_MODE'] == 'selenium'
|
||||
test "should visit fully qualified urls" do
|
||||
visit root_url(:host => "chunkybacon.example.com")
|
||||
assert_equal "chunkybacon", request.subdomains.first
|
||||
end
|
||||
end
|
||||
|
||||
test "should visit pages" do
|
||||
visit root_path
|
||||
@ -68,11 +71,14 @@ class WebratTest < ActionController::IntegrationTest
|
||||
assert_have_selector "h1"
|
||||
end
|
||||
|
||||
# Firefox detects and prevents infinite redirects under Selenium
|
||||
unless ENV['WEBRAT_INTEGRATION_MODE'] == 'selenium'
|
||||
test "should detect infinite redirects" do
|
||||
assert_raises Webrat::InfiniteRedirectError do
|
||||
visit infinite_redirect_path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# test "should be able to assert have tag" do
|
||||
# visit root_path
|
||||
|
Loading…
Reference in New Issue
Block a user