appium_lib_core 4.4.1 → 4.7.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e39e0b6e9261085141e53524f03e441f0c7202baa6a4f7d9d726ff96daa1bae
4
- data.tar.gz: cba4172e3dd7b898c77b59653264fc1376296f9fde3847598b37f0096bd6951d
3
+ metadata.gz: f9cb1e375d275f60b14e657c80dcbf14ec423551950d80b38ce3d7d82a966eaa
4
+ data.tar.gz: ded8a8c068b3dc7e2e0b2c41ab3a9b08ebf2c8160cbe3fc652472c6482272282
5
5
  SHA512:
6
- metadata.gz: 137e98f4b2c0d88f2855fb1fb5bd54655c36ba5be7c7d9217ab39ddbb2ebc60e0752d94e925afaef3cf6db2266c91df1a8ba716c7153ae7915a9c903aaa42ed1
7
- data.tar.gz: 9b1014d972b6c7d302fbc4633d709ec37f3e06ef1bf56c8925f84ef3ad5aed5a1145d0f91c8b00901b33b56bb3694ad5cb75c949d0b0b897fb0359c86911a90d
6
+ metadata.gz: c5b1ea8c1229aac34ae8099b8e2a525b5d8abbd2fdc53da301b65145dcf50e6acf5f74fe84b849dc798f8723c3f48ad1a733bef1556955d42119da8b963b86c5
7
+ data.tar.gz: 7bf9af9a23a325010a6c76a927cfea6c96be27285f5b1c7b1ce0d26c5518b9dd553efab63c1df458ca3a2e1d66d26ee42946ca4bd786271dcd81f19ef0730fcd
data/CHANGELOG.md CHANGED
@@ -10,6 +10,26 @@ Read `release_notes.md` for commit level details.
10
10
 
11
11
  ### Deprecations
12
12
 
13
+ ## [4.7.1] - 2021-09-26
14
+
15
+ ### Enhancements
16
+ - Allow to override an existing method by `Appium::Core::Base::Driver#add_command` since Appium drivers/plugins allow to override them
17
+
18
+ ## [4.7.0] - 2021-07-17
19
+
20
+ ### Enhancements
21
+ - Add `satellites` option in `Appium::Core::Base::Driver#set_location`
22
+
23
+ ## [4.6.0] - 2021-06-03
24
+
25
+ ### Enhancements
26
+ - Add `Appium::Core::Base::Driver#add_command` to allow you to add your own command
27
+
28
+ ## [4.5.0] - 2021-03-14
29
+
30
+ ### Enhancements
31
+ - Add `speed` argument for `Appium::Core::Base::Driver#set_location` since Appium 1.21.0
32
+ - Add `multiple` and `match_neighbour_threshold` arguments for `Appium::Core::Base::Driver#find_image_occurrence`
13
33
 
14
34
  ## [4.4.1(4.4.0)] - 2021-02-15(2021-02-13)
15
35
 
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.14.0'
34
+ spec.add_development_dependency 'rubocop', '1.12.1'
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
@@ -103,7 +103,7 @@ jobs:
103
103
  - template: ./functional/ios_setup.yml
104
104
  parameters:
105
105
  xcodeVersion: ${{ parameters.xcodeForIOS }}
106
- - script: brew install ffmpeg && brew tap wix/brew && brew install wix/brew/applesimutils
106
+ - script: brew install ffmpeg && brew tap wix/brew && brew install applesimutils
107
107
  displayName: Install ffmpeg and applesimutils
108
108
  - template: ./functional/run_appium.yml
109
109
  - script: bundle exec rake test:func:ios TESTS=test/functional/ios/ios/mjpeg_server_test.rb,test/functional/ios/ios/mobile_commands_test.rb
@@ -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
+ ::Appium::Logger.debug "Overriding the method '#{name}' for '#{url}'" 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
+ ::Appium::Logger.info "Overriding the method '#{name}' for '#{url}'" 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 +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 count of geo satellites being tracked in range 1..12 @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
@@ -14,7 +14,7 @@
14
14
 
15
15
  module Appium
16
16
  module Core
17
- VERSION = '4.4.1' unless defined? ::Appium::Core::VERSION
18
- DATE = '2021-02-15' unless defined? ::Appium::Core::DATE
17
+ VERSION = '4.7.1' unless defined? ::Appium::Core::VERSION
18
+ DATE = '2021-09-26' unless defined? ::Appium::Core::DATE
19
19
  end
20
20
  end
data/release_notes.md CHANGED
@@ -1,3 +1,44 @@
1
+ #### v4.7.1 2021-09-26
2
+
3
+ - [cdd8906](https://github.com/appium/ruby_lib_core/commit/cdd890662585aa5051912d20d90ec3c3866ad8b1) Release 4.7.1
4
+ - [059b092](https://github.com/appium/ruby_lib_core/commit/059b0920becd60d691b0b4fac05cc0d96bcc59c7) ci: tweak brew install
5
+ - [fb32697](https://github.com/appium/ruby_lib_core/commit/fb32697d5ee7cf4ea4367aa9f9bf4458723d6fce) feat: allow to override an existing method by add_command (#330)
6
+ - [cbf7f1f](https://github.com/appium/ruby_lib_core/commit/cbf7f1fc2ce6bb8833e2a7324446d79cbc848834) chore(deps-dev): update webmock requirement from ~> 3.13.0 to ~> 3.14.0 (#329)
7
+ - [beefb17](https://github.com/appium/ruby_lib_core/commit/beefb179ac25e9337bf2badaf4eb0c4cfc5b1e45) chore(deps-dev): update rubocop requirement from = 1.12.0 to = 1.12.1 (#322)
8
+ - [3438b48](https://github.com/appium/ruby_lib_core/commit/3438b481523ec978d06bc243cd42eee8dc00356f) docs: tweak docstring
9
+
10
+
11
+ #### v4.7.0 2021-07-17
12
+
13
+ - [0059974](https://github.com/appium/ruby_lib_core/commit/0059974b0b1d79a822db84d8b0169e8393e00ef9) Release 4.7.0
14
+ - [0f93a52](https://github.com/appium/ruby_lib_core/commit/0f93a52bbdc44bf916c9b974fe9fd09d48e5ff39) test: add more example and test (#328)
15
+ - [9e37b3b](https://github.com/appium/ruby_lib_core/commit/9e37b3bc15f72f7c0117a49945a3fe482598f374) feat: add satellites for Android emulators (#327)
16
+ - [3063a73](https://github.com/appium/ruby_lib_core/commit/3063a73fa291dc378daa53b7df2e4b0b8a6f03d2) ci: calls quit_driver to ensure close the previous session
17
+ - [43fb9e7](https://github.com/appium/ruby_lib_core/commit/43fb9e77f5492a92f4f8c5a5bda71be9c3a9e2c8) chore: tweak naming in an internal variable
18
+
19
+
20
+ #### v4.6.0 2021-06-03
21
+
22
+ - [0dacfab](https://github.com/appium/ruby_lib_core/commit/0dacfab1256e1447e1f7a5974dfcf48ee0a72b9d) Release 4.6.0
23
+ - [b9f015d](https://github.com/appium/ruby_lib_core/commit/b9f015d7dea14964a0733f2385ebcff68da1e18e) feat: allow to add commands dynamically (#325)
24
+ - [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)
25
+ - [f1a9e79](https://github.com/appium/ruby_lib_core/commit/f1a9e79f3bd4d134e125fc2ed9adcf3d085afc9a) docs: address func test code as working example
26
+ - [eb85b1b](https://github.com/appium/ruby_lib_core/commit/eb85b1b26623436cb0aae95a00fef7bc2d795520) remove ; in a test
27
+ - [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)
28
+ - [b9e47aa](https://github.com/appium/ruby_lib_core/commit/b9e47aa9b02f060ffa91e8410ab97dc87d3640a4) docs: add docstring
29
+ - [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)
30
+ - [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)
31
+ - [485c096](https://github.com/appium/ruby_lib_core/commit/485c096273178aa5e21f28d93545fd127cbb8735) test: add assertion
32
+
33
+
34
+ #### v4.5.0 2021-03-14
35
+
36
+ - [656230e](https://github.com/appium/ruby_lib_core/commit/656230e688ed86414c06efaa73bce7359933cc91) Release 4.5.0
37
+ - [a0a3cfc](https://github.com/appium/ruby_lib_core/commit/a0a3cfc71783bed3d1b0e7afbf6bc0a27bf60a48) feat: add speed option (#318)
38
+ - [16b4f09](https://github.com/appium/ruby_lib_core/commit/16b4f0991deb639314857c3cbece1e4d00393646) feat: add multiple and match_neighbour_threshold (#313)
39
+ - [d195a5b](https://github.com/appium/ruby_lib_core/commit/d195a5ba48c2e1a7229e0145eac616fd886c1ee0) ci: use node 12
40
+
41
+
1
42
  #### v4.4.1 2021-02-15
2
43
 
3
44
  - [dc34419](https://github.com/appium/ruby_lib_core/commit/dc34419dfcc4dd8d499a6407d45ab3efe70c2445) Release 4.4.1
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.1
4
+ version: 4.7.1
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-15 00:00:00.000000000 Z
11
+ date: 2021-09-27 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.14.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.14.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.1
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.1
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: []