appium_lib_core 4.3.0 → 4.6.0
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 +4 -4
- data/.github/dependabot.yml +8 -0
- data/CHANGELOG.md +16 -4
- data/README.md +2 -1
- data/appium_lib_core.gemspec +2 -2
- data/ci-jobs/functional/run_appium.yml +2 -2
- data/ci-jobs/functional_test.yml +1 -1
- data/lib/appium_lib_core/common/base/bridge/mjsonwp.rb +27 -1
- data/lib/appium_lib_core/common/base/bridge/w3c.rb +23 -12
- data/lib/appium_lib_core/common/base/driver.rb +97 -15
- data/lib/appium_lib_core/common/base/has_location.rb +73 -0
- data/lib/appium_lib_core/common/base/http_default.rb +1 -1
- data/lib/appium_lib_core/common/base/remote_status.rb +31 -0
- data/lib/appium_lib_core/common/device/image_comparison.rb +9 -1
- data/lib/appium_lib_core/common/error.rb +4 -1
- data/lib/appium_lib_core/driver.rb +9 -6
- data/lib/appium_lib_core/version.rb +2 -2
- data/release_notes.md +41 -0
- metadata +9 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 199c9c0821774e61120fd7f1311548d9cc0fd1521d71e3b6c207fece055d11b7
|
4
|
+
data.tar.gz: f7c96d05702e81bfee428012ece7f6cd05f6e475100fc3c3e00b51a4fbd7d732
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 792aaeb715d990eb9dc7a086cc59f8ec81c06c545d4b7203a557cf60c673cade059a391d0c06b490a43834d806735c4713ae1108668271cc4da6614a48dd7c44
|
7
|
+
data.tar.gz: ba0141ca83ea0c3e6839647b117c0cb518d5333d47f70d45a36a677aab98844903c3ff0331c3788451154d9937b95647c3bc9a87b5990baaab1d6ebb2615da88
|
data/CHANGELOG.md
CHANGED
@@ -10,14 +10,26 @@ Read `release_notes.md` for commit level details.
|
|
10
10
|
|
11
11
|
### Deprecations
|
12
12
|
|
13
|
-
## [4.
|
13
|
+
## [4.6.0] - 2021-06-03
|
14
14
|
|
15
15
|
### Enhancements
|
16
|
-
- Add `
|
16
|
+
- Add `Appium::Core::Base::Driver#add_command` to allow you to add your own command
|
17
17
|
|
18
|
-
|
18
|
+
## [4.5.0] - 2021-03-14
|
19
19
|
|
20
|
-
###
|
20
|
+
### Enhancements
|
21
|
+
- Add `speed` argument for `Appium::Core::Base::Driver#set_location` since Appium 1.21.0
|
22
|
+
- Add `multiple` and `match_neighbour_threshold` arguments for `Appium::Core::Base::Driver#find_image_occurrence`
|
23
|
+
|
24
|
+
## [4.4.1(4.4.0)] - 2021-02-15(2021-02-13)
|
25
|
+
|
26
|
+
### Enhancements
|
27
|
+
- Returns `{}` any errors in `Core#appium_server_version` to prevent errors in some cases
|
28
|
+
|
29
|
+
## [4.3.1(4.3.0)] - 2021-02-07(2021-02-05)
|
30
|
+
|
31
|
+
### Enhancements
|
32
|
+
- Add `start_recording_screen` for Mac2 driver
|
21
33
|
|
22
34
|
## [4.2.1] - 2021-01-10
|
23
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/appium_lib_core.gemspec
CHANGED
@@ -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.
|
34
|
-
spec.add_development_dependency 'rubocop', '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:
|
5
|
-
displayName: Install Node
|
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
|
data/ci-jobs/functional_test.yml
CHANGED
@@ -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
|
-
|
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
|
@@ -42,6 +58,10 @@ module Appium
|
|
42
58
|
execute :get_all_sessions
|
43
59
|
end
|
44
60
|
|
61
|
+
def status
|
62
|
+
execute :status
|
63
|
+
end
|
64
|
+
|
45
65
|
# For Appium
|
46
66
|
def log_event(vendor, event)
|
47
67
|
execute :post_log_event, {}, { vendor: vendor, event: event }
|
@@ -74,6 +94,12 @@ module Appium
|
|
74
94
|
def convert_to_element(id)
|
75
95
|
::Selenium::WebDriver::Element.new self, element_id_from(id)
|
76
96
|
end
|
97
|
+
|
98
|
+
def set_location(lat, lon, alt = 0.0, speed: nil)
|
99
|
+
loc = { latitude: lat, longitude: lon, altitude: alt }
|
100
|
+
loc[:speed] = speed unless speed.nil?
|
101
|
+
execute :set_location, {}, { location: loc }
|
102
|
+
end
|
77
103
|
end # class MJSONWP
|
78
104
|
end # class Bridge
|
79
105
|
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
|
-
|
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
|
@@ -43,6 +59,10 @@ module Appium
|
|
43
59
|
execute :get_all_sessions
|
44
60
|
end
|
45
61
|
|
62
|
+
def status
|
63
|
+
execute :status
|
64
|
+
end
|
65
|
+
|
46
66
|
# Perform touch actions for W3C module.
|
47
67
|
# Generate +touch+ pointer action here and users can use this via +driver.action+
|
48
68
|
# - https://seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/W3CActionBuilder.html
|
@@ -166,18 +186,9 @@ module Appium
|
|
166
186
|
|
167
187
|
# For Appium
|
168
188
|
# No implementation for W3C webdriver module
|
169
|
-
|
170
|
-
# It has below code as well. We should consider the same context in Selenium 4 as backward compatibility.
|
171
|
-
#
|
172
|
-
# def location=(loc)
|
173
|
-
# # note: Location = Struct.new(:latitude, :longitude, :altitude)
|
174
|
-
# raise TypeError, "expected #{Location}, got #{loc.inspect}:#{loc.class}" unless loc.is_a?(Location)
|
175
|
-
#
|
176
|
-
# @bridge.set_location loc.latitude, loc.longitude, loc.altitude
|
177
|
-
# end
|
178
|
-
#
|
179
|
-
def set_location(lat, lon, alt = 0.0)
|
189
|
+
def set_location(lat, lon, alt = 0.0, speed: nil)
|
180
190
|
loc = { latitude: lat, longitude: lon, altitude: alt }
|
191
|
+
loc[:speed] = speed unless speed.nil?
|
181
192
|
execute :set_location, {}, { location: loc }
|
182
193
|
end
|
183
194
|
|
@@ -16,6 +16,8 @@ require 'base64'
|
|
16
16
|
require_relative 'search_context'
|
17
17
|
require_relative 'screenshot'
|
18
18
|
require_relative 'rotable'
|
19
|
+
require_relative 'remote_status'
|
20
|
+
require_relative 'has_location'
|
19
21
|
|
20
22
|
module Appium
|
21
23
|
module Core
|
@@ -25,10 +27,14 @@ module Appium
|
|
25
27
|
include ::Selenium::WebDriver::DriverExtensions::HasSessionId
|
26
28
|
include ::Selenium::WebDriver::DriverExtensions::HasRemoteStatus
|
27
29
|
include ::Selenium::WebDriver::DriverExtensions::HasWebStorage
|
30
|
+
include ::Selenium::WebDriver::DriverExtensions::HasNetworkConnection
|
31
|
+
include ::Selenium::WebDriver::DriverExtensions::HasTouchScreen
|
28
32
|
|
29
33
|
include ::Appium::Core::Base::Rotatable
|
30
34
|
include ::Appium::Core::Base::SearchContext
|
31
35
|
include ::Appium::Core::Base::TakesScreenshot
|
36
|
+
include ::Appium::Core::Base::HasRemoteStatus
|
37
|
+
include ::Appium::Core::Base::HasLocation
|
32
38
|
|
33
39
|
# Private API.
|
34
40
|
# Do not use this for general use. Used by flutter driver to get bridge for creating a new element
|
@@ -37,16 +43,6 @@ module Appium
|
|
37
43
|
def initialize(opts = {})
|
38
44
|
listener = opts.delete(:listener)
|
39
45
|
@bridge = ::Appium::Core::Base::Bridge.handshake(**opts)
|
40
|
-
if @bridge.dialect == :oss # MJSONWP
|
41
|
-
extend ::Selenium::WebDriver::DriverExtensions::HasTouchScreen
|
42
|
-
extend ::Selenium::WebDriver::DriverExtensions::HasLocation
|
43
|
-
extend ::Selenium::WebDriver::DriverExtensions::HasNetworkConnection
|
44
|
-
elsif @bridge.dialect == :w3c
|
45
|
-
# TODO: Only for Appium. Ideally, we'd like to remove the below like selenium-webdriver
|
46
|
-
extend ::Selenium::WebDriver::DriverExtensions::HasTouchScreen
|
47
|
-
extend ::Selenium::WebDriver::DriverExtensions::HasLocation
|
48
|
-
extend ::Selenium::WebDriver::DriverExtensions::HasNetworkConnection
|
49
|
-
end
|
50
46
|
super(@bridge, listener: listener)
|
51
47
|
end
|
52
48
|
|
@@ -69,7 +65,7 @@ module Appium
|
|
69
65
|
#
|
70
66
|
def update_sending_request_to(protocol:, host:, port:, path:)
|
71
67
|
unless @bridge.http&.class&.method_defined? :update_sending_request_to
|
72
|
-
::Appium::Logger.
|
68
|
+
::Appium::Logger.warn "#{@bridge.http&.class} has no 'update_sending_request_to'. " \
|
73
69
|
'It keeps current connection target.'
|
74
70
|
return
|
75
71
|
end
|
@@ -80,6 +76,75 @@ module Appium
|
|
80
76
|
path: path)
|
81
77
|
end
|
82
78
|
|
79
|
+
AVAILABLE_METHOD = [
|
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
|
+
# @raise [ArgumentError] If the given +name+ is already defined or +method+ are invalid value.
|
95
|
+
#
|
96
|
+
# @example
|
97
|
+
#
|
98
|
+
# @driver.add_command(
|
99
|
+
# method: :get,
|
100
|
+
# url: 'session/:session_id/path/to/custom/url',
|
101
|
+
# name: :test_command
|
102
|
+
# )
|
103
|
+
# # Send a GET request to 'session/<session id>/path/to/custom/url'
|
104
|
+
# @driver.test_command
|
105
|
+
#
|
106
|
+
#
|
107
|
+
# @driver.add_command(
|
108
|
+
# method: :post,
|
109
|
+
# url: 'session/:session_id/path/to/custom/url',
|
110
|
+
# name: :test_command
|
111
|
+
# ) do
|
112
|
+
# def test_command(argument)
|
113
|
+
# execute(:test_command, {}, { dummy: argument })
|
114
|
+
# end
|
115
|
+
# end
|
116
|
+
# # Send a POST request to 'session/<session id>/path/to/custom/url'
|
117
|
+
# # with body "{ dummy: 1 }" as JSON object. "1" is the argument.
|
118
|
+
# # ':session_id' in the given 'url' is replaced with current 'session id'.
|
119
|
+
# @driver.test_command(1)
|
120
|
+
#
|
121
|
+
# @driver.add_command(
|
122
|
+
# method: :post,
|
123
|
+
# url: 'session/:session_id/element/:id/custom/action',
|
124
|
+
# name: :test_action_command
|
125
|
+
# ) do
|
126
|
+
# def test_action_command(element_id, action)
|
127
|
+
# execute(:test_action_command, {id: element_id}, { dummy_action: action })
|
128
|
+
# end
|
129
|
+
# end
|
130
|
+
# # Send a POST request to 'session/<session id>/element/<element id>/custom/action'
|
131
|
+
# # with body "{ dummy_action: #{action} }" as JSON object. "action" is the seconds argument.
|
132
|
+
# # ':session_id' in the given url is replaced with current 'session id'.
|
133
|
+
# # ':id' in the given url is replaced with the given 'element_id'.
|
134
|
+
# e = @driver.find_element :accessibility_id, 'an element'
|
135
|
+
# @driver.test_action_command(e.ref, 'action')
|
136
|
+
#
|
137
|
+
def add_command(method:, url:, name:, &block)
|
138
|
+
unless AVAILABLE_METHOD.include? method
|
139
|
+
raise ::Appium::Core::Error::ArgumentError, "Available method is either #{AVAILABLE_METHOD}"
|
140
|
+
end
|
141
|
+
|
142
|
+
# TODO: Remove this logger
|
143
|
+
::Appium::Logger.info '[Experimental] this method is experimental for Appium 2.0. This interface may change.'
|
144
|
+
|
145
|
+
@bridge.add_command method: method, url: url, name: name, &block
|
146
|
+
end
|
147
|
+
|
83
148
|
### Methods for Appium
|
84
149
|
|
85
150
|
# Lock the device
|
@@ -168,10 +233,24 @@ module Appium
|
|
168
233
|
@bridge = bridge
|
169
234
|
end
|
170
235
|
|
236
|
+
# Get appium Settings for current test session.
|
237
|
+
#
|
238
|
+
# @example
|
239
|
+
#
|
240
|
+
# @driver.settings.get
|
241
|
+
#
|
171
242
|
def get
|
172
243
|
@bridge.get_settings
|
173
244
|
end
|
174
245
|
|
246
|
+
# Update Appium Settings for current test session
|
247
|
+
#
|
248
|
+
# @param [Hash] settings Settings to update, keys are settings, values to value to set each setting to
|
249
|
+
#
|
250
|
+
# @example
|
251
|
+
#
|
252
|
+
# @driver.settings.update({'allowInvisibleElements': true})
|
253
|
+
#
|
175
254
|
def update(settings)
|
176
255
|
@bridge.update_settings(settings)
|
177
256
|
end
|
@@ -208,8 +287,8 @@ module Appium
|
|
208
287
|
#
|
209
288
|
# @example
|
210
289
|
#
|
211
|
-
# @driver.update_settings('allowInvisibleElements': true)
|
212
|
-
# @driver.settings.update('allowInvisibleElements': true)
|
290
|
+
# @driver.update_settings({ 'allowInvisibleElements': true })
|
291
|
+
# @driver.settings.update({ 'allowInvisibleElements': true })
|
213
292
|
# @driver.settings = { 'allowInvisibleElements': true }
|
214
293
|
#
|
215
294
|
def settings=(value)
|
@@ -1004,11 +1083,14 @@ module Appium
|
|
1004
1083
|
visualize: visualize)
|
1005
1084
|
end
|
1006
1085
|
|
1007
|
-
def find_image_occurrence(full_image:, partial_image:, visualize: false, threshold: nil
|
1086
|
+
def find_image_occurrence(full_image:, partial_image:, visualize: false, threshold: nil,
|
1087
|
+
multiple: nil, match_neighbour_threshold: nil)
|
1008
1088
|
@bridge.find_image_occurrence(full_image: full_image,
|
1009
1089
|
partial_image: partial_image,
|
1010
1090
|
visualize: visualize,
|
1011
|
-
threshold: threshold
|
1091
|
+
threshold: threshold,
|
1092
|
+
multiple: multiple,
|
1093
|
+
match_neighbour_threshold: match_neighbour_threshold)
|
1012
1094
|
end
|
1013
1095
|
|
1014
1096
|
def get_images_similarity(first_image:, second_image:, visualize: false)
|
@@ -0,0 +1,73 @@
|
|
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 @since Appium 1.21.0.
|
56
|
+
# @param [::Selenium::WebDriver::Location]
|
57
|
+
#
|
58
|
+
# @example
|
59
|
+
#
|
60
|
+
# driver.location = ::Selenium::WebDriver::Location.new(10, 10, 10)
|
61
|
+
#
|
62
|
+
def set_location(latitude, longitude, altitude, speed: nil)
|
63
|
+
if speed.nil?
|
64
|
+
self.location = ::Selenium::WebDriver::Location.new(Float(latitude), Float(longitude), Float(altitude))
|
65
|
+
else
|
66
|
+
loc = ::Selenium::WebDriver::Location.new(Float(latitude), Float(longitude), Float(altitude))
|
67
|
+
@bridge.set_location loc.latitude, loc.longitude, loc.altitude, speed: Float(speed)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -69,7 +69,7 @@ module Appium
|
|
69
69
|
return true unless [scheme, host, port, path].include?(nil)
|
70
70
|
|
71
71
|
message = "Given parameters are scheme: '#{scheme}', host: '#{host}', port: '#{port}', path: '#{path}'"
|
72
|
-
::Appium::Logger.
|
72
|
+
::Appium::Logger.debug(message)
|
73
73
|
false
|
74
74
|
end
|
75
75
|
|
@@ -0,0 +1,31 @@
|
|
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
|
+
|
22
|
+
module HasRemoteStatus
|
23
|
+
# Selenium binding has this ability only in Remote Binding,
|
24
|
+
# so this library has this method by own for safe.
|
25
|
+
def remote_status
|
26
|
+
bridge.status
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
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
|
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
|
@@ -437,7 +437,8 @@ module Appium
|
|
437
437
|
nil
|
438
438
|
end
|
439
439
|
|
440
|
-
# Returns the server's version info
|
440
|
+
# Returns the server's version info. This method calls +driver.remote_status+ internally
|
441
|
+
#
|
441
442
|
# @return [Hash]
|
442
443
|
#
|
443
444
|
# @example
|
@@ -451,18 +452,20 @@ module Appium
|
|
451
452
|
# }
|
452
453
|
# }
|
453
454
|
#
|
454
|
-
# Returns blank hash
|
455
|
+
# Returns blank hash in a case +driver.remote_status+ got an error
|
456
|
+
# such as Selenium Grid. It returns 500 error against 'remote_status'.
|
455
457
|
#
|
456
458
|
# @example
|
457
459
|
#
|
458
460
|
# @core.appium_server_version #=> {}
|
459
461
|
#
|
460
462
|
def appium_server_version
|
461
|
-
@driver.
|
462
|
-
rescue Selenium::WebDriver::Error::ServerError => e
|
463
|
-
raise ::Appium::Core::Error::ServerError unless e.message.include?('status code 500')
|
463
|
+
return {} if @driver.nil?
|
464
464
|
|
465
|
-
|
465
|
+
@driver.remote_status
|
466
|
+
rescue StandardError
|
467
|
+
# Ignore error case in a case the target appium server
|
468
|
+
# does not support `/status` API.
|
466
469
|
{}
|
467
470
|
end
|
468
471
|
|
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
module Appium
|
16
16
|
module Core
|
17
|
-
VERSION = '4.
|
18
|
-
DATE = '2021-
|
17
|
+
VERSION = '4.6.0' unless defined? ::Appium::Core::VERSION
|
18
|
+
DATE = '2021-06-03' unless defined? ::Appium::Core::DATE
|
19
19
|
end
|
20
20
|
end
|
data/release_notes.md
CHANGED
@@ -1,3 +1,44 @@
|
|
1
|
+
#### v4.6.0 2021-06-03
|
2
|
+
|
3
|
+
- [0dacfab](https://github.com/appium/ruby_lib_core/commit/0dacfab1256e1447e1f7a5974dfcf48ee0a72b9d) Release 4.6.0
|
4
|
+
- [b9f015d](https://github.com/appium/ruby_lib_core/commit/b9f015d7dea14964a0733f2385ebcff68da1e18e) feat: allow to add commands dynamically (#325)
|
5
|
+
- [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)
|
6
|
+
- [f1a9e79](https://github.com/appium/ruby_lib_core/commit/f1a9e79f3bd4d134e125fc2ed9adcf3d085afc9a) docs: address func test code as working example
|
7
|
+
- [eb85b1b](https://github.com/appium/ruby_lib_core/commit/eb85b1b26623436cb0aae95a00fef7bc2d795520) remove ; in a test
|
8
|
+
- [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)
|
9
|
+
- [b9e47aa](https://github.com/appium/ruby_lib_core/commit/b9e47aa9b02f060ffa91e8410ab97dc87d3640a4) docs: add docstring
|
10
|
+
- [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)
|
11
|
+
- [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)
|
12
|
+
- [485c096](https://github.com/appium/ruby_lib_core/commit/485c096273178aa5e21f28d93545fd127cbb8735) test: add assertion
|
13
|
+
|
14
|
+
|
15
|
+
#### v4.5.0 2021-03-14
|
16
|
+
|
17
|
+
- [656230e](https://github.com/appium/ruby_lib_core/commit/656230e688ed86414c06efaa73bce7359933cc91) Release 4.5.0
|
18
|
+
- [a0a3cfc](https://github.com/appium/ruby_lib_core/commit/a0a3cfc71783bed3d1b0e7afbf6bc0a27bf60a48) feat: add speed option (#318)
|
19
|
+
- [16b4f09](https://github.com/appium/ruby_lib_core/commit/16b4f0991deb639314857c3cbece1e4d00393646) feat: add multiple and match_neighbour_threshold (#313)
|
20
|
+
- [d195a5b](https://github.com/appium/ruby_lib_core/commit/d195a5ba48c2e1a7229e0145eac616fd886c1ee0) ci: use node 12
|
21
|
+
|
22
|
+
|
23
|
+
#### v4.4.1 2021-02-15
|
24
|
+
|
25
|
+
- [dc34419](https://github.com/appium/ruby_lib_core/commit/dc34419dfcc4dd8d499a6407d45ab3efe70c2445) Release 4.4.1
|
26
|
+
- [3085048](https://github.com/appium/ruby_lib_core/commit/3085048b4816e3415017ebb188e653c8e229a05e) chore: return {} in nil case as well
|
27
|
+
|
28
|
+
|
29
|
+
#### v4.4.0 2021-02-13
|
30
|
+
|
31
|
+
- [06c68fb](https://github.com/appium/ruby_lib_core/commit/06c68fbe3ffdbb7b068d2f71ad6841c66dbabf8f) Release 4.4.0
|
32
|
+
- [3c54ae2](https://github.com/appium/ruby_lib_core/commit/3c54ae25d9a334f3690c94ce8a59a5c6a4bacd20) feat: always return {} in appium_server_version for errors (#311)
|
33
|
+
|
34
|
+
|
35
|
+
#### v4.3.1 2021-02-07
|
36
|
+
|
37
|
+
- [1f4d52c](https://github.com/appium/ruby_lib_core/commit/1f4d52cc915783cf89cf4b8ca5a21bd1af5403e0) Release 4.3.1
|
38
|
+
- [fb41014](https://github.com/appium/ruby_lib_core/commit/fb410146567ed03902b602813881fd3abc3a3d28) chore: change log level
|
39
|
+
- [1e54662](https://github.com/appium/ruby_lib_core/commit/1e546628c871e4ed9c8aa038a455d03e4e2e6c4e) chore : Create Dependabot config file (#309)
|
40
|
+
|
41
|
+
|
1
42
|
#### v4.3.0 2021-02-05
|
2
43
|
|
3
44
|
- [6e85426](https://github.com/appium/ruby_lib_core/commit/6e85426c1ff8f3e4b90d3da5305d493500539467) Release 4.3.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
|
+
version: 4.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kazuaki MATSUO
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-04 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.
|
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.
|
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.
|
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.
|
144
|
+
version: 1.12.0
|
145
145
|
- !ruby/object:Gem::Dependency
|
146
146
|
name: appium_thor
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|
@@ -221,6 +221,7 @@ extra_rdoc_files: []
|
|
221
221
|
files:
|
222
222
|
- ".github/ISSUE_TEMPLATE/issue-report.md"
|
223
223
|
- ".github/contributing.md"
|
224
|
+
- ".github/dependabot.yml"
|
224
225
|
- ".github/issue_template.md"
|
225
226
|
- ".github/workflows/unittest.yml"
|
226
227
|
- ".gitignore"
|
@@ -266,8 +267,10 @@ files:
|
|
266
267
|
- lib/appium_lib_core/common/base/capabilities.rb
|
267
268
|
- lib/appium_lib_core/common/base/command.rb
|
268
269
|
- lib/appium_lib_core/common/base/driver.rb
|
270
|
+
- lib/appium_lib_core/common/base/has_location.rb
|
269
271
|
- lib/appium_lib_core/common/base/http_default.rb
|
270
272
|
- lib/appium_lib_core/common/base/platform.rb
|
273
|
+
- lib/appium_lib_core/common/base/remote_status.rb
|
271
274
|
- lib/appium_lib_core/common/base/rotable.rb
|
272
275
|
- lib/appium_lib_core/common/base/screenshot.rb
|
273
276
|
- lib/appium_lib_core/common/base/search_context.rb
|