webrat/spec/public/selenium/selenium_session_spec.rb

38 lines
1012 B
Ruby
Raw Normal View History

2009-06-03 23:49:32 +00:00
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
require "webrat/selenium/silence_stream"
require "webrat/selenium/selenium_session"
describe Webrat::SeleniumSession do
2009-06-04 17:18:31 +00:00
2009-06-03 23:49:32 +00:00
before :each do
Webrat.configuration.mode = :selenium
@selenium = Webrat::SeleniumSession.new()
end
2009-06-04 17:18:31 +00:00
2009-06-04 03:06:07 +00:00
it "should throw timeout instead of spec expectionnotmet error" do
2009-06-04 19:24:17 +00:00
lambda {
2009-06-05 18:50:39 +00:00
@selenium.wait_for(:timeout => 0.0001) do
2009-06-04 03:06:07 +00:00
raise ::Spec::Expectations::ExpectationNotMetError
end
2009-06-04 19:24:17 +00:00
}.should raise_error(Webrat::TimeoutError)
2009-06-04 03:06:07 +00:00
end
2009-06-04 17:18:31 +00:00
2009-06-04 03:06:07 +00:00
it "should throw timeout instead of selenium command error" do
2009-06-04 19:24:17 +00:00
lambda {
2009-06-05 18:50:39 +00:00
@selenium.wait_for(:timeout => 0.0001) do
2009-06-04 03:06:07 +00:00
raise ::Selenium::CommandError
end
2009-06-04 19:24:17 +00:00
}.should raise_error(Webrat::TimeoutError)
2009-06-04 03:06:07 +00:00
end
2009-06-04 17:18:31 +00:00
2009-06-04 03:06:07 +00:00
it "should throw timeout instead of webrat error" do
2009-06-04 19:24:17 +00:00
lambda {
2009-06-05 18:50:39 +00:00
@selenium.wait_for(:timeout => 0.0001) do
2009-06-03 23:49:32 +00:00
raise Webrat::WebratError.new
end
2009-06-04 19:24:17 +00:00
}.should raise_error(Webrat::TimeoutError)
2009-06-03 23:49:32 +00:00
end
2009-06-04 17:18:31 +00:00
2009-06-03 23:49:32 +00:00
end