appium_lib_core 4.1.0 → 5.0.0.rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +8 -0
  3. data/.github/workflows/unittest.yml +2 -2
  4. data/CHANGELOG.md +51 -277
  5. data/README.md +2 -1
  6. data/Rakefile +4 -0
  7. data/appium_lib_core.gemspec +4 -4
  8. data/ci-jobs/functional/run_appium.yml +2 -2
  9. data/ci-jobs/functional_test.yml +2 -2
  10. data/docs/mobile_command.md +3 -2
  11. data/lib/appium_lib_core/android/device/auth_finger_print.rb +2 -1
  12. data/lib/appium_lib_core/android/device.rb +4 -4
  13. data/lib/appium_lib_core/common/base/bridge.rb +300 -89
  14. data/lib/appium_lib_core/common/base/capabilities.rb +10 -3
  15. data/lib/appium_lib_core/common/base/device_ime.rb +49 -0
  16. data/lib/appium_lib_core/common/base/driver.rb +150 -112
  17. data/lib/appium_lib_core/common/base/driver_settings.rb +51 -0
  18. data/lib/appium_lib_core/common/base/has_location.rb +80 -0
  19. data/lib/appium_lib_core/common/base/has_network_connection.rb +56 -0
  20. data/lib/appium_lib_core/common/base/http_default.rb +1 -3
  21. data/lib/appium_lib_core/common/base/remote_status.rb +31 -0
  22. data/lib/appium_lib_core/common/base/rotable.rb +54 -0
  23. data/lib/appium_lib_core/common/base/screenshot.rb +5 -4
  24. data/lib/appium_lib_core/common/base/search_context.rb +11 -4
  25. data/lib/appium_lib_core/common/base.rb +1 -3
  26. data/lib/appium_lib_core/common/command.rb +259 -4
  27. data/lib/appium_lib_core/common/device/image_comparison.rb +12 -4
  28. data/lib/appium_lib_core/common/device/keyevent.rb +4 -4
  29. data/lib/appium_lib_core/common/{command/mjsonwp.rb → device/orientation.rb} +14 -11
  30. data/lib/appium_lib_core/common/device/value.rb +4 -4
  31. data/lib/appium_lib_core/common/error.rb +4 -1
  32. data/lib/appium_lib_core/common/log.rb +4 -1
  33. data/lib/appium_lib_core/common/touch_action/touch_actions.rb +4 -1
  34. data/lib/appium_lib_core/device.rb +1 -5
  35. data/lib/appium_lib_core/driver.rb +23 -27
  36. data/lib/appium_lib_core/{patch.rb → element.rb} +57 -9
  37. data/lib/appium_lib_core/ios/uiautomation/patch.rb +1 -1
  38. data/lib/appium_lib_core/{common/base/command.rb → mac2/bridge.rb} +9 -8
  39. data/lib/appium_lib_core/mac2/device/screen.rb +48 -0
  40. data/lib/appium_lib_core/mac2/device.rb +92 -0
  41. data/lib/appium_lib_core/mac2.rb +17 -0
  42. data/lib/appium_lib_core/version.rb +2 -2
  43. data/lib/appium_lib_core.rb +2 -5
  44. data/release_notes.md +82 -0
  45. data/script/commands.rb +3 -37
  46. metadata +30 -30
  47. data/lib/appium_lib_core/common/base/bridge/mjsonwp.rb +0 -81
  48. data/lib/appium_lib_core/common/base/bridge/w3c.rb +0 -252
  49. data/lib/appium_lib_core/common/command/common.rb +0 -110
  50. data/lib/appium_lib_core/common/command/w3c.rb +0 -56
@@ -27,6 +27,8 @@ module Appium
27
27
  autoload :Xcuitest, 'appium_lib_core/ios_xcuitest'
28
28
  end
29
29
 
30
+ autoload :Mac2, 'appium_lib_core/mac2'
31
+
30
32
  autoload :Windows, 'appium_lib_core/windows'
31
33
 
32
34
  # This options affects only client side as <code>:appium_lib</code> key.<br>
@@ -45,7 +47,7 @@ module Appium
45
47
  @export_session = appium_lib_opts.fetch :export_session, false
46
48
  @export_session_path = appium_lib_opts.fetch :export_session_path, default_tmp_appium_lib_session
47
49
 
48
- @direct_connect = appium_lib_opts.fetch :direct_connect, false
50
+ @direct_connect = appium_lib_opts.fetch :direct_connect, true
49
51
 
50
52
  @port = appium_lib_opts.fetch :port, Driver::DEFAULT_APPIUM_PORT
51
53
 
@@ -175,7 +177,7 @@ module Appium
175
177
  # - <code>directConnectPort</code>
176
178
  # - <code>directConnectPath</code>
177
179
  #
178
- # Ignore them if this parameter is <code>false</code>. Defaults to false.
180
+ # Ignore them if this parameter is <code>false</code>. Defaults to true.
179
181
  #
180
182
  # @return [Bool]
181
183
  attr_reader :direct_connect
@@ -185,8 +187,6 @@ module Appium
185
187
  # @option opts [Hash] :caps Appium capabilities.
186
188
  # @option opts [Hash] :capabilities The same as :caps.
187
189
  # This param is for compatibility with Selenium WebDriver format
188
- # @option opts [Hash] :desired_capabilities The same as :caps.
189
- # This param is for compatibility with Selenium WebDriver format
190
190
  # @option opts [Appium::Core::Options] :appium_lib Capabilities affect only ruby client
191
191
  # @option opts [String] :url The same as :custom_url in :appium_lib.
192
192
  # This param is for compatibility with Selenium WebDriver format
@@ -197,10 +197,8 @@ module Appium
197
197
  #
198
198
  # # format 1
199
199
  # @core = Appium::Core.for caps: {...}, appium_lib: {...}
200
- # # format 2. 'capabilities:' or 'desired_capabilities:' is also available instead of 'caps:'.
200
+ # # format 2. 'capabilities:' is also available instead of 'caps:'.
201
201
  # @core = Appium::Core.for url: "http://127.0.0.1:8080/wd/hub", capabilities: {...}, appium_lib: {...}
202
- # # format 3. 'appium_lib: {...}' can be blank
203
- # @core = Appium::Core.for url: "http://127.0.0.1:8080/wd/hub", desired_capabilities: {...}
204
202
  #
205
203
  #
206
204
  # require 'rubygems'
@@ -228,7 +226,7 @@ module Appium
228
226
  # @core.start_driver # Connect to 'http://127.0.0.1:8080/wd/hub' because of 'port: 8080'
229
227
  #
230
228
  # # Start iOS driver with .zip file over HTTP
231
- # # 'desired_capabilities:' or 'capabilities:' is also available instead of 'caps:'. Either is fine.
229
+ # # 'capabilities:' is also available instead of 'caps:'. Either is fine.
232
230
  # opts = {
233
231
  # capabilities: {
234
232
  # platformName: :ios,
@@ -252,7 +250,7 @@ module Appium
252
250
  # # Start iOS driver as another format. 'url' is available like below
253
251
  # opts = {
254
252
  # url: "http://custom-host:8080/wd/hub.com",
255
- # desired_capabilities: {
253
+ # capabilities: {
256
254
  # platformName: :ios,
257
255
  # platformVersion: '11.0',
258
256
  # deviceName: 'iPhone Simulator',
@@ -365,11 +363,10 @@ module Appium
365
363
  end
366
364
 
367
365
  begin
368
- # included https://github.com/SeleniumHQ/selenium/blob/43f8b3f66e7e01124eff6a5805269ee441f65707/rb/lib/selenium/webdriver/remote/driver.rb#L29
369
- @driver = ::Appium::Core::Base::Driver.new(http_client: @http_client,
370
- desired_capabilities: @caps,
371
- url: @custom_url,
372
- listener: @listener)
366
+ @driver = ::Appium::Core::Base::Driver.new(listener: @listener,
367
+ http_client: @http_client,
368
+ capabilities: @caps, # ::Selenium::WebDriver::Remote::Capabilities
369
+ url: @custom_url)
373
370
 
374
371
  if @direct_connect
375
372
  d_c = DirectConnections.new(@driver.capabilities)
@@ -435,7 +432,8 @@ module Appium
435
432
  nil
436
433
  end
437
434
 
438
- # Returns the server's version info
435
+ # Returns the server's version info. This method calls +driver.remote_status+ internally
436
+ #
439
437
  # @return [Hash]
440
438
  #
441
439
  # @example
@@ -449,18 +447,20 @@ module Appium
449
447
  # }
450
448
  # }
451
449
  #
452
- # Returns blank hash for Selenium Grid since 'remote_status' gets 500 error
450
+ # Returns blank hash in a case +driver.remote_status+ got an error
451
+ # such as Selenium Grid. It returns 500 error against 'remote_status'.
453
452
  #
454
453
  # @example
455
454
  #
456
455
  # @core.appium_server_version #=> {}
457
456
  #
458
457
  def appium_server_version
459
- @driver.remote_status
460
- rescue Selenium::WebDriver::Error::ServerError => e
461
- raise ::Appium::Core::Error::ServerError unless e.message.include?('status code 500')
458
+ return {} if @driver.nil?
462
459
 
463
- # driver.remote_status returns 500 error for using selenium grid
460
+ @driver.remote_status
461
+ rescue StandardError
462
+ # Ignore error case in a case the target appium server
463
+ # does not support `/status` API.
464
464
  {}
465
465
  end
466
466
 
@@ -526,7 +526,7 @@ module Appium
526
526
  when :gecko
527
527
  ::Appium::Logger.debug('Gecko Driver for macOS')
528
528
  when :mac2
529
- ::Appium::Logger.debug('macOS XCUITest')
529
+ ::Appium::Core::Mac2::Bridge.for self
530
530
  else
531
531
  # no Mac specific extentions
532
532
  ::Appium::Logger.debug('macOS Native')
@@ -563,10 +563,7 @@ module Appium
563
563
  def validate_keys(opts)
564
564
  flatten_ops = flatten_hash_keys(opts)
565
565
 
566
- # FIXME: Remove 'desired_capabilities' in the next major Selenium update
567
- unless opts.member?(:caps) || opts.member?(:capabilities) || opts.member?(:desired_capabilities)
568
- raise Error::NoCapabilityError
569
- end
566
+ raise Error::NoCapabilityError unless opts.member?(:caps) || opts.member?(:capabilities)
570
567
 
571
568
  if !opts.member?(:appium_lib) && flatten_ops.member?(:appium_lib)
572
569
  raise Error::CapabilityStructureError, 'Please check the value of appium_lib in the capability'
@@ -587,8 +584,7 @@ module Appium
587
584
 
588
585
  # @private
589
586
  def get_caps(opts)
590
- # FIXME: Remove 'desired_capabilities' in the next major Selenium update
591
- Core::Base::Capabilities.create_capabilities(opts[:caps] || opts[:capabilities] || opts[:desired_capabilities] || {})
587
+ Core::Base::Capabilities.create_capabilities(opts[:caps] || opts[:capabilities] || {})
592
588
  end
593
589
 
594
590
  # @private
@@ -12,14 +12,13 @@
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
23
22
 
24
23
  # Returns the value of attributes like below. Read each platform to know more details.
25
24
  #
@@ -60,20 +59,20 @@ module Appium
60
59
  #
61
60
  # @example
62
61
  #
63
- # @driver.immediate_value 'hello'
62
+ # element.immediate_value 'hello'
64
63
  #
65
64
  def immediate_value(*value)
66
- @bridge.set_immediate_value(self, *value)
65
+ @bridge.set_immediate_value @id, *value
67
66
  end
68
67
 
69
68
  # Replace the value to element directly
70
69
  #
71
70
  # @example
72
71
  #
73
- # @driver.replace_value 'hello'
72
+ # element.replace_value 'hello'
74
73
  #
75
74
  def replace_value(*value)
76
- @bridge.replace_value(self, *value)
75
+ @bridge.replace_value @id, *value
77
76
  end
78
77
 
79
78
  # For use with location_rel.
@@ -99,7 +98,56 @@ module Appium
99
98
  w = driver.window_size
100
99
  ::Selenium::WebDriver::Point.new "#{center_x} / #{w.width.to_f}", "#{center_y} / #{w.height.to_f}"
101
100
  end
102
- end
101
+
102
+ # Return an element screenshot as base64
103
+ #
104
+ # @return String Base 64 encoded string
105
+ #
106
+ # @example
107
+ #
108
+ # element.screenshot #=> "iVBORw0KGgoAAAANSUhEUgAABDgAAAB+CAIAAABOPDa6AAAAAX"
109
+ #
110
+ def screenshot
111
+ bridge.element_screenshot @id
112
+ end
113
+
114
+ # Return an element screenshot in the given format
115
+ #
116
+ # @param [:base64, :png] format
117
+ # @return String screenshot
118
+ #
119
+ # @example
120
+ #
121
+ # element.screenshot_as :base64 #=> "iVBORw0KGgoAAAANSUhEUgAABDgAAAB+CAIAAABOPDa6AAAAAX"
122
+ #
123
+ def screenshot_as(format)
124
+ case format
125
+ when :base64
126
+ bridge.element_screenshot @id
127
+ when :png
128
+ bridge.element_screenshot(@id).unpack('m')[0]
129
+ else
130
+ raise Core::Error::UnsupportedOperationError, "unsupported format: #{format.inspect}"
131
+ end
132
+ end
133
+
134
+ # Save an element screenshot to the given path
135
+ #
136
+ # @param [String] png_path A path to save the screenshot
137
+ # @return [File] Path to the element screenshot.
138
+ #
139
+ # @example
140
+ #
141
+ # element.save_screenshot("fine_name.png")
142
+ #
143
+ def save_screenshot(png_path)
144
+ extension = File.extname(png_path).downcase
145
+ if extension != '.png'
146
+ ::Appium::Logger.warn 'name used for saved screenshot does not match file type. '\
147
+ 'It should end with .png extension'
148
+ end
149
+ File.open(png_path, 'wb') { |f| f << screenshot_as(:png) }
150
+ end
151
+ end # class Element
103
152
  end # module Core
104
153
  end # module Appium
105
- # rubocop:enable Style/ClassAndModuleChildren
@@ -21,7 +21,7 @@ module Appium
21
21
  # will trigger as soon as the file is required. in contrast a method
22
22
  # will trigger only when invoked.
23
23
  def self.patch_webdriver_element
24
- ::Selenium::WebDriver::Element.class_eval do
24
+ ::Appium::Core::Element.class_eval do
25
25
  # Cross platform way of entering text into a textfield
26
26
  def type(text, driver)
27
27
  driver.execute_script %(au.getElement('#{ref}').setValue('#{text}');)
@@ -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
@@ -0,0 +1,17 @@
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
+ # loaded in common/driver.rb
16
+ require_relative 'mac2/device'
17
+ require_relative 'mac2/bridge'
@@ -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 = '5.0.0.rc2' unless defined? ::Appium::Core::VERSION
18
+ DATE = '2021-10-01' unless defined? ::Appium::Core::DATE
19
19
  end
20
20
  end
@@ -17,11 +17,8 @@ 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'
25
22
 
26
23
  module Appium
27
24
  # convert all keys (including nested) to symbols
@@ -30,7 +27,7 @@ module Appium
30
27
  # https://github.com/rails/docrails/blob/a3b1105ada3da64acfa3843b164b14b734456a50/activesupport/lib/active_support/core_ext/hash/keys.rb#L84
31
28
  # @param [Hash] hash Hash value to make symbolise
32
29
  def self.symbolize_keys(hash)
33
- raise ArgumentError, 'symbolize_keys requires a hash' unless hash.is_a? Hash
30
+ raise ::Appium::Core::Error::ArgumentError, 'symbolize_keys requires a hash' unless hash.is_a? Hash
34
31
 
35
32
  hash.each_with_object({}) do |pair, acc|
36
33
  key = begin
data/release_notes.md CHANGED
@@ -1,3 +1,85 @@
1
+ #### v4.7.0 2021-07-17
2
+
3
+ - [0059974](https://github.com/appium/ruby_lib_core/commit/0059974b0b1d79a822db84d8b0169e8393e00ef9) Release 4.7.0
4
+ - [0f93a52](https://github.com/appium/ruby_lib_core/commit/0f93a52bbdc44bf916c9b974fe9fd09d48e5ff39) test: add more example and test (#328)
5
+ - [9e37b3b](https://github.com/appium/ruby_lib_core/commit/9e37b3bc15f72f7c0117a49945a3fe482598f374) feat: add satellites for Android emulators (#327)
6
+ - [3063a73](https://github.com/appium/ruby_lib_core/commit/3063a73fa291dc378daa53b7df2e4b0b8a6f03d2) ci: calls quit_driver to ensure close the previous session
7
+ - [43fb9e7](https://github.com/appium/ruby_lib_core/commit/43fb9e77f5492a92f4f8c5a5bda71be9c3a9e2c8) chore: tweak naming in an internal variable
8
+
9
+
10
+ #### v4.6.0 2021-06-03
11
+
12
+ - [0dacfab](https://github.com/appium/ruby_lib_core/commit/0dacfab1256e1447e1f7a5974dfcf48ee0a72b9d) Release 4.6.0
13
+ - [b9f015d](https://github.com/appium/ruby_lib_core/commit/b9f015d7dea14964a0733f2385ebcff68da1e18e) feat: allow to add commands dynamically (#325)
14
+ - [3de96ee](https://github.com/appium/ruby_lib_core/commit/3de96eea133ccbcbc5c4d77adc7d67c065a5a38c) chore(deps-dev): update webmock requirement from ~> 3.12.1 to ~> 3.13.0 (#324)
15
+ - [f1a9e79](https://github.com/appium/ruby_lib_core/commit/f1a9e79f3bd4d134e125fc2ed9adcf3d085afc9a) docs: address func test code as working example
16
+ - [eb85b1b](https://github.com/appium/ruby_lib_core/commit/eb85b1b26623436cb0aae95a00fef7bc2d795520) remove ; in a test
17
+ - [1632637](https://github.com/appium/ruby_lib_core/commit/1632637fd872c0b80dfb97b8514ada6a7164eebf) chore(deps-dev): update rubocop requirement from = 1.11.0 to = 1.12.0 (#321)
18
+ - [b9e47aa](https://github.com/appium/ruby_lib_core/commit/b9e47aa9b02f060ffa91e8410ab97dc87d3640a4) docs: add docstring
19
+ - [954a2fe](https://github.com/appium/ruby_lib_core/commit/954a2feebb768a55b496a2614d9e4dd8b702fc1e) chore(deps-dev): update rubocop requirement from = 1.8.1 to = 1.11.0 (#316)
20
+ - [a5b9651](https://github.com/appium/ruby_lib_core/commit/a5b9651aa349c10bd9759fedac6f09e27012a5e5) chore(deps-dev): update webmock requirement from ~> 3.11.0 to ~> 3.12.1 (#319)
21
+ - [485c096](https://github.com/appium/ruby_lib_core/commit/485c096273178aa5e21f28d93545fd127cbb8735) test: add assertion
22
+
23
+
24
+ #### v4.5.0 2021-03-14
25
+
26
+ - [656230e](https://github.com/appium/ruby_lib_core/commit/656230e688ed86414c06efaa73bce7359933cc91) Release 4.5.0
27
+ - [a0a3cfc](https://github.com/appium/ruby_lib_core/commit/a0a3cfc71783bed3d1b0e7afbf6bc0a27bf60a48) feat: add speed option (#318)
28
+ - [16b4f09](https://github.com/appium/ruby_lib_core/commit/16b4f0991deb639314857c3cbece1e4d00393646) feat: add multiple and match_neighbour_threshold (#313)
29
+ - [d195a5b](https://github.com/appium/ruby_lib_core/commit/d195a5ba48c2e1a7229e0145eac616fd886c1ee0) ci: use node 12
30
+
31
+
32
+ #### v4.4.1 2021-02-15
33
+
34
+ - [dc34419](https://github.com/appium/ruby_lib_core/commit/dc34419dfcc4dd8d499a6407d45ab3efe70c2445) Release 4.4.1
35
+ - [3085048](https://github.com/appium/ruby_lib_core/commit/3085048b4816e3415017ebb188e653c8e229a05e) chore: return {} in nil case as well
36
+
37
+
38
+ #### v4.4.0 2021-02-13
39
+
40
+ - [06c68fb](https://github.com/appium/ruby_lib_core/commit/06c68fbe3ffdbb7b068d2f71ad6841c66dbabf8f) Release 4.4.0
41
+ - [3c54ae2](https://github.com/appium/ruby_lib_core/commit/3c54ae25d9a334f3690c94ce8a59a5c6a4bacd20) feat: always return {} in appium_server_version for errors (#311)
42
+
43
+
44
+ #### v4.3.1 2021-02-07
45
+
46
+ - [1f4d52c](https://github.com/appium/ruby_lib_core/commit/1f4d52cc915783cf89cf4b8ca5a21bd1af5403e0) Release 4.3.1
47
+ - [fb41014](https://github.com/appium/ruby_lib_core/commit/fb410146567ed03902b602813881fd3abc3a3d28) chore: change log level
48
+ - [1e54662](https://github.com/appium/ruby_lib_core/commit/1e546628c871e4ed9c8aa038a455d03e4e2e6c4e) chore : Create Dependabot config file (#309)
49
+
50
+
51
+ #### v4.3.0 2021-02-05
52
+
53
+ - [6e85426](https://github.com/appium/ruby_lib_core/commit/6e85426c1ff8f3e4b90d3da5305d493500539467) Release 4.3.0
54
+ - [405b3d8](https://github.com/appium/ruby_lib_core/commit/405b3d8e627323376dbf74a4423d0ebce5ca0cad) feat: Add mac2 module and screen recording option (#308)
55
+ - [876d254](https://github.com/appium/ruby_lib_core/commit/876d25494c76c31ad5c26900d6e30e30ecd8d20c) chore: teak types in yardoc (#307)
56
+ - [7548ea9](https://github.com/appium/ruby_lib_core/commit/7548ea9cb7e031a3689a63e75d32da82d317488a) test: add wait
57
+ - [9d6fef4](https://github.com/appium/ruby_lib_core/commit/9d6fef469fad8bccf61ee6565f2e30095f4e2a6a) feat: makes direct_connect true by default (#303)
58
+ - [761067e](https://github.com/appium/ruby_lib_core/commit/761067e5c42cfb3e4c1e5c5a377dbeb3c903eb7b) test: add location test (#302)
59
+ - [bd33397](https://github.com/appium/ruby_lib_core/commit/bd3339791552d2eb5181ca4475c9ebc90644a456) chore(deps-dev): update rubocop requirement from = 1.8.0 to = 1.8.1 (#301)
60
+
61
+
62
+ #### v4.2.1 2021-01-10
63
+
64
+ - [23e944e](https://github.com/appium/ruby_lib_core/commit/23e944ed72c6ea861532f5acc1381af4441705e6) Release 4.2.1
65
+ - [1a416b1](https://github.com/appium/ruby_lib_core/commit/1a416b136beb2b9115d3eb6637b22817f0e55601) chore: move rotable for w3c (#300)
66
+ - [95821c6](https://github.com/appium/ruby_lib_core/commit/95821c6f1a4ebc785e2dc3e6e16c1705521237e8) ci: bump android app (#299)
67
+ - [4e1770e](https://github.com/appium/ruby_lib_core/commit/4e1770e3b9d6995b1d5430b9033097609edca1c8) chore(deps-dev): update rubocop requirement from = 1.7.0 to = 1.8.0 (#298)
68
+ - [b230512](https://github.com/appium/ruby_lib_core/commit/b230512c52875ea70545d3d2262c306640f87f7d) chore: fix rubocop
69
+
70
+
71
+ #### v4.2.0 2021-01-02
72
+
73
+ - [e55b2b6](https://github.com/appium/ruby_lib_core/commit/e55b2b6f7fe293091be0d3835075e66c74f3b9dd) Release 4.2.0
74
+ - [b0cd235](https://github.com/appium/ruby_lib_core/commit/b0cd235a7fb6e5a8957871650bf86962cf0e0368) feat: append screenshot in element module as well (#297)
75
+
76
+
77
+ #### v4.1.1 2020-12-25
78
+
79
+ - [3a4cf56](https://github.com/appium/ruby_lib_core/commit/3a4cf56c73a64fb10ca0b7fecc5800719838095c) Release 4.1.1
80
+ - [6b2d7dd](https://github.com/appium/ruby_lib_core/commit/6b2d7ddf027b5a9f49cbe9a7f5622eb345e2c076) fix: keyword argument in Ruby 3
81
+
82
+
1
83
  #### v4.1.0 2020-12-25
2
84
 
3
85
  - [89110a9](https://github.com/appium/ruby_lib_core/commit/89110a995b869471a134f8c45ebe8dfbaabfba63) Release 4.1.0
data/script/commands.rb CHANGED
@@ -18,26 +18,18 @@ require './lib/appium_lib_core'
18
18
  module Script
19
19
  class CommandsChecker
20
20
  attr_reader :spec_commands,
21
- :implemented_mjsonwp_commands, :implemented_w3c_commands, :implemented_core_commands,
22
- :webdriver_oss_commands, :webdriver_w3c_commands
21
+ :implemented_w3c_commands, :implemented_core_commands,
22
+ :webdriver_w3c_commands
23
23
 
24
24
  # Set commands implemented in this core library.
25
25
  #
26
- # - implemented_mjsonwp_commands: All commands include ::Selenium::WebDriver::Remote::OSS::Bridge::COMMANDS
27
- # - implemented_w3c_commands: All commands include ::Selenium::WebDriver::Remote::W3C::Bridge::COMMANDS
26
+ # - implemented_w3c_commands: All commands include ::Selenium::WebDriver::Remote::Bridge::COMMANDS
28
27
  # - implemented_core_commands: All commands except for selenium-webdriver's commands
29
- # - webdriver_oss_commands: ::Selenium::WebDriver::Remote::OSS::Bridge::COMMANDS
30
- # - webdriver_w3c_commands: ::Selenium::WebDriver::Remote::W3C::Bridge::COMMANDS
31
28
  #
32
29
  def initialize
33
30
  @spec_commands = nil
34
31
 
35
- @implemented_mjsonwp_commands = convert_driver_commands Appium::Core::Commands::MJSONWP::COMMANDS
36
- @implemented_w3c_commands = convert_driver_commands Appium::Core::Commands::W3C::COMMANDS
37
32
  @implemented_core_commands = convert_driver_commands Appium::Core::Commands::COMMANDS
38
-
39
- @webdriver_oss_commands = convert_driver_commands Appium::Core::Base::Commands::OSS
40
- @webdriver_w3c_commands = convert_driver_commands Appium::Core::Base::Commands::W3C
41
33
  end
42
34
 
43
35
  # Get the bellow url's file.
@@ -80,18 +72,6 @@ module Script
80
72
  end
81
73
  end
82
74
 
83
- # All commands which haven't been implemented in ruby core library yet.
84
- # @return [Hash]
85
- #
86
- def all_diff_commands_mjsonwp
87
- result = compare_commands(@spec_commands, @implemented_mjsonwp_commands)
88
-
89
- white_list.each { |v| result.delete v }
90
- w3c_spec.each { |v| result.delete v }
91
-
92
- result
93
- end
94
-
95
75
  # All commands which haven't been implemented in ruby core library yet.
96
76
  # @return [Hash]
97
77
  #
@@ -111,20 +91,6 @@ module Script
111
91
  result
112
92
  end
113
93
 
114
- def diff_webdriver_oss
115
- result = compare_commands(@spec_commands, @webdriver_oss_commands)
116
- white_list.each { |v| result.delete v }
117
- w3c_spec.each { |v| result.delete v }
118
- result
119
- end
120
-
121
- def diff_webdriver_w3c
122
- result = compare_commands(@spec_commands, @webdriver_w3c_commands)
123
- white_list.each { |v| result.delete v }
124
- mjsonwp_spec.each { |v| result.delete v }
125
- result
126
- end
127
-
128
94
  def compare_commands(command1, with_command2)
129
95
  return {} if command1.nil?
130
96
  return command1 if with_command2.nil?