appium_lib_core 4.4.1 → 4.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- 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 +6 -0
- data/lib/appium_lib_core/common/base/bridge/w3c.rb +2 -11
- data/lib/appium_lib_core/common/base/driver.rb +10 -13
- data/lib/appium_lib_core/common/base/has_location.rb +73 -0
- data/lib/appium_lib_core/common/device/image_comparison.rb +9 -1
- data/lib/appium_lib_core/version.rb +2 -2
- data/release_notes.md +8 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27d5a8e4018e381172273c5b705a2166e8f47530101eed83ffd0ddf83e93653d
|
4
|
+
data.tar.gz: 78ceb26083c9ae018101180cf13c91cd28f363e819119b6500b2d48a28273474
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d07ce477474a38c3df1fb1bd989d9e6b28188ab21d7851bec98443940b0ea5d8b358c628998aeb1f62ca93be783c617dab3b4cf4fdf26e47e97def6467dca97
|
7
|
+
data.tar.gz: 29634dc748e222cf65bc6af144656f291815e4c5eaea1fa177aa7e1543752ffbcbac0d4b206f4169ab306dd25e1d5a36c2a1b3d9b51cdef438456c27e52a7bea
|
data/CHANGELOG.md
CHANGED
@@ -10,6 +10,16 @@ Read `release_notes.md` for commit level details.
|
|
10
10
|
|
11
11
|
### Deprecations
|
12
12
|
|
13
|
+
## [4.5.0] - 2021-03-14
|
14
|
+
|
15
|
+
### Enhancements
|
16
|
+
- Add `speed` argument for `Appium::Core::Base::Driver#set_location` since Appium 1.21.0
|
17
|
+
- Add `multiple` and `match_neighbour_threshold` arguments for `Appium::Core::Base::Driver#find_image_occurrence`
|
18
|
+
|
19
|
+
### Bug fixes
|
20
|
+
|
21
|
+
### Deprecations
|
22
|
+
|
13
23
|
|
14
24
|
## [4.4.1(4.4.0)] - 2021-02-15(2021-02-13)
|
15
25
|
|
@@ -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
|
@@ -78,6 +78,12 @@ module Appium
|
|
78
78
|
def convert_to_element(id)
|
79
79
|
::Selenium::WebDriver::Element.new self, element_id_from(id)
|
80
80
|
end
|
81
|
+
|
82
|
+
def set_location(lat, lon, alt = 0.0, speed: nil)
|
83
|
+
loc = { latitude: lat, longitude: lon, altitude: alt }
|
84
|
+
loc[:speed] = speed unless speed.nil?
|
85
|
+
execute :set_location, {}, { location: loc }
|
86
|
+
end
|
81
87
|
end # class MJSONWP
|
82
88
|
end # class Bridge
|
83
89
|
end # class Base
|
@@ -170,18 +170,9 @@ module Appium
|
|
170
170
|
|
171
171
|
# For Appium
|
172
172
|
# No implementation for W3C webdriver module
|
173
|
-
|
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)
|
173
|
+
def set_location(lat, lon, alt = 0.0, speed: nil)
|
184
174
|
loc = { latitude: lat, longitude: lon, altitude: alt }
|
175
|
+
loc[:speed] = speed unless speed.nil?
|
185
176
|
execute :set_location, {}, { location: loc }
|
186
177
|
end
|
187
178
|
|
@@ -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.
|
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
|
@@ -1006,11 +1000,14 @@ module Appium
|
|
1006
1000
|
visualize: visualize)
|
1007
1001
|
end
|
1008
1002
|
|
1009
|
-
def find_image_occurrence(full_image:, partial_image:, visualize: false, threshold: nil
|
1003
|
+
def find_image_occurrence(full_image:, partial_image:, visualize: false, threshold: nil,
|
1004
|
+
multiple: nil, match_neighbour_threshold: nil)
|
1010
1005
|
@bridge.find_image_occurrence(full_image: full_image,
|
1011
1006
|
partial_image: partial_image,
|
1012
1007
|
visualize: visualize,
|
1013
|
-
threshold: threshold
|
1008
|
+
threshold: threshold,
|
1009
|
+
multiple: multiple,
|
1010
|
+
match_neighbour_threshold: match_neighbour_threshold)
|
1014
1011
|
end
|
1015
1012
|
|
1016
1013
|
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
|
@@ -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
|
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
module Appium
|
16
16
|
module Core
|
17
|
-
VERSION = '4.
|
18
|
-
DATE = '2021-
|
17
|
+
VERSION = '4.5.0' unless defined? ::Appium::Core::VERSION
|
18
|
+
DATE = '2021-03-14' unless defined? ::Appium::Core::DATE
|
19
19
|
end
|
20
20
|
end
|
data/release_notes.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
#### v4.5.0 2021-03-14
|
2
|
+
|
3
|
+
- [656230e](https://github.com/appium/ruby_lib_core/commit/656230e688ed86414c06efaa73bce7359933cc91) Release 4.5.0
|
4
|
+
- [a0a3cfc](https://github.com/appium/ruby_lib_core/commit/a0a3cfc71783bed3d1b0e7afbf6bc0a27bf60a48) feat: add speed option (#318)
|
5
|
+
- [16b4f09](https://github.com/appium/ruby_lib_core/commit/16b4f0991deb639314857c3cbece1e4d00393646) feat: add multiple and match_neighbour_threshold (#313)
|
6
|
+
- [d195a5b](https://github.com/appium/ruby_lib_core/commit/d195a5ba48c2e1a7229e0145eac616fd886c1ee0) ci: use node 12
|
7
|
+
|
8
|
+
|
1
9
|
#### v4.4.1 2021-02-15
|
2
10
|
|
3
11
|
- [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
|
+
version: 4.5.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-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: selenium-webdriver
|
@@ -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
|