Skip to content

Commit

Permalink
Navigate to about:blank to reset page instead of empty file
Browse files Browse the repository at this point in the history
closes teamcapybara#1035
closes teamcapybara#1214
closes teamcapybara#1203
closes teamcapybara#1198
closes teamcapybara#1215

Since it does not work with remote drivers, and somehow screws up on Windows.
  • Loading branch information
jnicklas committed Jan 6, 2014
1 parent f18637b commit 03ec848
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 20 deletions.
2 changes: 0 additions & 2 deletions lib/capybara.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ class UnselectNotAllowed < CapybaraError; end
class NotSupportedByDriverError < CapybaraError; end
class InfiniteRedirectError < CapybaraError; end

EMPTY_HTML_FILE_PATH = File.expand_path('./capybara/empty.html', File.dirname(__FILE__))

class << self
attr_accessor :asset_host, :app_host, :run_server, :default_host, :always_include_port
attr_accessor :server_port, :exact, :match, :exact_options, :visible_text_only
Expand Down
4 changes: 0 additions & 4 deletions lib/capybara/empty.html

This file was deleted.

4 changes: 1 addition & 3 deletions lib/capybara/selenium/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ def reset!
# to about:blank, so we rescue this error and do nothing
# instead.
end
uri = URI(Capybara::EMPTY_HTML_FILE_PATH)
uri.scheme = "file"
@browser.navigate.to(uri.to_s)
@browser.navigate.to("about:blank")
end
end

Expand Down
13 changes: 2 additions & 11 deletions lib/capybara/spec/session/reset_session_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,8 @@
@session.current_path.should == '/foo'

@session.reset_session!
[
->(v) { v == nil },
->(v) { v == '' },
->(v) { v == 'about:blank' },
->(v) { v.end_with? Capybara::EMPTY_HTML_FILE_PATH } # allow file:// protocol
].any? { |p| p.(@session.current_url) }.should be_true
[
->(v) { v == '' },
->(v) { v == nil },
->(v) { v == Capybara::EMPTY_HTML_FILE_PATH }
].any? { |p| p.(@session.current_path) }.should be_true
[nil, '', 'about:blank'].should include(@session.current_url)
['', nil].should include(@session.current_path)
@session.current_host.should be_nil
end

Expand Down

0 comments on commit 03ec848

Please sign in to comment.