Add deprecation warnings to legacy window methods

* Capybara 2.3 provides a new window API.
This commit is contained in:
Matthew Horan 2014-07-09 21:32:35 -04:00 committed by Matthew Horan
parent e49886d668
commit 99f4a88f2f
2 changed files with 12 additions and 2 deletions

View File

@ -126,13 +126,21 @@ module Capybara::Webkit
JSON.parse(command('GetWindowHandles'))
end
alias_method :window_handles, :get_window_handles
def window_handles
warn '[DEPRECATION] Capybara::Webkit::Browser#window_handles ' \
'is deprecated. Please use Capybara::Session#windows instead.'
get_window_handles
end
def get_window_handle
command('GetWindowHandle')
end
alias_method :window_handle, :get_window_handle
def window_handle
warn '[DEPRECATION] Capybara::Webkit::Browser#window_handle ' \
'is deprecated. Please use Capybara::Session#current_window instead.'
get_window_handle
end
def accept_confirm(options)
command("SetConfirmAction", "Yes", options[:text])

View File

@ -97,6 +97,8 @@ module Capybara::Webkit
end
def resize_window(width, height)
warn '[DEPRECATION] Capybara::Webkit::Driver#resize_window ' \
'is deprecated. Please use Capybara::Window#resize_to instead.'
resize_window_to(current_window_handle, width, height)
end