mirror of
https://github.com/teampoltergeist/poltergeist.git
synced 2022-11-09 12:05:00 -05:00
parent
0f36ef1896
commit
2cf9bf28a8
5 changed files with 12 additions and 2 deletions
|
@ -209,6 +209,9 @@ makes debugging easier). Running `rake autocompile` will watch the
|
|||
* Fixed problem with cookies not being clearer between tests on
|
||||
PhantomJS 1.7
|
||||
|
||||
* Fixed Javascript errors during page load causes TimeoutErrors.
|
||||
[Issue #124]
|
||||
|
||||
### 0.7.0 ###
|
||||
|
||||
#### Features ####
|
||||
|
|
|
@ -35,7 +35,7 @@ class Poltergeist.Browser
|
|||
|
||||
if errors.length > 0
|
||||
@page.clearErrors()
|
||||
throw new Poltergeist.JavascriptError(errors)
|
||||
@owner.sendError(new Poltergeist.JavascriptError(errors))
|
||||
else
|
||||
@owner.sendResponse(response)
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ Poltergeist.Browser = (function() {
|
|||
errors = this.page.errors();
|
||||
if (errors.length > 0) {
|
||||
this.page.clearErrors();
|
||||
throw new Poltergeist.JavascriptError(errors);
|
||||
return this.owner.sendError(new Poltergeist.JavascriptError(errors));
|
||||
} else {
|
||||
return this.owner.sendResponse(response);
|
||||
}
|
||||
|
|
|
@ -206,6 +206,10 @@ module Capybara::Poltergeist
|
|||
@driver.evaluate_script("1+1").should == 2
|
||||
end
|
||||
|
||||
it 'propagates a Javascript error during page load to a ruby exception' do
|
||||
expect { @driver.visit "/poltergeist/js_error" }.to raise_error(JavascriptError)
|
||||
end
|
||||
|
||||
it "doesn't propagate a Javascript error to ruby if error raising disabled" do
|
||||
driver = Capybara::Poltergeist::Driver.new(nil, :js_errors => false)
|
||||
driver.execute_script "setTimeout(function() { omg }, 0)"
|
||||
|
|
3
spec/support/views/js_error.erb
Normal file
3
spec/support/views/js_error.erb
Normal file
|
@ -0,0 +1,3 @@
|
|||
<script type="text/javascript">
|
||||
foo
|
||||
</script>
|
Loading…
Add table
Reference in a new issue