appium_lib_core 4.4.0 → 4.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36bc11abad71f0b61f3902570054786eb70d8d0135584828e84ddfa25dc81b4a
4
- data.tar.gz: da818427f4f45e73f2ae90f2dacc2fc35379995dd39786756204f8c0cd5fedad
3
+ metadata.gz: cd9841189c6fd82a969e7e71fb682ab89952888f2c1f86ade149a891e086d86b
4
+ data.tar.gz: c141b11f623b538908954d40b7e6d29f3950c283e39a19abd4b97c492a16d6b1
5
5
  SHA512:
6
- metadata.gz: 560ff8bddf417b69da3640a1aa6a4c31e808bce4a7a3bf98f7e27f0095cab87281cc7749390a195af20d1567b09e158a3ccb8621bf7c957d04232223a8437f0d
7
- data.tar.gz: e8320e4b60b28b997540f45702864a3637d5be30fdd414f3f19d4400ecc4e71d2169f70cfe5c06d0bf22f9817a5e43853d599522e42a09e9ffb96e9768f53e43
6
+ metadata.gz: 9c6c662fff6e5a7209cfa7a049754414efb024df990fd537f6863fc87757221d9d6277473d8272f1ea45e6e858da4a8424aa1aed4a08ceddb0191076b6783dd5
7
+ data.tar.gz: b4ae83319f0aa62be5de53bda6b2a9374bb4a13a17fa432ee816cb388e1a6ec79b3122011ae28b1b240a09563fec903dba6e868e407a88fa8326c5e08af8a923
data/CHANGELOG.md CHANGED
@@ -10,8 +10,23 @@ Read `release_notes.md` for commit level details.
10
10
 
11
11
  ### Deprecations
12
12
 
13
+ ## [4.7.0] - 2021-07-17
13
14
 
14
- ## [4.4.0] - 2021-02-13
15
+ ### Enhancements
16
+ - Add `satellites` option in `Appium::Core::Base::Driver#set_location`
17
+
18
+ ## [4.6.0] - 2021-06-03
19
+
20
+ ### Enhancements
21
+ - Add `Appium::Core::Base::Driver#add_command` to allow you to add your own command
22
+
23
+ ## [4.5.0] - 2021-03-14
24
+
25
+ ### Enhancements
26
+ - Add `speed` argument for `Appium::Core::Base::Driver#set_location` since Appium 1.21.0
27
+ - Add `multiple` and `match_neighbour_threshold` arguments for `Appium::Core::Base::Driver#find_image_occurrence`
28
+
29
+ ## [4.4.1(4.4.0)] - 2021-02-15(2021-02-13)
15
30
 
16
31
  ### Enhancements
17
32
  - Returns `{}` any errors in `Core#appium_server_version` to prevent errors in some cases
data/README.md CHANGED
@@ -11,6 +11,7 @@ This library wraps [selenium-webdriver](https://github.com/SeleniumHQ/selenium/w
11
11
  # Documentation
12
12
 
13
13
  - http://www.rubydoc.info/github/appium/ruby_lib_core
14
+ - You can find working API examples in test code, [test/functional](test/functional)
14
15
 
15
16
  # Related library
16
17
  - https://github.com/appium/ruby_lib
@@ -120,7 +121,7 @@ $ IGNORE_VERSION_SKIP=true CI=true bundle exec rake test:func:android
120
121
  $ ruby test.rb
121
122
  ```
122
123
 
123
- More examples are in [test/functional](test/functional)
124
+ More examples are in [test/functional](test/functional)
124
125
 
125
126
  ### Capabilities
126
127
 
data/Rakefile CHANGED
@@ -38,6 +38,7 @@ namespace :test do
38
38
  namespace :unit do
39
39
  desc('Run all iOS related unit tests in test directory')
40
40
  Rake::TestTask.new(:ios) do |t|
41
+ ENV['UNIT_TEST'] = '1'
41
42
  t.libs << 'test'
42
43
  t.libs << 'lib'
43
44
  t.test_files = FileList['test/unit/ios/**/*_test.rb']
@@ -45,6 +46,7 @@ namespace :test do
45
46
 
46
47
  desc('Run all Android related unit tests in test directory')
47
48
  Rake::TestTask.new(:android) do |t|
49
+ ENV['UNIT_TEST'] = '1'
48
50
  t.libs << 'test'
49
51
  t.libs << 'lib'
50
52
  t.test_files = FileList['test/unit/android/**/*_test.rb']
@@ -52,6 +54,7 @@ namespace :test do
52
54
 
53
55
  desc('Run all common related unit tests in test directory')
54
56
  Rake::TestTask.new(:common) do |t|
57
+ ENV['UNIT_TEST'] = '1'
55
58
  t.libs << 'test'
56
59
  t.libs << 'lib'
57
60
  t.test_files = FileList['test/unit/common/**/*_test.rb']
@@ -59,6 +62,7 @@ namespace :test do
59
62
 
60
63
  desc('Run all Windows related unit tests in test directory')
61
64
  Rake::TestTask.new(:windows) do |t|
65
+ ENV['UNIT_TEST'] = '1'
62
66
  t.libs << 'test'
63
67
  t.libs << 'lib'
64
68
  t.test_files = FileList['test/unit/windows/**/*_test.rb']
@@ -30,8 +30,8 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency 'yard', '~> 0.9.11'
31
31
  spec.add_development_dependency 'minitest', '~> 5.0'
32
32
  spec.add_development_dependency 'minitest-reporters', '~> 1.1'
33
- spec.add_development_dependency 'webmock', '~> 3.11.0'
34
- spec.add_development_dependency 'rubocop', '1.8.1'
33
+ spec.add_development_dependency 'webmock', '~> 3.13.0'
34
+ spec.add_development_dependency 'rubocop', '1.12.0'
35
35
  spec.add_development_dependency 'appium_thor', '~> 1.0'
36
36
  spec.add_development_dependency 'pry'
37
37
  spec.add_development_dependency 'pry-byebug'
@@ -1,8 +1,8 @@
1
1
  steps:
2
2
  - task: NodeTool@0
3
3
  inputs:
4
- versionSpec: 10.x
5
- displayName: Install Node 10.x
4
+ versionSpec: 12.x
5
+ displayName: Install Node 12.x
6
6
  - script: npm install -g appium@${APPIUM_VERSION}
7
7
  displayName: Install appium beta
8
8
  - script: npm install -g mjpeg-consumer
@@ -4,7 +4,7 @@ parameters:
4
4
  vmImageForIOS: 'macOS-10.15' # Not sure the reason, but macOS 10.14 instance raises no info.plist error
5
5
  xcodeForIOS: 12.2
6
6
  xcodeForTVOS: 12.2
7
- androidSDK: 30
7
+ androidSDK: 29 # API Level 30 emulators are more unstable than 29
8
8
  appiumVersion: 'beta'
9
9
  ignoreVersionSkip: true
10
10
  CI: true
@@ -33,8 +33,24 @@ module Appium
33
33
  include Device::TouchActions
34
34
  include Device::ExecuteDriver
35
35
 
36
+ attr_reader :available_commands
37
+
38
+ def initialize(capabilities, session_id, **opts)
39
+ @available_commands = ::Appium::Core::Commands::MJSONWP::COMMANDS.dup
40
+ super(capabilities, session_id, **opts)
41
+ end
42
+
36
43
  def commands(command)
37
- ::Appium::Core::Commands::MJSONWP::COMMANDS[command]
44
+ @available_commands[command]
45
+ end
46
+
47
+ # command for Appium 2.0.
48
+ def add_command(method:, url:, name:, &block)
49
+ raise ::Appium::Core::Error::ArgumentError, "#{name} is already defined" if @available_commands.key? name
50
+
51
+ @available_commands[name] = [method, url]
52
+
53
+ ::Appium::Core::Device.add_endpoint_method name, &block
38
54
  end
39
55
 
40
56
  # Returns all available sessions on the Appium server instance
@@ -78,6 +94,13 @@ module Appium
78
94
  def convert_to_element(id)
79
95
  ::Selenium::WebDriver::Element.new self, element_id_from(id)
80
96
  end
97
+
98
+ def set_location(lat, lon, alt = 0.0, speed: nil, satellites: nil)
99
+ loc = { latitude: lat, longitude: lon, altitude: alt }
100
+ loc[:speed] = speed unless speed.nil?
101
+ loc[:satellites] = satellites unless satellites.nil?
102
+ execute :set_location, {}, { location: loc }
103
+ end
81
104
  end # class MJSONWP
82
105
  end # class Bridge
83
106
  end # class Base
@@ -34,8 +34,24 @@ module Appium
34
34
  include Device::ExecuteDriver
35
35
  include Device::Orientation
36
36
 
37
+ attr_reader :available_commands
38
+
39
+ def initialize(capabilities, session_id, **opts)
40
+ @available_commands = ::Appium::Core::Commands::W3C::COMMANDS.dup
41
+ super(capabilities, session_id, **opts)
42
+ end
43
+
37
44
  def commands(command)
38
- ::Appium::Core::Commands::W3C::COMMANDS[command]
45
+ @available_commands[command]
46
+ end
47
+
48
+ # command for Appium 2.0.
49
+ def add_command(method:, url:, name:, &block)
50
+ raise ::Appium::Core::Error::ArgumentError, "#{name} is already defined" if @available_commands.key? name
51
+
52
+ @available_commands[name] = [method, url]
53
+
54
+ ::Appium::Core::Device.add_endpoint_method name, &block
39
55
  end
40
56
 
41
57
  # Returns all available sessions on the Appium server instance
@@ -170,18 +186,10 @@ module Appium
170
186
 
171
187
  # For Appium
172
188
  # No implementation for W3C webdriver module
173
- # called in +extend DriverExtensions::HasLocation+
174
- # It has below code as well. We should consider the same context in Selenium 4 as backward compatibility.
175
- #
176
- # def location=(loc)
177
- # # note: Location = Struct.new(:latitude, :longitude, :altitude)
178
- # raise TypeError, "expected #{Location}, got #{loc.inspect}:#{loc.class}" unless loc.is_a?(Location)
179
- #
180
- # @bridge.set_location loc.latitude, loc.longitude, loc.altitude
181
- # end
182
- #
183
- def set_location(lat, lon, alt = 0.0)
189
+ def set_location(lat, lon, alt = 0.0, speed: nil, satellites: nil)
184
190
  loc = { latitude: lat, longitude: lon, altitude: alt }
191
+ loc[:speed] = speed unless speed.nil?
192
+ loc[:satellites] = satellites unless satellites.nil?
185
193
  execute :set_location, {}, { location: loc }
186
194
  end
187
195
 
@@ -17,6 +17,7 @@ require_relative 'search_context'
17
17
  require_relative 'screenshot'
18
18
  require_relative 'rotable'
19
19
  require_relative 'remote_status'
20
+ require_relative 'has_location'
20
21
 
21
22
  module Appium
22
23
  module Core
@@ -26,11 +27,14 @@ module Appium
26
27
  include ::Selenium::WebDriver::DriverExtensions::HasSessionId
27
28
  include ::Selenium::WebDriver::DriverExtensions::HasRemoteStatus
28
29
  include ::Selenium::WebDriver::DriverExtensions::HasWebStorage
30
+ include ::Selenium::WebDriver::DriverExtensions::HasNetworkConnection
31
+ include ::Selenium::WebDriver::DriverExtensions::HasTouchScreen
29
32
 
30
33
  include ::Appium::Core::Base::Rotatable
31
34
  include ::Appium::Core::Base::SearchContext
32
35
  include ::Appium::Core::Base::TakesScreenshot
33
36
  include ::Appium::Core::Base::HasRemoteStatus
37
+ include ::Appium::Core::Base::HasLocation
34
38
 
35
39
  # Private API.
36
40
  # Do not use this for general use. Used by flutter driver to get bridge for creating a new element
@@ -39,16 +43,6 @@ module Appium
39
43
  def initialize(opts = {})
40
44
  listener = opts.delete(:listener)
41
45
  @bridge = ::Appium::Core::Base::Bridge.handshake(**opts)
42
- if @bridge.dialect == :oss # MJSONWP
43
- extend ::Selenium::WebDriver::DriverExtensions::HasTouchScreen
44
- extend ::Selenium::WebDriver::DriverExtensions::HasLocation
45
- extend ::Selenium::WebDriver::DriverExtensions::HasNetworkConnection
46
- elsif @bridge.dialect == :w3c
47
- # TODO: Only for Appium. Ideally, we'd like to remove the below like selenium-webdriver
48
- extend ::Selenium::WebDriver::DriverExtensions::HasTouchScreen
49
- extend ::Selenium::WebDriver::DriverExtensions::HasLocation
50
- extend ::Selenium::WebDriver::DriverExtensions::HasNetworkConnection
51
- end
52
46
  super(@bridge, listener: listener)
53
47
  end
54
48
 
@@ -71,7 +65,7 @@ module Appium
71
65
  #
72
66
  def update_sending_request_to(protocol:, host:, port:, path:)
73
67
  unless @bridge.http&.class&.method_defined? :update_sending_request_to
74
- ::Appium::Logger.fatal "#{@bridge.http&.class} has no 'update_sending_request_to'. " \
68
+ ::Appium::Logger.warn "#{@bridge.http&.class} has no 'update_sending_request_to'. " \
75
69
  'It keeps current connection target.'
76
70
  return
77
71
  end
@@ -82,6 +76,85 @@ module Appium
82
76
  path: path)
83
77
  end
84
78
 
79
+ AVAILABLE_METHODS = [
80
+ :get, :head, :post, :put, :delete,
81
+ :connect, :options, :trace, :patch
82
+ ].freeze
83
+ # Define a new custom method to the driver so that you can define your own method for
84
+ # drivers/plugins in Appium 2.0. Appium 2.0 and its custom drivers/plugins allow you
85
+ # to define custom commands that are not part of W3C spec.
86
+ #
87
+ # @param [Symbol] method HTTP request method as https://www.w3.org/TR/webdriver/#endpoints
88
+ # @param [string] url The url to URL template as https://www.w3.org/TR/webdriver/#endpoints.
89
+ # +:session_id+ is the placeholder of 'session id'.
90
+ # Other place holders can be specified with +:+ prefix like +:id+.
91
+ # Then, the +:id+ will be replaced with a given value as the seconds argument of +execute+
92
+ # @param [Symbol] name The name of method that is called as the driver instance method.
93
+ # @param [Proc] block The block to involve as the method.
94
+ # Please define a method that has the same +name+ with arguments you want.
95
+ # The method must has +execute+ method. tHe +execute+ is calls the +url+
96
+ # with the given parameters.
97
+ # The first argument should be +name+ as symbol.
98
+ # The second argument should be hash. If keys in the hash matches +:+ prefix
99
+ # string in the given url, the matched string in the given url will be
100
+ # values in the hash.
101
+ # The third argument should be hash. The hash will be the request body.
102
+ # Please read examples below for more details.
103
+ # @raise [ArgumentError] If the given +name+ is already defined or +method+ are invalid value.
104
+ #
105
+ # @example
106
+ #
107
+ # @driver.add_command(
108
+ # method: :get,
109
+ # url: 'session/:session_id/path/to/custom/url',
110
+ # name: :test_command
111
+ # )
112
+ # # Send a GET request to 'session/<session id>/path/to/custom/url'
113
+ # @driver.test_command
114
+ #
115
+ #
116
+ # @driver.add_command(
117
+ # method: :post,
118
+ # url: 'session/:session_id/path/to/custom/url',
119
+ # name: :test_command
120
+ # ) do
121
+ # def test_command(argument)
122
+ # execute(:test_command, {}, { dummy: argument })
123
+ # end
124
+ # end
125
+ # # Send a POST request to 'session/<session id>/path/to/custom/url'
126
+ # # with body "{ dummy: 1 }" as JSON object. "1" is the argument.
127
+ # # ':session_id' in the given 'url' is replaced with current 'session id'.
128
+ # @driver.test_command(1)
129
+ #
130
+ #
131
+ # @driver.add_command(
132
+ # method: :post,
133
+ # url: 'session/:session_id/element/:id/custom/action',
134
+ # name: :test_action_command
135
+ # ) do
136
+ # def test_action_command(element_id, action)
137
+ # execute(:test_action_command, {id: element_id}, { dummy_action: action })
138
+ # end
139
+ # end
140
+ # # Send a POST request to 'session/<session id>/element/<element id>/custom/action'
141
+ # # with body "{ dummy_action: #{action} }" as JSON object. "action" is the seconds argument.
142
+ # # ':session_id' in the given url is replaced with current 'session id'.
143
+ # # ':id' in the given url is replaced with the given 'element_id'.
144
+ # e = @driver.find_element :accessibility_id, 'an element'
145
+ # @driver.test_action_command(e.ref, 'action')
146
+ #
147
+ def add_command(method:, url:, name:, &block)
148
+ unless AVAILABLE_METHODS.include? method
149
+ raise ::Appium::Core::Error::ArgumentError, "Available method is either #{AVAILABLE_METHODS}"
150
+ end
151
+
152
+ # TODO: Remove this logger
153
+ ::Appium::Logger.info '[Experimental] this method is experimental for Appium 2.0. This interface may change.'
154
+
155
+ @bridge.add_command method: method, url: url, name: name, &block
156
+ end
157
+
85
158
  ### Methods for Appium
86
159
 
87
160
  # Lock the device
@@ -170,10 +243,24 @@ module Appium
170
243
  @bridge = bridge
171
244
  end
172
245
 
246
+ # Get appium Settings for current test session.
247
+ #
248
+ # @example
249
+ #
250
+ # @driver.settings.get
251
+ #
173
252
  def get
174
253
  @bridge.get_settings
175
254
  end
176
255
 
256
+ # Update Appium Settings for current test session
257
+ #
258
+ # @param [Hash] settings Settings to update, keys are settings, values to value to set each setting to
259
+ #
260
+ # @example
261
+ #
262
+ # @driver.settings.update({'allowInvisibleElements': true})
263
+ #
177
264
  def update(settings)
178
265
  @bridge.update_settings(settings)
179
266
  end
@@ -210,8 +297,8 @@ module Appium
210
297
  #
211
298
  # @example
212
299
  #
213
- # @driver.update_settings('allowInvisibleElements': true)
214
- # @driver.settings.update('allowInvisibleElements': true)
300
+ # @driver.update_settings({ 'allowInvisibleElements': true })
301
+ # @driver.settings.update({ 'allowInvisibleElements': true })
215
302
  # @driver.settings = { 'allowInvisibleElements': true }
216
303
  #
217
304
  def settings=(value)
@@ -1006,11 +1093,14 @@ module Appium
1006
1093
  visualize: visualize)
1007
1094
  end
1008
1095
 
1009
- def find_image_occurrence(full_image:, partial_image:, visualize: false, threshold: nil)
1096
+ def find_image_occurrence(full_image:, partial_image:, visualize: false, threshold: nil,
1097
+ multiple: nil, match_neighbour_threshold: nil)
1010
1098
  @bridge.find_image_occurrence(full_image: full_image,
1011
1099
  partial_image: partial_image,
1012
1100
  visualize: visualize,
1013
- threshold: threshold)
1101
+ threshold: threshold,
1102
+ multiple: multiple,
1103
+ match_neighbour_threshold: match_neighbour_threshold)
1014
1104
  end
1015
1105
 
1016
1106
  def get_images_similarity(first_image:, second_image:, visualize: false)
@@ -0,0 +1,80 @@
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
+ class Base
18
+ #
19
+ # @api private
20
+ #
21
+ module HasLocation
22
+ # Get the location of the device.
23
+ #
24
+ # @return [::Selenium::WebDriver::Location]
25
+ #
26
+ # @example
27
+ #
28
+ # driver.location #=> ::Selenium::WebDriver::Location.new(10, 10, 10)
29
+ #
30
+ def location
31
+ @bridge.location
32
+ end
33
+
34
+ # Set the location of the device.
35
+ #
36
+ # @param [::Selenium::WebDriver::Location] location Set the location.
37
+ #
38
+ # @example
39
+ #
40
+ # driver.location = ::Selenium::WebDriver::Location.new(10, 10, 10)
41
+ #
42
+ def location=(location)
43
+ unless location.is_a?(::Selenium::WebDriver::Location)
44
+ raise TypeError, "expected #{::Selenium::WebDriver::Location}, got #{location.inspect}:#{location.class}"
45
+ end
46
+
47
+ @bridge.set_location location.latitude, location.longitude, location.altitude
48
+ end
49
+
50
+ # Set the location of the device.
51
+ #
52
+ # @param [String, Number] latitude Set the latitude.
53
+ # @param [String, Number] longitude Set the longitude.
54
+ # @param [String, Number] altitude Set the altitude.
55
+ # @param [String, Number] speed Set the speed to apply the location on Android real devices
56
+ # in meters/second @since Appium 1.21.0 and in knots for emulators @since Appium 1.22.0.
57
+ # @param [String, Number] satellites Sets the number of geo satellites being tracked @since Appium 1.22.0.
58
+ # This number is respected on Emulators.
59
+ # @param [::Selenium::WebDriver::Location]
60
+ #
61
+ # @example
62
+ #
63
+ # driver.location = ::Selenium::WebDriver::Location.new(10, 10, 10)
64
+ #
65
+ def set_location(latitude, longitude, altitude, speed: nil, satellites: nil)
66
+ if speed.nil? && satellites.nil?
67
+ self.location = ::Selenium::WebDriver::Location.new(Float(latitude), Float(longitude), Float(altitude))
68
+ else
69
+ loc = ::Selenium::WebDriver::Location.new(Float(latitude), Float(longitude), Float(altitude))
70
+
71
+ speed = Float(speed) unless speed.nil?
72
+ satellites = Integer(satellites) unless satellites.nil?
73
+
74
+ @bridge.set_location loc.latitude, loc.longitude, loc.altitude, speed: speed, satellites: satellites
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
@@ -95,6 +95,11 @@ module Appium
95
95
  # @param [Bool] visualize Makes the endpoint to return an image, which contains the visualized result of
96
96
  # the corresponding picture matching operation. This option is disabled by default.
97
97
  # @param [Float, nil] threshold [0.5] At what normalized threshold to reject
98
+ # @param [bool, nil] multiple Whether to enable the support of multiple image occurrences @since Appium 1.21.0.
99
+ # @param [integer, nil] match_neighbour_threshold The pixel distance between matches we consider to be part of
100
+ # the same template match @since Appium 1.21.0.
101
+ # This option is only considered if multiple matches mode is enabled.
102
+ # 10 pixels by default.
98
103
  #
99
104
  # @example
100
105
  # @driver.find_image_occurrence full_image: "image data 1", partial_image: "image data 2"
@@ -102,12 +107,15 @@ module Appium
102
107
  # visual = @@driver.find_image_occurrence full_image: image1, partial_image: image2, visualize: true
103
108
  # File.write 'find_result_visual.png', Base64.decode64(visual['visualization']) # if the image is PNG
104
109
  #
105
- def find_image_occurrence(full_image:, partial_image:, visualize: false, threshold: nil)
110
+ def find_image_occurrence(full_image:, partial_image:, visualize: false, threshold: nil,
111
+ multiple: nil, match_neighbour_threshold: nil)
106
112
  raise "visualize should be #{MATCH_TEMPLATE[:visualize]}" unless MATCH_TEMPLATE[:visualize].member?(visualize)
107
113
 
108
114
  options = {}
109
115
  options[:visualize] = visualize
110
116
  options[:threshold] = threshold unless threshold.nil?
117
+ options[:multiple] = multiple unless multiple.nil?
118
+ options[:matchNeighbourThreshold] = match_neighbour_threshold unless match_neighbour_threshold.nil?
111
119
 
112
120
  compare_images(mode: :matchTemplate, first_image: full_image, second_image: partial_image, options: options)
113
121
  end
@@ -27,8 +27,11 @@ module Appium
27
27
 
28
28
  class UnsupportedOperationError < CoreError; end
29
29
 
30
- # Server side error
30
+ # Server side errors
31
31
  class ServerError < CoreError; end
32
+
33
+ # ruby_lib_core library specific errors
34
+ class ArgumentError < CoreError; end
32
35
  end
33
36
  end
34
37
  end
@@ -460,7 +460,9 @@ module Appium
460
460
  # @core.appium_server_version #=> {}
461
461
  #
462
462
  def appium_server_version
463
- @driver&.remote_status
463
+ return {} if @driver.nil?
464
+
465
+ @driver.remote_status
464
466
  rescue StandardError
465
467
  # Ignore error case in a case the target appium server
466
468
  # does not support `/status` API.
@@ -14,7 +14,7 @@
14
14
 
15
15
  module Appium
16
16
  module Core
17
- VERSION = '4.4.0' unless defined? ::Appium::Core::VERSION
18
- DATE = '2021-02-13' unless defined? ::Appium::Core::DATE
17
+ VERSION = '4.7.0' unless defined? ::Appium::Core::VERSION
18
+ DATE = '2021-07-17' unless defined? ::Appium::Core::DATE
19
19
  end
20
20
  end
data/release_notes.md CHANGED
@@ -1,3 +1,40 @@
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
+
1
38
  #### v4.4.0 2021-02-13
2
39
 
3
40
  - [06c68fb](https://github.com/appium/ruby_lib_core/commit/06c68fbe3ffdbb7b068d2f71ad6841c66dbabf8f) Release 4.4.0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appium_lib_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.0
4
+ version: 4.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuaki MATSUO
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-14 00:00:00.000000000 Z
11
+ date: 2021-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -120,28 +120,28 @@ dependencies:
120
120
  requirements:
121
121
  - - "~>"
122
122
  - !ruby/object:Gem::Version
123
- version: 3.11.0
123
+ version: 3.13.0
124
124
  type: :development
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
- version: 3.11.0
130
+ version: 3.13.0
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: rubocop
133
133
  requirement: !ruby/object:Gem::Requirement
134
134
  requirements:
135
135
  - - '='
136
136
  - !ruby/object:Gem::Version
137
- version: 1.8.1
137
+ version: 1.12.0
138
138
  type: :development
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - '='
143
143
  - !ruby/object:Gem::Version
144
- version: 1.8.1
144
+ version: 1.12.0
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: appium_thor
147
147
  requirement: !ruby/object:Gem::Requirement
@@ -267,6 +267,7 @@ files:
267
267
  - lib/appium_lib_core/common/base/capabilities.rb
268
268
  - lib/appium_lib_core/common/base/command.rb
269
269
  - lib/appium_lib_core/common/base/driver.rb
270
+ - lib/appium_lib_core/common/base/has_location.rb
270
271
  - lib/appium_lib_core/common/base/http_default.rb
271
272
  - lib/appium_lib_core/common/base/platform.rb
272
273
  - lib/appium_lib_core/common/base/remote_status.rb
@@ -333,7 +334,7 @@ homepage: https://github.com/appium/ruby_lib_core/
333
334
  licenses:
334
335
  - Apache-2.0
335
336
  metadata: {}
336
- post_install_message:
337
+ post_install_message:
337
338
  rdoc_options: []
338
339
  require_paths:
339
340
  - lib
@@ -348,8 +349,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
348
349
  - !ruby/object:Gem::Version
349
350
  version: '0'
350
351
  requirements: []
351
- rubygems_version: 3.1.2
352
- signing_key:
352
+ rubygems_version: 3.2.15
353
+ signing_key:
353
354
  specification_version: 4
354
355
  summary: Minimal Ruby library for Appium.
355
356
  test_files: []