mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Navigate to about:blank to reset page instead of empty file
closes #1035 closes #1214 closes #1203 closes #1198 closes #1215 Since it does not work with remote drivers, and somehow screws up on Windows.
This commit is contained in:
parent
f18637bf90
commit
03ec8486c6
4 changed files with 3 additions and 20 deletions
|
@ -14,8 +14,6 @@ module Capybara
|
|||
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
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
<!doctype>
|
||||
<html>
|
||||
<!-- an empty HTML document, used for resetting the page content -->
|
||||
</html>
|
|
@ -97,9 +97,7 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
|
|||
# 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
|
||||
|
||||
|
|
|
@ -16,17 +16,8 @@ Capybara::SpecHelper.spec '#reset_session!' do
|
|||
@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
|
||||
|
||||
|
|
Loading…
Reference in a new issue