Permalink
Browse files

Selenium resets session more thoroughly between tests

  • Loading branch information...
1 parent 7a9b784 commit 0062f7f432763388ecc8d26079fb710008b6088e @jnicklas jnicklas committed Apr 7, 2011
Showing with 7 additions and 3 deletions.
  1. +4 −1 lib/capybara/driver/selenium_driver.rb
  2. +2 −1 lib/capybara/session.rb
  3. +1 −1 lib/capybara/spec/session.rb
@@ -163,7 +163,10 @@ def evaluate_script(script)
def reset!
# Use instance variable directly so we avoid starting the browser just to reset the session
- @browser.manage.delete_all_cookies if @browser
+ if @browser
+ @browser.manage.delete_all_cookies
+ @browser.navigate.to('about:blank')
+ end
end
def within_frame(frame_id)
View
@@ -113,7 +113,8 @@ def source
# @return [String] Path of the current page, without any domain information
#
def current_path
- URI.parse(current_url).path
+ path = URI.parse(current_url).path
+ path if path and not path.empty?
end
##
@@ -75,7 +75,7 @@ def extract_results(session)
@session.current_path.should == '/with_html'
@session.reset!
- @session.current_path.should == ""
+ @session.current_path.should be_nil
end
it "resets page body" do

0 comments on commit 0062f7f

Please sign in to comment.