mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Only reset session if it has been modified, closes #632
Had a hard time coming up with a sensible way of testing this, since it really shouldn't affect any behaviour at all, and is a pure performance enhancement.
This commit is contained in:
parent
cb16ef7485
commit
f3bb3baf9a
1 changed files with 6 additions and 1 deletions
|
@ -67,7 +67,8 @@ module Capybara
|
|||
# Reset the session, removing all cookies.
|
||||
#
|
||||
def reset!
|
||||
driver.reset!
|
||||
driver.reset! if @touched
|
||||
@touched = false
|
||||
end
|
||||
alias_method :cleanup!, :reset!
|
||||
alias_method :reset_session!, :reset!
|
||||
|
@ -154,6 +155,7 @@ module Capybara
|
|||
# @param [String] url The URL to navigate to
|
||||
#
|
||||
def visit(url)
|
||||
@touched = true
|
||||
driver.visit(url)
|
||||
end
|
||||
|
||||
|
@ -252,6 +254,7 @@ module Capybara
|
|||
# @param [String] script A string of JavaScript to execute
|
||||
#
|
||||
def execute_script(script)
|
||||
@touched = true
|
||||
driver.execute_script(script)
|
||||
end
|
||||
|
||||
|
@ -265,6 +268,7 @@ module Capybara
|
|||
# @return [Object] The result of the evaluated JavaScript (may be driver specific)
|
||||
#
|
||||
def evaluate_script(script)
|
||||
@touched = true
|
||||
driver.evaluate_script(script)
|
||||
end
|
||||
|
||||
|
@ -289,6 +293,7 @@ module Capybara
|
|||
NODE_METHODS.each do |method|
|
||||
class_eval <<-RUBY, __FILE__, __LINE__+1
|
||||
def #{method}(*args, &block)
|
||||
@touched = true
|
||||
current_node.send(:#{method}, *args, &block)
|
||||
end
|
||||
RUBY
|
||||
|
|
Loading…
Reference in a new issue