appium_lib_core 4.3.0 → 5.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +8 -0
- data/.github/workflows/unittest.yml +2 -2
- data/CHANGELOG.md +20 -2
- data/appium_lib_core.gemspec +4 -4
- data/ci-jobs/functional/run_appium.yml +2 -2
- data/ci-jobs/functional_test.yml +1 -1
- data/lib/appium_lib_core/common/base.rb +0 -1
- data/lib/appium_lib_core/common/base/bridge.rb +17 -102
- data/lib/appium_lib_core/common/base/bridge/w3c.rb +108 -13
- data/lib/appium_lib_core/common/base/capabilities.rb +3 -3
- data/lib/appium_lib_core/common/base/command.rb +123 -2
- data/lib/appium_lib_core/common/base/driver.rb +67 -21
- data/lib/appium_lib_core/common/base/has_location.rb +73 -0
- data/lib/appium_lib_core/common/base/has_network_connection.rb +56 -0
- data/lib/appium_lib_core/common/base/http_default.rb +1 -1
- data/lib/appium_lib_core/common/{command/mjsonwp.rb → base/remote_status.rb} +15 -12
- data/lib/appium_lib_core/common/command.rb +0 -1
- data/lib/appium_lib_core/common/device/image_comparison.rb +9 -1
- data/lib/appium_lib_core/device.rb +0 -4
- data/lib/appium_lib_core/driver.rb +13 -10
- data/lib/appium_lib_core/version.rb +2 -2
- data/release_notes.md +27 -0
- data/script/commands.rb +2 -25
- metadata +17 -21
- data/lib/appium_lib_core/common/base/bridge/mjsonwp.rb +0 -81
@@ -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
|
@@ -79,10 +79,6 @@ module Appium
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def create_bridge_command(method, &block)
|
82
|
-
::Appium::Core::Base::Bridge::MJSONWP.class_eval do
|
83
|
-
undef_method method if method_defined? method
|
84
|
-
block_given? ? class_eval(&block) : define_method(method) { execute method }
|
85
|
-
end
|
86
82
|
::Appium::Core::Base::Bridge::W3C.class_eval do
|
87
83
|
undef_method method if method_defined? method
|
88
84
|
block_given? ? class_eval(&block) : define_method(method) { execute method }
|
@@ -368,10 +368,10 @@ module Appium
|
|
368
368
|
|
369
369
|
begin
|
370
370
|
# included https://github.com/SeleniumHQ/selenium/blob/43f8b3f66e7e01124eff6a5805269ee441f65707/rb/lib/selenium/webdriver/remote/driver.rb#L29
|
371
|
-
@driver = ::Appium::Core::Base::Driver.new(
|
372
|
-
|
373
|
-
|
374
|
-
|
371
|
+
@driver = ::Appium::Core::Base::Driver.new(listener: @listener,
|
372
|
+
http_client: @http_client,
|
373
|
+
desired_capabilities: @caps,
|
374
|
+
url: @custom_url)
|
375
375
|
|
376
376
|
if @direct_connect
|
377
377
|
d_c = DirectConnections.new(@driver.capabilities)
|
@@ -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 = '
|
18
|
-
DATE = '2021-
|
17
|
+
VERSION = '5.0.0.beta1' unless defined? ::Appium::Core::VERSION
|
18
|
+
DATE = '2021-03-21' unless defined? ::Appium::Core::DATE
|
19
19
|
end
|
20
20
|
end
|
data/release_notes.md
CHANGED
@@ -1,3 +1,30 @@
|
|
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
|
+
|
9
|
+
#### v4.4.1 2021-02-15
|
10
|
+
|
11
|
+
- [dc34419](https://github.com/appium/ruby_lib_core/commit/dc34419dfcc4dd8d499a6407d45ab3efe70c2445) Release 4.4.1
|
12
|
+
- [3085048](https://github.com/appium/ruby_lib_core/commit/3085048b4816e3415017ebb188e653c8e229a05e) chore: return {} in nil case as well
|
13
|
+
|
14
|
+
|
15
|
+
#### v4.4.0 2021-02-13
|
16
|
+
|
17
|
+
- [06c68fb](https://github.com/appium/ruby_lib_core/commit/06c68fbe3ffdbb7b068d2f71ad6841c66dbabf8f) Release 4.4.0
|
18
|
+
- [3c54ae2](https://github.com/appium/ruby_lib_core/commit/3c54ae25d9a334f3690c94ce8a59a5c6a4bacd20) feat: always return {} in appium_server_version for errors (#311)
|
19
|
+
|
20
|
+
|
21
|
+
#### v4.3.1 2021-02-07
|
22
|
+
|
23
|
+
- [1f4d52c](https://github.com/appium/ruby_lib_core/commit/1f4d52cc915783cf89cf4b8ca5a21bd1af5403e0) Release 4.3.1
|
24
|
+
- [fb41014](https://github.com/appium/ruby_lib_core/commit/fb410146567ed03902b602813881fd3abc3a3d28) chore: change log level
|
25
|
+
- [1e54662](https://github.com/appium/ruby_lib_core/commit/1e546628c871e4ed9c8aa038a455d03e4e2e6c4e) chore : Create Dependabot config file (#309)
|
26
|
+
|
27
|
+
|
1
28
|
#### v4.3.0 2021-02-05
|
2
29
|
|
3
30
|
- [6e85426](https://github.com/appium/ruby_lib_core/commit/6e85426c1ff8f3e4b90d3da5305d493500539467) Release 4.3.0
|
data/script/commands.rb
CHANGED
@@ -18,25 +18,21 @@ require './lib/appium_lib_core'
|
|
18
18
|
module Script
|
19
19
|
class CommandsChecker
|
20
20
|
attr_reader :spec_commands,
|
21
|
-
:
|
22
|
-
:
|
21
|
+
:implemented_w3c_commands, :implemented_core_commands,
|
22
|
+
:webdriver_w3c_commands
|
23
23
|
|
24
24
|
# Set commands implemented in this core library.
|
25
25
|
#
|
26
|
-
# - implemented_mjsonwp_commands: All commands include ::Selenium::WebDriver::Remote::OSS::Bridge::COMMANDS
|
27
26
|
# - implemented_w3c_commands: All commands include ::Selenium::WebDriver::Remote::W3C::Bridge::COMMANDS
|
28
27
|
# - implemented_core_commands: All commands except for selenium-webdriver's commands
|
29
|
-
# - webdriver_oss_commands: ::Selenium::WebDriver::Remote::OSS::Bridge::COMMANDS
|
30
28
|
# - webdriver_w3c_commands: ::Selenium::WebDriver::Remote::W3C::Bridge::COMMANDS
|
31
29
|
#
|
32
30
|
def initialize
|
33
31
|
@spec_commands = nil
|
34
32
|
|
35
|
-
@implemented_mjsonwp_commands = convert_driver_commands Appium::Core::Commands::MJSONWP::COMMANDS
|
36
33
|
@implemented_w3c_commands = convert_driver_commands Appium::Core::Commands::W3C::COMMANDS
|
37
34
|
@implemented_core_commands = convert_driver_commands Appium::Core::Commands::COMMANDS
|
38
35
|
|
39
|
-
@webdriver_oss_commands = convert_driver_commands Appium::Core::Base::Commands::OSS
|
40
36
|
@webdriver_w3c_commands = convert_driver_commands Appium::Core::Base::Commands::W3C
|
41
37
|
end
|
42
38
|
|
@@ -80,18 +76,6 @@ module Script
|
|
80
76
|
end
|
81
77
|
end
|
82
78
|
|
83
|
-
# All commands which haven't been implemented in ruby core library yet.
|
84
|
-
# @return [Hash]
|
85
|
-
#
|
86
|
-
def all_diff_commands_mjsonwp
|
87
|
-
result = compare_commands(@spec_commands, @implemented_mjsonwp_commands)
|
88
|
-
|
89
|
-
white_list.each { |v| result.delete v }
|
90
|
-
w3c_spec.each { |v| result.delete v }
|
91
|
-
|
92
|
-
result
|
93
|
-
end
|
94
|
-
|
95
79
|
# All commands which haven't been implemented in ruby core library yet.
|
96
80
|
# @return [Hash]
|
97
81
|
#
|
@@ -111,13 +95,6 @@ module Script
|
|
111
95
|
result
|
112
96
|
end
|
113
97
|
|
114
|
-
def diff_webdriver_oss
|
115
|
-
result = compare_commands(@spec_commands, @webdriver_oss_commands)
|
116
|
-
white_list.each { |v| result.delete v }
|
117
|
-
w3c_spec.each { |v| result.delete v }
|
118
|
-
result
|
119
|
-
end
|
120
|
-
|
121
98
|
def diff_webdriver_w3c
|
122
99
|
result = compare_commands(@spec_commands, @webdriver_w3c_commands)
|
123
100
|
white_list.each { |v| result.delete v }
|
metadata
CHANGED
@@ -1,35 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appium_lib_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0.beta1
|
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-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: selenium-webdriver
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '3.14'
|
20
|
-
- - ">="
|
17
|
+
- - '='
|
21
18
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
19
|
+
version: 4.0.0.beta2
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '3.14'
|
30
|
-
- - ">="
|
24
|
+
- - '='
|
31
25
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
26
|
+
version: 4.0.0.beta2
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: faye-websocket
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -120,28 +114,28 @@ dependencies:
|
|
120
114
|
requirements:
|
121
115
|
- - "~>"
|
122
116
|
- !ruby/object:Gem::Version
|
123
|
-
version: 3.
|
117
|
+
version: 3.12.1
|
124
118
|
type: :development
|
125
119
|
prerelease: false
|
126
120
|
version_requirements: !ruby/object:Gem::Requirement
|
127
121
|
requirements:
|
128
122
|
- - "~>"
|
129
123
|
- !ruby/object:Gem::Version
|
130
|
-
version: 3.
|
124
|
+
version: 3.12.1
|
131
125
|
- !ruby/object:Gem::Dependency
|
132
126
|
name: rubocop
|
133
127
|
requirement: !ruby/object:Gem::Requirement
|
134
128
|
requirements:
|
135
129
|
- - '='
|
136
130
|
- !ruby/object:Gem::Version
|
137
|
-
version: 1.
|
131
|
+
version: 1.11.0
|
138
132
|
type: :development
|
139
133
|
prerelease: false
|
140
134
|
version_requirements: !ruby/object:Gem::Requirement
|
141
135
|
requirements:
|
142
136
|
- - '='
|
143
137
|
- !ruby/object:Gem::Version
|
144
|
-
version: 1.
|
138
|
+
version: 1.11.0
|
145
139
|
- !ruby/object:Gem::Dependency
|
146
140
|
name: appium_thor
|
147
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -221,6 +215,7 @@ extra_rdoc_files: []
|
|
221
215
|
files:
|
222
216
|
- ".github/ISSUE_TEMPLATE/issue-report.md"
|
223
217
|
- ".github/contributing.md"
|
218
|
+
- ".github/dependabot.yml"
|
224
219
|
- ".github/issue_template.md"
|
225
220
|
- ".github/workflows/unittest.yml"
|
226
221
|
- ".gitignore"
|
@@ -261,19 +256,20 @@ files:
|
|
261
256
|
- lib/appium_lib_core/common.rb
|
262
257
|
- lib/appium_lib_core/common/base.rb
|
263
258
|
- lib/appium_lib_core/common/base/bridge.rb
|
264
|
-
- lib/appium_lib_core/common/base/bridge/mjsonwp.rb
|
265
259
|
- lib/appium_lib_core/common/base/bridge/w3c.rb
|
266
260
|
- lib/appium_lib_core/common/base/capabilities.rb
|
267
261
|
- lib/appium_lib_core/common/base/command.rb
|
268
262
|
- lib/appium_lib_core/common/base/driver.rb
|
263
|
+
- lib/appium_lib_core/common/base/has_location.rb
|
264
|
+
- lib/appium_lib_core/common/base/has_network_connection.rb
|
269
265
|
- lib/appium_lib_core/common/base/http_default.rb
|
270
266
|
- lib/appium_lib_core/common/base/platform.rb
|
267
|
+
- lib/appium_lib_core/common/base/remote_status.rb
|
271
268
|
- lib/appium_lib_core/common/base/rotable.rb
|
272
269
|
- lib/appium_lib_core/common/base/screenshot.rb
|
273
270
|
- lib/appium_lib_core/common/base/search_context.rb
|
274
271
|
- lib/appium_lib_core/common/command.rb
|
275
272
|
- lib/appium_lib_core/common/command/common.rb
|
276
|
-
- lib/appium_lib_core/common/command/mjsonwp.rb
|
277
273
|
- lib/appium_lib_core/common/command/w3c.rb
|
278
274
|
- lib/appium_lib_core/common/device/app_management.rb
|
279
275
|
- lib/appium_lib_core/common/device/app_state.rb
|
@@ -339,12 +335,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
339
335
|
requirements:
|
340
336
|
- - ">="
|
341
337
|
- !ruby/object:Gem::Version
|
342
|
-
version: '2.
|
338
|
+
version: '2.5'
|
343
339
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
344
340
|
requirements:
|
345
|
-
- - "
|
341
|
+
- - ">"
|
346
342
|
- !ruby/object:Gem::Version
|
347
|
-
version:
|
343
|
+
version: 1.3.1
|
348
344
|
requirements: []
|
349
345
|
rubygems_version: 3.1.2
|
350
346
|
signing_key:
|
@@ -1,81 +0,0 @@
|
|
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
|
-
class Bridge
|
19
|
-
class MJSONWP < ::Selenium::WebDriver::Remote::OSS::Bridge
|
20
|
-
include Device::DeviceLock
|
21
|
-
include Device::Keyboard
|
22
|
-
include Device::ImeActions
|
23
|
-
include Device::Setting
|
24
|
-
include Device::Context
|
25
|
-
include Device::Value
|
26
|
-
include Device::FileManagement
|
27
|
-
include Device::KeyEvent
|
28
|
-
include Device::ImageComparison
|
29
|
-
include Device::AppManagement
|
30
|
-
include Device::AppState
|
31
|
-
include Device::ScreenRecord::Command
|
32
|
-
include Device::Device
|
33
|
-
include Device::TouchActions
|
34
|
-
include Device::ExecuteDriver
|
35
|
-
|
36
|
-
def commands(command)
|
37
|
-
::Appium::Core::Commands::MJSONWP::COMMANDS[command]
|
38
|
-
end
|
39
|
-
|
40
|
-
# Returns all available sessions on the Appium server instance
|
41
|
-
def sessions
|
42
|
-
execute :get_all_sessions
|
43
|
-
end
|
44
|
-
|
45
|
-
# For Appium
|
46
|
-
def log_event(vendor, event)
|
47
|
-
execute :post_log_event, {}, { vendor: vendor, event: event }
|
48
|
-
end
|
49
|
-
|
50
|
-
# For Appium
|
51
|
-
def log_events(type = nil)
|
52
|
-
args = {}
|
53
|
-
args['type'] = type unless type.nil?
|
54
|
-
|
55
|
-
execute :get_log_events, {}, args
|
56
|
-
end
|
57
|
-
|
58
|
-
def take_element_screenshot(element)
|
59
|
-
execute :take_element_screenshot, id: element.ref
|
60
|
-
end
|
61
|
-
|
62
|
-
def take_viewport_screenshot
|
63
|
-
# TODO: this hasn't been supported by Espresso driver
|
64
|
-
execute_script('mobile: viewportScreenshot')
|
65
|
-
end
|
66
|
-
|
67
|
-
def send_actions(_data)
|
68
|
-
raise Error::UnsupportedOperationError, '#send_actions has not been supported in MJSONWP'
|
69
|
-
end
|
70
|
-
|
71
|
-
# For Appium
|
72
|
-
# @param [Hash] id The id which can get as a response from server
|
73
|
-
# @return [::Selenium::WebDriver::Element]
|
74
|
-
def convert_to_element(id)
|
75
|
-
::Selenium::WebDriver::Element.new self, element_id_from(id)
|
76
|
-
end
|
77
|
-
end # class MJSONWP
|
78
|
-
end # class Bridge
|
79
|
-
end # class Base
|
80
|
-
end # module Core
|
81
|
-
end # module Appium
|