appium_lib_core 4.1.0 → 7.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +286 -271
  3. data/README.md +65 -15
  4. data/Rakefile +5 -22
  5. data/appium_lib_core.gemspec +5 -8
  6. data/bin/console +0 -4
  7. data/lib/appium_lib_core/android/device/auth_finger_print.rb +4 -1
  8. data/lib/appium_lib_core/android/device/network.rb +10 -0
  9. data/lib/appium_lib_core/android/device/performance.rb +3 -0
  10. data/lib/appium_lib_core/android/device/screen.rb +2 -0
  11. data/lib/appium_lib_core/android/device.rb +82 -4
  12. data/lib/appium_lib_core/common/base/bridge.rb +321 -90
  13. data/lib/appium_lib_core/common/base/capabilities.rb +8 -9
  14. data/lib/appium_lib_core/common/base/device_ime.rb +49 -0
  15. data/lib/appium_lib_core/common/base/driver.rb +272 -192
  16. data/lib/appium_lib_core/common/base/driver_settings.rb +51 -0
  17. data/lib/appium_lib_core/common/base/has_location.rb +80 -0
  18. data/lib/appium_lib_core/common/base/has_network_connection.rb +56 -0
  19. data/lib/appium_lib_core/common/base/http_default.rb +15 -38
  20. data/lib/appium_lib_core/{ios/uiautomation/bridge.rb → common/base/remote_status.rb} +9 -8
  21. data/lib/appium_lib_core/common/base/rotable.rb +62 -0
  22. data/lib/appium_lib_core/common/base/screenshot.rb +8 -8
  23. data/lib/appium_lib_core/common/base/search_context.rb +20 -6
  24. data/lib/appium_lib_core/common/base.rb +1 -3
  25. data/lib/appium_lib_core/common/command.rb +260 -4
  26. data/lib/appium_lib_core/common/device/app_management.rb +8 -14
  27. data/lib/appium_lib_core/common/device/context.rb +1 -1
  28. data/lib/appium_lib_core/common/device/image_comparison.rb +12 -4
  29. data/lib/appium_lib_core/common/device/keyevent.rb +4 -4
  30. data/lib/appium_lib_core/common/{command/mjsonwp.rb → device/orientation.rb} +14 -11
  31. data/lib/appium_lib_core/common/device/touch_actions.rb +2 -0
  32. data/lib/appium_lib_core/common/device/value.rb +6 -8
  33. data/lib/appium_lib_core/common/error.rb +4 -5
  34. data/lib/appium_lib_core/common/log.rb +4 -1
  35. data/lib/appium_lib_core/common/touch_action/multi_touch.rb +19 -0
  36. data/lib/appium_lib_core/common/touch_action/touch_actions.rb +16 -2
  37. data/lib/appium_lib_core/common/wait.rb +38 -6
  38. data/lib/appium_lib_core/device.rb +1 -5
  39. data/lib/appium_lib_core/driver.rb +182 -148
  40. data/lib/appium_lib_core/{patch.rb → element.rb} +75 -9
  41. data/lib/appium_lib_core/ios/xcuitest/device.rb +2 -0
  42. data/lib/appium_lib_core/{common/base/command.rb → mac2/bridge.rb} +9 -8
  43. data/lib/appium_lib_core/mac2/device/screen.rb +48 -0
  44. data/lib/appium_lib_core/mac2/device.rb +92 -0
  45. data/lib/appium_lib_core/{ios.rb → mac2.rb} +2 -5
  46. data/lib/appium_lib_core/support/event_firing_bridge.rb +57 -0
  47. data/lib/appium_lib_core/version.rb +2 -2
  48. data/lib/appium_lib_core/windows/device/app_management.rb +38 -0
  49. data/lib/appium_lib_core/windows/device.rb +2 -0
  50. data/lib/appium_lib_core.rb +21 -10
  51. metadata +31 -86
  52. data/.github/ISSUE_TEMPLATE/issue-report.md +0 -29
  53. data/.github/contributing.md +0 -26
  54. data/.github/issue_template.md +0 -20
  55. data/.github/workflows/unittest.yml +0 -68
  56. data/.gitignore +0 -18
  57. data/.rubocop.yml +0 -58
  58. data/azure-pipelines.yml +0 -15
  59. data/ci-jobs/functional/android_setup.yml +0 -3
  60. data/ci-jobs/functional/ios_setup.yml +0 -7
  61. data/ci-jobs/functional/publish_test_result.yml +0 -18
  62. data/ci-jobs/functional/run_appium.yml +0 -25
  63. data/ci-jobs/functional/start-emulator.sh +0 -26
  64. data/ci-jobs/functional_test.yml +0 -298
  65. data/docs/mobile_command.md +0 -34
  66. data/lib/appium_lib_core/common/base/bridge/mjsonwp.rb +0 -81
  67. data/lib/appium_lib_core/common/base/bridge/w3c.rb +0 -252
  68. data/lib/appium_lib_core/common/command/common.rb +0 -110
  69. data/lib/appium_lib_core/common/command/w3c.rb +0 -56
  70. data/lib/appium_lib_core/ios/uiautomation/device.rb +0 -44
  71. data/lib/appium_lib_core/ios/uiautomation/patch.rb +0 -34
  72. data/release_notes.md +0 -816
  73. data/script/commands.rb +0 -200
@@ -12,14 +12,22 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- # rubocop:disable Style/ClassAndModuleChildren
16
15
  module Appium
17
16
  module Core
18
17
  # Implement useful features for element.
19
18
  # Patch for Selenium Webdriver.
20
- class Selenium::WebDriver::Element
21
- # To extend Appium related SearchContext into ::Selenium::WebDriver::Element
19
+ class Element < ::Selenium::WebDriver::Element
22
20
  include ::Appium::Core::Base::SearchContext
21
+ include ::Appium::Core::Base::TakesScreenshot
22
+
23
+ # Retuns the element id.
24
+ #
25
+ # @return [String]
26
+ # @example
27
+ # e = @driver.find_element :accessibility_id, 'something'
28
+ # e.id
29
+ #
30
+ attr_reader :id
23
31
 
24
32
  # Returns the value of attributes like below. Read each platform to know more details.
25
33
  #
@@ -56,24 +64,33 @@ module Appium
56
64
  # Alias for type
57
65
  alias type send_keys
58
66
 
67
+ # @deprecated Use element send_keys instead.
59
68
  # Set the value to element directly
60
69
  #
61
70
  # @example
62
71
  #
63
- # @driver.immediate_value 'hello'
72
+ # element.immediate_value 'hello'
64
73
  #
65
74
  def immediate_value(*value)
66
- @bridge.set_immediate_value(self, *value)
75
+ ::Appium::Logger.warn(
76
+ '[DEPRECATION] element.immediate_value is deprecated. Please use element.send_keys instead.'
77
+ )
78
+ @bridge.set_immediate_value @id, *value
67
79
  end
68
80
 
81
+ # @deprecated Use element send_keys or 'mobile: replaceElementValue' for UIAutomator2 instead.
69
82
  # Replace the value to element directly
70
83
  #
71
84
  # @example
72
85
  #
73
- # @driver.replace_value 'hello'
86
+ # element.replace_value 'hello'
74
87
  #
75
88
  def replace_value(*value)
76
- @bridge.replace_value(self, *value)
89
+ ::Appium::Logger.warn(
90
+ '[DEPRECATION] element.replace_value is deprecated. Please use element.send_keys instead, ' \
91
+ 'or "mobile: replaceElementValue" for UIAutomator2.'
92
+ )
93
+ @bridge.replace_value @id, *value
77
94
  end
78
95
 
79
96
  # For use with location_rel.
@@ -99,7 +116,56 @@ module Appium
99
116
  w = driver.window_size
100
117
  ::Selenium::WebDriver::Point.new "#{center_x} / #{w.width.to_f}", "#{center_y} / #{w.height.to_f}"
101
118
  end
102
- end
119
+
120
+ # Return an element screenshot as base64
121
+ #
122
+ # @return String Base 64 encoded string
123
+ #
124
+ # @example
125
+ #
126
+ # element.screenshot #=> "iVBORw0KGgoAAAANSUhEUgAABDgAAAB+CAIAAABOPDa6AAAAAX"
127
+ #
128
+ def screenshot
129
+ bridge.element_screenshot @id
130
+ end
131
+
132
+ # Return an element screenshot in the given format
133
+ #
134
+ # @param [:base64, :png] format
135
+ # @return String screenshot
136
+ #
137
+ # @example
138
+ #
139
+ # element.screenshot_as :base64 #=> "iVBORw0KGgoAAAANSUhEUgAABDgAAAB+CAIAAABOPDa6AAAAAX"
140
+ #
141
+ def screenshot_as(format)
142
+ case format
143
+ when :base64
144
+ bridge.element_screenshot @id
145
+ when :png
146
+ bridge.element_screenshot(@id).unpack('m')[0]
147
+ else
148
+ raise Core::Error::UnsupportedOperationError, "unsupported format: #{format.inspect}"
149
+ end
150
+ end
151
+
152
+ # Save an element screenshot to the given path
153
+ #
154
+ # @param [String] png_path A path to save the screenshot
155
+ # @return [File] Path to the element screenshot.
156
+ #
157
+ # @example
158
+ #
159
+ # element.save_screenshot("fine_name.png")
160
+ #
161
+ def save_screenshot(png_path)
162
+ extension = File.extname(png_path).downcase
163
+ if extension != '.png'
164
+ ::Appium::Logger.warn 'name used for saved screenshot does not match file type. ' \
165
+ 'It should end with .png extension'
166
+ end
167
+ File.open(png_path, 'wb') { |f| f << screenshot_as(:png) }
168
+ end
169
+ end # class Element
103
170
  end # module Core
104
171
  end # module Appium
105
- # rubocop:enable Style/ClassAndModuleChildren
@@ -25,6 +25,7 @@ module Appium
25
25
 
26
26
  # rubocop:disable Layout/LineLength
27
27
 
28
+ # @deprecated Use 'mobile: hideKeyboard' extension instead.
28
29
  # @!method hide_keyboard(close_key = nil, strategy = nil)
29
30
  # Hide the onscreen keyboard
30
31
  # @param [String] close_key The name of the key which closes the keyboard.
@@ -38,6 +39,7 @@ module Appium
38
39
  # @driver.hide_keyboard('Finished') # Close a keyboard with the 'Finished' button
39
40
  #
40
41
 
42
+ # @deprecated Use 'mobile: backgroundApp' extension instead.
41
43
  # @!method background_app(duration = 0)
42
44
  # Backgrounds the app for a set number of seconds.
43
45
  # This is a blocking application.
@@ -14,11 +14,12 @@
14
14
 
15
15
  module Appium
16
16
  module Core
17
- class Base
18
- module Commands
19
- OSS = ::Selenium::WebDriver::Remote::OSS::Bridge::COMMANDS.freeze
20
- W3C = ::Selenium::WebDriver::Remote::W3C::Bridge::COMMANDS.freeze
21
- end # module Commands
22
- end # module Base
23
- end # module Core
24
- end # module Appium
17
+ module Mac2
18
+ module Bridge
19
+ def self.for(target)
20
+ target.extend Appium::Core::Mac2::Device
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Appium
16
+ module Core
17
+ module Mac2
18
+ module Device
19
+ module Screen
20
+ def self.add_methods
21
+ ::Appium::Core::Device.add_endpoint_method(:start_recording_screen) do
22
+ def start_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT',
23
+ file_field_name: nil, form_fields: nil, headers: nil, force_restart: nil,
24
+ fps: nil, preset: nil, video_filter: nil, time_limit: nil,
25
+ enable_capture_clicks: nil, enable_cursor_capture: nil, device_id: nil)
26
+ option = ::Appium::Core::Base::Device::ScreenRecord.new(
27
+ remote_path: remote_path, user: user, pass: pass, method: method,
28
+ file_field_name: file_field_name, form_fields: form_fields, headers: headers,
29
+ force_restart: force_restart
30
+ ).upload_option
31
+
32
+ option[:fps] = fps unless fps.nil?
33
+ option[:preset] = preset unless preset.nil?
34
+ option[:videoFilter] = video_filter unless video_filter.nil?
35
+ option[:captureClicks] = enable_capture_clicks unless enable_capture_clicks.nil?
36
+ option[:captureCursor] = enable_cursor_capture unless enable_cursor_capture.nil?
37
+ option[:deviceId] = device_id unless device_id.nil?
38
+ option[:timeLimit] = time_limit unless time_limit.nil?
39
+
40
+ execute(:start_recording_screen, {}, { options: option })
41
+ end
42
+ end
43
+ end
44
+ end # module Screen
45
+ end # module Device
46
+ end # module Mac2
47
+ end # module Core
48
+ end # module Appium
@@ -0,0 +1,92 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require_relative 'device/screen'
16
+
17
+ module Appium
18
+ module Core
19
+ module Mac2
20
+ module Device
21
+ extend Forwardable
22
+
23
+ # rubocop:disable Layout/LineLength
24
+
25
+ # @since Appium 1.20.0
26
+ # @!method start_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT', file_field_name: nil, form_fields: nil, headers: nil, force_restart: nil, fps: nil, preset: nil, video_filter: nil, enable_capture_clicks: nil, enable_cursor_capture: nil, device_id: nil)
27
+ #
28
+ # Record the display of devices running iOS Simulator since Xcode 9 or real devices since iOS 11
29
+ # (ffmpeg utility is required: 'brew install ffmpeg').
30
+ # We would recommend to play the video by VLC or Mplayer if you can not play the video with other video players.
31
+ #
32
+ # @param [String] remote_path The path to the remote location, where the resulting video should be uploaded.
33
+ # The following protocols are supported: http/https, ftp.
34
+ # Null or empty string value (the default setting) means the content of resulting
35
+ # file should be encoded as Base64 and passed as the endpount response value.
36
+ # An exception will be thrown if the generated media file is too big to
37
+ # fit into the available process memory.
38
+ # This option only has an effect if there is screen recording process in progreess
39
+ # and +forceRestart+ parameter is not set to +true+.
40
+ # @param [String] user The name of the user for the remote authentication.
41
+ # @param [String] pass The password for the remote authentication.
42
+ # @param [String] method The http multipart upload method name. The 'PUT' one is used by default.
43
+ # @param [String] file_field_name The name of the form field containing the binary payload in multipart/form-data
44
+ # requests since Appium 1.18.0. Defaults to 'file'.
45
+ # @param [Array<Hash, Array<String>>] form_fields The form fields mapping in multipart/form-data requests since Appium 1.18.0.
46
+ # If any entry has the same key in this mapping, then it is going to be ignored.
47
+ # @param [Hash] headers The additional headers in multipart/form-data requests since Appium 1.18.0.
48
+ # @param [Boolean] force_restart Whether to try to catch and upload/return the currently running screen recording
49
+ # (+false+, the default setting on server) or ignore the result of it
50
+ # and start a new recording immediately (+true+).
51
+ # @param [integer] fps The count of frames per second in the resulting video.
52
+ # Increasing fps value also increases the size of the resulting video file and the CPU usage.
53
+ # The default value is 15.
54
+ # @param [String] preset A preset is a collection of options that will provide a certain encoding speed to compression ratio.
55
+ # A slower preset will provide better compression (compression is quality per filesize).
56
+ # This means that, for example, if you target a certain file size or constant bit rate, you will
57
+ # achieve better quality with a slower preset. Read https://trac.ffmpeg.org/wiki/Encode/H.264
58
+ # for more details.
59
+ # @param [Boolean] enable_cursor_capture Whether to capture the click gestures while recording the screen. Disabled by default.
60
+ # @param [Boolean] enable_capture_clicks Recording time. 180 seconds is by default.
61
+ # @param [String] video_filter The video filter spec to apply for ffmpeg.
62
+ # See https://trac.ffmpeg.org/wiki/FilteringGuide for more details on the possible values.
63
+ # Example: Set it to +scale=ifnot(gte(iw\,1024)\,iw\,1024):-2+ in order to limit the video width
64
+ # to 1024px. The height will be adjusted automatically to match the actual screen aspect ratio.
65
+ # @param [integer] device_id Screen device index to use for the recording.
66
+ # The list of available devices could be retrieved using
67
+ # +ffmpeg -f avfoundation -list_devices true -i ""+ command.
68
+ # This option is mandatory and must be always provided.
69
+ # @param [String] time_limit The maximum recording time. The default value is 600 seconds (10 minutes).
70
+ # The minimum time resolution unit is one second.
71
+ #
72
+ # @example
73
+ #
74
+ # @driver.start_recording_screen
75
+ # @driver.start_recording_screen fps: 30, enable_cursor_capture: true
76
+ #
77
+
78
+ # rubocop:enable Layout/LineLength
79
+
80
+ ####
81
+ ## class << self
82
+ ####
83
+
84
+ class << self
85
+ def extended(_mod)
86
+ Screen.add_methods
87
+ end
88
+ end # class << self
89
+ end # module Device
90
+ end # module Mac2
91
+ end # module Core
92
+ end # module Appium
@@ -13,8 +13,5 @@
13
13
  # limitations under the License.
14
14
 
15
15
  # loaded in common/driver.rb
16
- require_relative 'ios/device'
17
-
18
- require_relative 'ios/uiautomation/patch'
19
- require_relative 'ios/uiautomation/device'
20
- require_relative 'ios/uiautomation/bridge'
16
+ require_relative 'mac2/device'
17
+ require_relative 'mac2/bridge'
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Appium
16
+ module Support
17
+ class EventFiringBridge < ::Selenium::WebDriver::Support::EventFiringBridge
18
+ # This module inherits ::Selenium::WebDriver::Support::EventFiringBridge
19
+ # to provide customer listener availability.
20
+ # https://github.com/SeleniumHQ/selenium/blob/trunk/rb/lib/selenium/webdriver/support/event_firing_bridge.rb#L79
21
+
22
+ def initialize(delegate, listener, **opts)
23
+ @appium_options = opts
24
+ super delegate, listener
25
+ end
26
+
27
+ def find_element_by(how, what, parent = nil)
28
+ e = dispatch(:find, how, what, driver) do
29
+ @delegate.find_element_by how, what, parent
30
+ end
31
+
32
+ ::Appium::Core::Element.new self, e.ref.last
33
+ end
34
+
35
+ def find_elements_by(how, what, parent = nil)
36
+ es = dispatch(:find, how, what, driver) do
37
+ @delegate.find_elements_by(how, what, parent)
38
+ end
39
+
40
+ es.map { |e| ::Appium::Core::Element.new self, e.ref.last }
41
+ end
42
+
43
+ private
44
+
45
+ def create_element(ref)
46
+ ::Appium::Core::Element.new @delegate, ref
47
+ end
48
+
49
+ def driver
50
+ # To not gives the listener
51
+ @appium_options.delete(:listener)
52
+
53
+ @driver ||= ::Appium::Core::Base::Driver.new(bridge: self, listener: nil, **@appium_options)
54
+ end
55
+ end
56
+ end
57
+ end
@@ -14,7 +14,7 @@
14
14
 
15
15
  module Appium
16
16
  module Core
17
- VERSION = '4.1.0' unless defined? ::Appium::Core::VERSION
18
- DATE = '2020-12-25' unless defined? ::Appium::Core::DATE
17
+ VERSION = '7.4.0' unless defined? ::Appium::Core::VERSION
18
+ DATE = '2024-01-23' unless defined? ::Appium::Core::DATE
19
19
  end
20
20
  end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Appium
16
+ module Core
17
+ module Windows
18
+ module Device
19
+ module AppManagement
20
+ # override
21
+ def self.add_methods
22
+ ::Appium::Core::Device.add_endpoint_method(:launch_app) do
23
+ def launch_app
24
+ execute :launch_app
25
+ end
26
+ end
27
+
28
+ ::Appium::Core::Device.add_endpoint_method(:close_app) do
29
+ def close_app
30
+ execute :close_app
31
+ end
32
+ end
33
+ end
34
+ end # module AppManagement
35
+ end # module Device
36
+ end # module Windows
37
+ end # module Core
38
+ end # module Appium
@@ -13,6 +13,7 @@
13
13
  # limitations under the License.
14
14
 
15
15
  require_relative 'device/screen'
16
+ require_relative 'device/app_management'
16
17
 
17
18
  module Appium
18
19
  module Core
@@ -78,6 +79,7 @@ module Appium
78
79
  class << self
79
80
  def extended(_mod)
80
81
  Screen.add_methods
82
+ AppManagement.add_methods
81
83
  end
82
84
  end # class << self
83
85
  end # module Device
@@ -17,23 +17,30 @@ require 'selenium-webdriver'
17
17
  require_relative 'appium_lib_core/version'
18
18
  require_relative 'appium_lib_core/common'
19
19
  require_relative 'appium_lib_core/driver'
20
-
21
20
  require_relative 'appium_lib_core/device'
22
-
23
- # Call patch after requiring other files
24
- require_relative 'appium_lib_core/patch'
21
+ require_relative 'appium_lib_core/element'
22
+ require_relative 'appium_lib_core/support/event_firing_bridge'
25
23
 
26
24
  module Appium
27
- # convert all keys (including nested) to symbols
25
+ # @private
26
+ #
27
+ # convert the top level keys to symbols.
28
28
  #
29
- # based on deep_symbolize_keys & deep_transform_keys from rails
30
- # https://github.com/rails/docrails/blob/a3b1105ada3da64acfa3843b164b14b734456a50/activesupport/lib/active_support/core_ext/hash/keys.rb#L84
31
29
  # @param [Hash] hash Hash value to make symbolise
32
- def self.symbolize_keys(hash)
33
- raise ArgumentError, 'symbolize_keys requires a hash' unless hash.is_a? Hash
30
+ def self.symbolize_keys(hash, nested: false, enable_deprecation_msg: true)
31
+ # FIXME: As https://github.com/appium/ruby_lib/issues/945, we must remove this implicit string to symbol.
32
+ # But appium_lib_core's some capability handling expect to be symbol, so we should test to remove
33
+ # the mehotds which expect the symbol first.
34
+ raise ::Appium::Core::Error::ArgumentError, 'symbolize_keys requires a hash' unless hash.is_a? Hash
34
35
 
35
36
  hash.each_with_object({}) do |pair, acc|
36
37
  key = begin
38
+ if enable_deprecation_msg && !(pair[0].is_a? Symbol)
39
+ ::Appium::Logger.warn("[Deprecation] The key '#{pair[0]}' must be a symbol while currently it " \
40
+ "is #{pair[0].class.name}. Please define the key as a Symbol. " \
41
+ 'Converting it to Symbol for now.')
42
+ end
43
+
37
44
  pair[0].to_sym
38
45
  rescue StandardError => e
39
46
  ::Appium::Logger.warn(e.message)
@@ -41,7 +48,11 @@ module Appium
41
48
  end
42
49
 
43
50
  value = pair[1]
44
- acc[key] = value.is_a?(Hash) ? symbolize_keys(value) : value
51
+ acc[key] = if nested
52
+ value.is_a?(Hash) ? symbolize_keys(value, nested: false, enable_deprecation_msg: false) : value
53
+ else
54
+ value
55
+ end
45
56
  end
46
57
  end
47
58