Skip to content

Commit

Permalink
Ruby: make sure the alert text is included in UnhandledAlertErrors
Browse files Browse the repository at this point in the history
  • Loading branch information
jarib committed Jun 8, 2014
1 parent 55e1308 commit dc4f5f6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rake-tasks/crazy_fun/mappings/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def handle(fun, dir, args)
ruby :include => args[:include],
:require => args[:require],
:command => args[:command],
:args => %w[--format CI::Reporter::RSpec --format s --color] + (!!ENV['example'] ? ['--example', ENV['example']] : []),
:args => %w[--format CI::Reporter::RSpec --format doc --color] + (!!ENV['example'] ? ['--example', ENV['example']] : []),
:debug => !!ENV['log'],
:files => args[:srcs]
end
Expand Down
1 change: 1 addition & 0 deletions rb/CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
2.43.0 (???)
============

* Make sure UnhandledAlertErrors includes the alert text if provided by the driver.
* Firefox
- Make sure browser process is properly killed if silent startup hangs (#7392)

Expand Down
1 change: 1 addition & 0 deletions rb/lib/selenium/webdriver/remote/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def error_message
case val
when Hash
msg = val['message'] or return "unknown error"
msg << ": #{val['alert']['text'].inspect}" if val['alert'].kind_of?(Hash) && val['alert']['text']
msg << " (#{ val['class'] })" if val['class']
when String
msg = val
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
driver.find_element(:id => "alert").click
wait_for_alert

lambda { driver.title }.should raise_error(Selenium::WebDriver::Error::UnhandledAlertError)
lambda { driver.title }.should raise_error(Selenium::WebDriver::Error::UnhandledAlertError, /: "cheese"/)

driver.title.should == "Testing Alerts" # :chrome does not auto-dismiss the alert
end
Expand Down

0 comments on commit dc4f5f6

Please sign in to comment.