appium_lib_core 9.1.2 → 9.2.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/CHANGELOG.md +6 -1
- data/README.md +3 -1
- data/appium_lib_core.gemspec +1 -1
- data/lib/appium_lib_core/android/device/clipboard.rb +4 -2
- data/lib/appium_lib_core/android/device/emulator.rb +11 -5
- data/lib/appium_lib_core/android/device/screen.rb +3 -1
- data/lib/appium_lib_core/android/device.rb +3 -3
- data/lib/appium_lib_core/common/base/capabilities.rb +1 -1
- data/lib/appium_lib_core/common/base/screenshot.rb +2 -2
- data/lib/appium_lib_core/common/device/image_comparison.rb +15 -6
- data/lib/appium_lib_core/common/device/screen_record.rb +8 -2
- data/lib/appium_lib_core/common/error.rb +1 -0
- data/lib/appium_lib_core/driver.rb +5 -2
- data/lib/appium_lib_core/element.rb +1 -1
- data/lib/appium_lib_core/ios/device/clipboard.rb +4 -2
- data/lib/appium_lib_core/version.rb +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51fd1b5928d24942e7f5f944099c63728960f27cdab978cde119fe2ee68b0d73
|
4
|
+
data.tar.gz: 2d64236e6c3ed7501b260894e0fcbd58b16f6bf552e7f962c55331517e6d602b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e10e20452f9dcbfc61e96e2dc1545de62b3baf549d36d0a87383dbfec1a3de12ee5aabf2ecc956fbf279baf74fc0e151c8d87238effad36acda81420b81048e1
|
7
|
+
data.tar.gz: 10fc303ae86844b8be9eb778c7395832ffa65a6eee4786d1d0684f554016483a48d5ddf1e1c5be3735c681bbc81b84321a2bfbc880a864bf7d3c934831fc2682
|
data/CHANGELOG.md
CHANGED
@@ -10,7 +10,12 @@ Read `release_notes.md` for commit level details.
|
|
10
10
|
|
11
11
|
### Deprecations
|
12
12
|
|
13
|
-
## [9.
|
13
|
+
## [9.2.0] - 2024-07-21
|
14
|
+
### Enhancements
|
15
|
+
- Raise defined errors in this library instead of Ruby general errors in some places.
|
16
|
+
- Most of errors have already followed this method. This version has updated rest of them.
|
17
|
+
|
18
|
+
## [9.1.3., 9.1.2] - 2024-06-03
|
14
19
|
|
15
20
|
### Bug fixes
|
16
21
|
- Fix `server_url` usage in `core.start_driver` to respect the given value every time.
|
data/README.md
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
[](https://badge.fury.io/rb/appium_lib_core)
|
4
4
|
|
5
|
-
[](https://github.com/appium/ruby_lib_core/actions/workflows/unittest.yml)
|
6
|
+
[](https://github.com/appium/ruby_lib_core/actions/workflows/functional-test.yml)
|
7
|
+
|
6
8
|
|
7
9
|
This library is a Ruby client for Appium. The gem is available via [appium_lib_core](https://rubygems.org/gems/appium_lib_core).
|
8
10
|
|
data/appium_lib_core.gemspec
CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_development_dependency 'minitest-reporters', '~> 1.1'
|
30
30
|
spec.add_development_dependency 'parallel_tests'
|
31
31
|
spec.add_development_dependency 'rake', '~> 13.0'
|
32
|
-
spec.add_development_dependency 'rubocop', '1.
|
32
|
+
spec.add_development_dependency 'rubocop', '1.65.0'
|
33
33
|
spec.add_development_dependency 'simplecov'
|
34
34
|
spec.add_development_dependency 'webmock', '~> 3.23.0'
|
35
35
|
spec.add_development_dependency 'yard', '~> 0.9.11'
|
@@ -23,7 +23,8 @@ module Appium
|
|
23
23
|
::Appium::Core::Device.add_endpoint_method(:get_clipboard) do
|
24
24
|
def get_clipboard(content_type: :plaintext)
|
25
25
|
unless ::Appium::Core::Base::Device::Clipboard::CONTENT_TYPE.member?(content_type)
|
26
|
-
raise
|
26
|
+
raise ::Appium::Core::Error::ArgumentError,
|
27
|
+
"content_type should be #{::Appium::Core::Base::Device::Clipboard::CONTENT_TYPE}"
|
27
28
|
end
|
28
29
|
|
29
30
|
params = { contentType: content_type }
|
@@ -36,7 +37,8 @@ module Appium
|
|
36
37
|
::Appium::Core::Device.add_endpoint_method(:set_clipboard) do
|
37
38
|
def set_clipboard(content:, content_type: :plaintext, label: nil)
|
38
39
|
unless ::Appium::Core::Base::Device::Clipboard::CONTENT_TYPE.member?(content_type)
|
39
|
-
raise
|
40
|
+
raise ::Appium::Core::Error::ArgumentError,
|
41
|
+
"content_type should be #{::Appium::Core::Base::Device::Clipboard::CONTENT_TYPE}"
|
40
42
|
end
|
41
43
|
|
42
44
|
params = {
|
@@ -122,7 +122,7 @@ module Appium
|
|
122
122
|
::Appium::Core::Device.add_endpoint_method(:gsm_call) do
|
123
123
|
def gsm_call(phone_number:, action:)
|
124
124
|
unless GSM_CALL_ACTIONS.member? action.to_sym
|
125
|
-
raise "action: should be member of #{GSM_CALL_ACTIONS}. Not #{action}."
|
125
|
+
raise ::Appium::Core::Error::ArgumentError, "action: should be member of #{GSM_CALL_ACTIONS}. Not #{action}."
|
126
126
|
end
|
127
127
|
|
128
128
|
execute(:gsm_call, {}, { phoneNumber: phone_number, action: action })
|
@@ -131,7 +131,10 @@ module Appium
|
|
131
131
|
|
132
132
|
::Appium::Core::Device.add_endpoint_method(:gsm_signal) do
|
133
133
|
def gsm_signal(signal_strength)
|
134
|
-
|
134
|
+
if GSM_SIGNALS[signal_strength.to_sym].nil?
|
135
|
+
raise ::Appium::Core::Error::ArgumentError,
|
136
|
+
"#{signal_strength} should be member of #{GSM_SIGNALS.keys} "
|
137
|
+
end
|
135
138
|
|
136
139
|
execute(:gsm_signal, {}, { signalStrength: GSM_SIGNALS[signal_strength],
|
137
140
|
signalStrengh: GSM_SIGNALS[signal_strength] })
|
@@ -141,7 +144,7 @@ module Appium
|
|
141
144
|
::Appium::Core::Device.add_endpoint_method(:gsm_voice) do
|
142
145
|
def gsm_voice(state)
|
143
146
|
unless GSM_VOICE_STATES.member? state.to_sym
|
144
|
-
raise "The state should be member of #{GSM_VOICE_STATES}. Not #{state}."
|
147
|
+
raise ::Appium::Core::Error::ArgumentError, "The state should be member of #{GSM_VOICE_STATES}. Not #{state}."
|
145
148
|
end
|
146
149
|
|
147
150
|
execute(:gsm_voice, {}, { state: state })
|
@@ -150,7 +153,10 @@ module Appium
|
|
150
153
|
|
151
154
|
::Appium::Core::Device.add_endpoint_method(:set_network_speed) do
|
152
155
|
def set_network_speed(netspeed)
|
153
|
-
|
156
|
+
unless NET_SPEED.member? netspeed.to_sym
|
157
|
+
raise ::Appium::Core::Error::ArgumentError,
|
158
|
+
"The netspeed should be member of #{NET_SPEED}. Not #{netspeed}."
|
159
|
+
end
|
154
160
|
|
155
161
|
execute(:set_network_speed, {}, { netspeed: netspeed })
|
156
162
|
end
|
@@ -169,7 +175,7 @@ module Appium
|
|
169
175
|
::Appium::Core::Device.add_endpoint_method(:set_power_ac) do
|
170
176
|
def set_power_ac(state)
|
171
177
|
unless POWER_AC_STATE.member? state.to_sym
|
172
|
-
raise "The state should be member of #{POWER_AC_STATE}. Not #{state}."
|
178
|
+
raise ::Appium::Core::Error::ArgumentError, "The state should be member of #{POWER_AC_STATE}. Not #{state}."
|
173
179
|
end
|
174
180
|
|
175
181
|
execute(:set_power_ac, {}, { state: state })
|
@@ -41,7 +41,9 @@ module Appium
|
|
41
41
|
option[:bitRate] = bit_rate unless bit_rate.nil?
|
42
42
|
|
43
43
|
unless bug_report.nil?
|
44
|
-
|
44
|
+
unless [true, false].member?(bug_report)
|
45
|
+
raise ::Appium::Core::Error::ArgumentError, 'bug_report should be true or false'
|
46
|
+
end
|
45
47
|
|
46
48
|
option[:bugReport] = bug_report
|
47
49
|
end
|
@@ -417,15 +417,15 @@ module Appium
|
|
417
417
|
def start_activity(opts)
|
418
418
|
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: startActivity' extension instead"
|
419
419
|
|
420
|
-
raise 'opts must be a hash' unless opts.is_a? Hash
|
420
|
+
raise ::Appium::Core::Error::ArgumentError, 'opts must be a hash' unless opts.is_a? Hash
|
421
421
|
|
422
422
|
option = {}
|
423
423
|
|
424
424
|
app_package = opts[:app_package]
|
425
|
-
raise 'app_package is required' unless app_package
|
425
|
+
raise ::Appium::Core::Error::ArgumentError, 'app_package is required' unless app_package
|
426
426
|
|
427
427
|
app_activity = opts[:app_activity]
|
428
|
-
raise 'app_activity is required' unless app_activity
|
428
|
+
raise ::Appium::Core::Error::ArgumentError, 'app_activity is required' unless app_activity
|
429
429
|
|
430
430
|
option[:appPackage] = app_package
|
431
431
|
option[:appActivity] = app_activity
|
@@ -34,7 +34,7 @@ module Appium
|
|
34
34
|
# here do not convert to camel case
|
35
35
|
key.to_s
|
36
36
|
else
|
37
|
-
raise
|
37
|
+
raise ::Appium::Core::Error::ArgumentError, "expected String or Symbol, got #{key.inspect}:#{key.class}"
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
@@ -48,7 +48,7 @@ module Appium
|
|
48
48
|
when :png
|
49
49
|
bridge.screenshot.unpack('m')[0]
|
50
50
|
else
|
51
|
-
raise Core::Error::UnsupportedOperationError, "unsupported format: #{format.inspect}"
|
51
|
+
raise ::Appium::Core::Error::UnsupportedOperationError, "unsupported format: #{format.inspect}"
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -88,7 +88,7 @@ module Appium
|
|
88
88
|
when :png
|
89
89
|
bridge.element_screenshot(element.id).unpack('m')[0]
|
90
90
|
else
|
91
|
-
raise Core::Error::UnsupportedOperationError, "unsupported format: #{format.inspect}"
|
91
|
+
raise ::Appium::Core::Error::UnsupportedOperationError, "unsupported format: #{format.inspect}"
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
@@ -65,14 +65,17 @@ module Appium
|
|
65
65
|
good_matches_factor: nil,
|
66
66
|
visualize: false)
|
67
67
|
unless MATCH_FEATURES[:detector_name].member?(detector_name.to_s)
|
68
|
-
raise "detector_name should be #{MATCH_FEATURES[:detector_name]}"
|
68
|
+
raise ::Appium::Core::Error::ArgumentError, "detector_name should be #{MATCH_FEATURES[:detector_name]}"
|
69
69
|
end
|
70
70
|
|
71
71
|
unless MATCH_FEATURES[:match_func].member?(match_func.to_s)
|
72
|
-
raise "match_func should be #{MATCH_FEATURES[:match_func]}"
|
72
|
+
raise ::Appium::Core::Error::ArgumentError, "match_func should be #{MATCH_FEATURES[:match_func]}"
|
73
73
|
end
|
74
74
|
|
75
|
-
|
75
|
+
unless MATCH_FEATURES[:visualize].member?(visualize)
|
76
|
+
raise ::Appium::Core::Error::ArgumentError,
|
77
|
+
"visualize should be #{MATCH_FEATURES[:visualize]}"
|
78
|
+
end
|
76
79
|
|
77
80
|
options = {}
|
78
81
|
options[:detectorName] = detector_name.to_s.upcase
|
@@ -109,7 +112,10 @@ module Appium
|
|
109
112
|
#
|
110
113
|
def find_image_occurrence(full_image:, partial_image:, visualize: false, threshold: nil,
|
111
114
|
multiple: nil, match_neighbour_threshold: nil)
|
112
|
-
|
115
|
+
unless MATCH_TEMPLATE[:visualize].member?(visualize)
|
116
|
+
raise ::Appium::Core::Error::ArgumentError,
|
117
|
+
"visualize should be #{MATCH_TEMPLATE[:visualize]}"
|
118
|
+
end
|
113
119
|
|
114
120
|
options = {}
|
115
121
|
options[:visualize] = visualize
|
@@ -136,7 +142,10 @@ module Appium
|
|
136
142
|
# File.write 'images_similarity_visual.png', Base64.decode64(visual['visualization']) # if the image is PNG
|
137
143
|
#
|
138
144
|
def get_images_similarity(first_image:, second_image:, visualize: false)
|
139
|
-
|
145
|
+
unless GET_SIMILARITY[:visualize].member?(visualize)
|
146
|
+
raise ::Appium::Core::Error::ArgumentError,
|
147
|
+
"visualize should be #{GET_SIMILARITY[:visualize]}"
|
148
|
+
end
|
140
149
|
|
141
150
|
options = {}
|
142
151
|
options[:visualize] = visualize
|
@@ -158,7 +167,7 @@ module Appium
|
|
158
167
|
# See the documentation on +appium-support+ module for more details.
|
159
168
|
#
|
160
169
|
def compare_images(mode: :matchFeatures, first_image:, second_image:, options: nil)
|
161
|
-
raise "content_type should be #{MODE}" unless MODE.member?(mode)
|
170
|
+
raise ::Appium::Core::Error::ArgumentError, "content_type should be #{MODE}" unless MODE.member?(mode)
|
162
171
|
|
163
172
|
params = {}
|
164
173
|
params[:mode] = mode
|
@@ -30,7 +30,10 @@ module Appium
|
|
30
30
|
@upload_option = if remote_path.nil?
|
31
31
|
{}
|
32
32
|
else
|
33
|
-
|
33
|
+
unless METHOD.member?(method.to_s.upcase)
|
34
|
+
raise ::Appium::Core::Error::ArgumentError,
|
35
|
+
'method should be POST or PUT'
|
36
|
+
end
|
34
37
|
|
35
38
|
option = {}
|
36
39
|
option[:remotePath] = remote_path
|
@@ -45,7 +48,10 @@ module Appium
|
|
45
48
|
|
46
49
|
return if force_restart.nil?
|
47
50
|
|
48
|
-
|
51
|
+
unless [true, false].member?(force_restart)
|
52
|
+
raise ::Appium::Core::Error::ArgumentError,
|
53
|
+
'force_restart should be true or false'
|
54
|
+
end
|
49
55
|
|
50
56
|
@upload_option[:forceRestart] = force_restart
|
51
57
|
end
|
@@ -394,7 +394,9 @@ module Appium
|
|
394
394
|
|
395
395
|
def start_driver(server_url: nil,
|
396
396
|
http_client_ops: { http_client: nil, open_timeout: 999_999, read_timeout: 999_999 })
|
397
|
-
|
397
|
+
|
398
|
+
@custom_url ||= "http://127.0.0.1:#{@port}/wd/hub"
|
399
|
+
@custom_url = server_url unless server_url.nil?
|
398
400
|
|
399
401
|
@http_client = get_http_client http_client: http_client_ops.delete(:http_client),
|
400
402
|
open_timeout: http_client_ops.delete(:open_timeout),
|
@@ -473,7 +475,8 @@ module Appium
|
|
473
475
|
automation_name: automation_name,
|
474
476
|
platform_name: platform_name)
|
475
477
|
rescue Errno::ECONNREFUSED
|
476
|
-
raise
|
478
|
+
raise ::Appium::Core::Error::SessionNotCreatedError,
|
479
|
+
"ERROR: Unable to connect to Appium. Is the server running on #{@custom_url}?"
|
477
480
|
end
|
478
481
|
|
479
482
|
@driver
|
@@ -117,7 +117,7 @@ module Appium
|
|
117
117
|
when :png
|
118
118
|
bridge.element_screenshot(@id).unpack('m')[0]
|
119
119
|
else
|
120
|
-
raise Core::Error::UnsupportedOperationError, "unsupported format: #{format.inspect}"
|
120
|
+
raise ::Appium::Core::Error::UnsupportedOperationError, "unsupported format: #{format.inspect}"
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
@@ -23,7 +23,8 @@ module Appium
|
|
23
23
|
::Appium::Core::Device.add_endpoint_method(:get_clipboard) do
|
24
24
|
def get_clipboard(content_type: :plaintext)
|
25
25
|
unless ::Appium::Core::Base::Device::Clipboard::CONTENT_TYPE.member?(content_type)
|
26
|
-
raise
|
26
|
+
raise ::Appium::Core::Error::ArgumentError,
|
27
|
+
"content_type should be #{::Appium::Core::Base::Device::Clipboard::CONTENT_TYPE}"
|
27
28
|
end
|
28
29
|
|
29
30
|
params = { contentType: content_type }
|
@@ -36,7 +37,8 @@ module Appium
|
|
36
37
|
::Appium::Core::Device.add_endpoint_method(:set_clipboard) do
|
37
38
|
def set_clipboard(content:, content_type: :plaintext)
|
38
39
|
unless ::Appium::Core::Base::Device::Clipboard::CONTENT_TYPE.member?(content_type)
|
39
|
-
raise
|
40
|
+
raise ::Appium::Core::Error::ArgumentError,
|
41
|
+
"content_type should be #{::Appium::Core::Base::Device::Clipboard::CONTENT_TYPE}"
|
40
42
|
end
|
41
43
|
|
42
44
|
params = {
|
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
module Appium
|
16
16
|
module Core
|
17
|
-
VERSION = '9.
|
18
|
-
DATE = '2024-
|
17
|
+
VERSION = '9.2.0' unless defined? ::Appium::Core::VERSION
|
18
|
+
DATE = '2024-07-21' unless defined? ::Appium::Core::DATE
|
19
19
|
end
|
20
20
|
end
|
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: 9.
|
4
|
+
version: 9.2.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: 2024-
|
11
|
+
date: 2024-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faye-websocket
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - '='
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 1.
|
117
|
+
version: 1.65.0
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - '='
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 1.
|
124
|
+
version: 1.65.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: simplecov
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|