Skip to content

Commit

Permalink
Deprecate outdated Firefox capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
p0deje committed Apr 17, 2019
1 parent 64051c8 commit 996f92f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
12 changes: 7 additions & 5 deletions rb/lib/selenium/webdriver/remote/capabilities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,6 @@ def json_create(data)
# @option :native_events [Boolean] does this driver use native events?
# @option :proxy [Selenium::WebDriver::Proxy, Hash] proxy configuration
#
# Firefox-specific options:
#
# @option :firefox_profile [Selenium::WebDriver::Firefox::Profile] the firefox profile to use
#
# @api public
#

Expand Down Expand Up @@ -242,10 +238,16 @@ def as_json(*)
when :platform
hash['platform'] = value.to_s.upcase
when :firefox_profile
hash['firefox_profile'] = value.as_json['zip'] if value
if value
WebDriver.logger.deprecate(':firefox_profile capabilitiy', 'Selenium::WebDriver::Firefox::Options#profile')
hash['firefox_profile'] = value.as_json['zip']
end
when :proxy
hash['proxy'] = value.as_json if value
when String, :firefox_binary
if key == :firefox_binary && value
WebDriver.logger.deprecate(':firefox_binary capabilitiy', 'Selenium::WebDriver::Firefox::Options#binary')
end
hash[key.to_s] = value
when Symbol
hash[camel_case(key.to_s)] = value
Expand Down
20 changes: 19 additions & 1 deletion rb/lib/selenium/webdriver/remote/w3c/capabilities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ class Capabilities
next if key == :proxy

define_method "#{key}=" do |value|
case key
when :accessibility_checks
WebDriver.logger.deprecate(":accessibility_checks capability")
when :device
WebDriver.logger.deprecate(":device capability")
end
@capabilities[key] = value
end
end
Expand Down Expand Up @@ -139,7 +145,7 @@ def json_create(data)
# @param oss_capabilities [Hash, Remote::Capabilities]
#

def from_oss(oss_capabilities)
def from_oss(oss_capabilities) # rubocop:disable Metrics/MethodLength
w3c_capabilities = new

# TODO: (alex) make capabilities enumerable?
Expand Down Expand Up @@ -167,6 +173,18 @@ def from_oss(oss_capabilities)
firefox_profile = oss_capabilities['firefox_profile'] || oss_capabilities[:firefox_profile]
firefox_binary = oss_capabilities['firefox_binary'] || oss_capabilities[:firefox_binary]

if firefox_options
WebDriver.logger.deprecate(':firefox_options capabilitiy', 'Selenium::WebDriver::Firefox::Options')
end

if firefox_profile
WebDriver.logger.deprecate(':firefox_profile capabilitiy', 'Selenium::WebDriver::Firefox::Options#profile')
end

if firefox_binary
WebDriver.logger.deprecate(':firefox_binary capabilitiy', 'Selenium::WebDriver::Firefox::Options#binary')
end

if firefox_profile && firefox_options
second_profile = firefox_options['profile'] || firefox_options[:profile]
if second_profile && firefox_profile != second_profile
Expand Down

0 comments on commit 996f92f

Please sign in to comment.