appium_lib_core 5.0.0.beta4 → 5.0.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -3
- data/Rakefile +4 -0
- data/appium_lib_core.gemspec +3 -3
- data/ci-jobs/functional_test.yml +1 -1
- data/docs/mobile_command.md +2 -2
- data/lib/appium_lib_core/common/base/bridge.rb +31 -17
- data/lib/appium_lib_core/common/base/capabilities.rb +7 -0
- data/lib/appium_lib_core/common/base/driver.rb +14 -62
- data/lib/appium_lib_core/common/base/has_location.rb +11 -4
- data/lib/appium_lib_core/common/base/screenshot.rb +3 -3
- data/lib/appium_lib_core/common/device/value.rb +4 -4
- data/lib/appium_lib_core/common/touch_action/touch_actions.rb +1 -1
- data/lib/appium_lib_core/driver.rb +10 -33
- data/lib/appium_lib_core/element.rb +16 -7
- data/lib/appium_lib_core/version.rb +2 -2
- data/release_notes.md +9 -0
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9d42fc1cfc7efb703d6e7167fc465618d4991491d19f1e8c2d9f3c929206efc
|
4
|
+
data.tar.gz: eeec123ea6356e9a3446ac1c17dd18e234b8ea2a8c5bb0a7d40b31685e7e28b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c9f68c96d74c47ee00c86bfd858ffdc7460b33534405a4033c33bb8166ecaa3f380093b436bf0a49de2b7f2b3cf1ef1d18ef393898f294e7cea694cdc6b3580
|
7
|
+
data.tar.gz: ba381f9b52b595e6e25569300803dbb55de0ce076132ca0db5903321554dd8ca2c6bb4ad9caf8a89e7b1e936aa3e34b7174f80f0315ddfa1f4732a84932c0502
|
data/CHANGELOG.md
CHANGED
@@ -5,17 +5,28 @@ Read `release_notes.md` for commit level details.
|
|
5
5
|
## [Unreleased]
|
6
6
|
|
7
7
|
### Enhancements
|
8
|
+
- Allow to override an existing method by `Appium::Core::Base::Driver#add_command` since Appium drivers/plugins allow to override them
|
8
9
|
|
9
10
|
### Bug fixes
|
10
11
|
|
11
12
|
### Deprecations
|
12
13
|
|
13
|
-
## [5.0.0
|
14
|
+
## [5.0.0]
|
14
15
|
|
15
|
-
- Update base selenium webdriver version to `4.0.0
|
16
|
+
- Update base selenium webdriver version to `4.0.0`
|
16
17
|
- Support only W3C spec
|
17
18
|
- Support Ruby 2.5+
|
18
19
|
- Raises `::Appium::Core::Error::ArgumentError` instead of `ArgumentError` for this library specific argument errors
|
20
|
+
- Removed `desired_capabilities` from capabilities. Please use `capabilities` key name instead.
|
21
|
+
- `element.id` returns the element id instead of `element.ref`
|
22
|
+
- Removed `driver#screenshot`. Please use `driver#save_screenshot` instead.
|
23
|
+
- Remove `driver#send_keys` to send keys to an active element. Please use `driver.action.send_keys('happy testing').perform` instead.
|
24
|
+
- No longer set default `timeouts` as `0`. ruby_lib_core calls `/timeouts` endpoint only when `appium_lib: { wait: 5 }` is provided explicitly.
|
25
|
+
|
26
|
+
## [4.7.0] - 2021-07-17
|
27
|
+
|
28
|
+
### Enhancements
|
29
|
+
- Add `satellites` option in `Appium::Core::Base::Driver#set_location`
|
19
30
|
|
20
31
|
## [4.6.0] - 2021-06-03
|
21
32
|
|
@@ -25,7 +36,7 @@ Read `release_notes.md` for commit level details.
|
|
25
36
|
## [4.5.0] - 2021-03-14
|
26
37
|
|
27
38
|
### Enhancements
|
28
|
-
- Add `speed` argument for `Appium::Core::Base::Driver#set_location` since Appium 1.21.0
|
39
|
+
- Add `speed` argument for `Appium::Core::Base::Driver#set_location` since Appium 1.21.0
|
29
40
|
- Add `multiple` and `match_neighbour_threshold` arguments for `Appium::Core::Base::Driver#find_image_occurrence`
|
30
41
|
|
31
42
|
## [4.4.1(4.4.0)] - 2021-02-15(2021-02-13)
|
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']
|
data/appium_lib_core.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ['lib']
|
24
24
|
|
25
|
-
spec.add_runtime_dependency 'selenium-webdriver', '4.0.0
|
25
|
+
spec.add_runtime_dependency 'selenium-webdriver', '~> 4.0.0'
|
26
26
|
spec.add_runtime_dependency 'faye-websocket', '~> 0.11.0'
|
27
27
|
|
28
28
|
spec.add_development_dependency 'bundler', '>= 1.14'
|
@@ -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.12.
|
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'
|
data/ci-jobs/functional_test.yml
CHANGED
@@ -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
|
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
|
data/docs/mobile_command.md
CHANGED
@@ -9,7 +9,7 @@ We can invoke them via `execute_script` command with `mobile:` arguments.
|
|
9
9
|
- https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android
|
10
10
|
- iOS:
|
11
11
|
- https://github.com/appium/appium/tree/master/docs/en/writing-running-appium/ios
|
12
|
-
|
12
|
+
|
13
13
|
|
14
14
|
```ruby
|
15
15
|
# Android shell : https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/android-shell.md
|
@@ -28,7 +28,7 @@ To handle it, we would recommend you to handle the error based on the error mess
|
|
28
28
|
|
29
29
|
```ruby
|
30
30
|
error = assert_raises ::Selenium::WebDriver::Error::UnknownError do
|
31
|
-
@driver.execute_script 'mobile: scrollToPage', { element: el.
|
31
|
+
@driver.execute_script 'mobile: scrollToPage', { element: el.id, scrollToPage: -100 }
|
32
32
|
end
|
33
33
|
assert error.message.include? 'be a non-negative integer'
|
34
34
|
```
|
@@ -53,7 +53,7 @@ module Appium
|
|
53
53
|
# Override
|
54
54
|
# Creates session handling both OSS and W3C dialects.
|
55
55
|
#
|
56
|
-
# @param [::Selenium::WebDriver::Remote::Capabilities, Hash]
|
56
|
+
# @param [::Selenium::WebDriver::Remote::Capabilities, Hash] capabilities A capability
|
57
57
|
# @return [::Selenium::WebDriver::Remote::Capabilities]
|
58
58
|
#
|
59
59
|
# @example
|
@@ -78,7 +78,7 @@ module Appium
|
|
78
78
|
@available_commands = ::Appium::Core::Commands::COMMANDS.dup
|
79
79
|
|
80
80
|
caps = add_appium_prefix(capabilities)
|
81
|
-
response = execute(:new_session, {}, { capabilities: { firstMatch: [
|
81
|
+
response = execute(:new_session, {}, { capabilities: { alwaysMatch: caps, firstMatch: [] } })
|
82
82
|
|
83
83
|
@session_id = response['sessionId']
|
84
84
|
raise ::Selenium::WebDriver::Error::WebDriverError, 'no sessionId in returned payload' unless @session_id
|
@@ -133,7 +133,7 @@ module Appium
|
|
133
133
|
|
134
134
|
# command for Appium 2.0.
|
135
135
|
def add_command(method:, url:, name:, &block)
|
136
|
-
|
136
|
+
::Appium::Logger.info "Overriding the method '#{name}' for '#{url}'" if @available_commands.key? name
|
137
137
|
|
138
138
|
@available_commands[name] = [method, url]
|
139
139
|
|
@@ -207,7 +207,7 @@ module Appium
|
|
207
207
|
# For W3C
|
208
208
|
# https://github.com/SeleniumHQ/selenium/commit/b618499adcc3a9f667590652c5757c0caa703289
|
209
209
|
# execute_atom :isDisplayed, element
|
210
|
-
execute :is_element_displayed, id: element.
|
210
|
+
execute :is_element_displayed, id: element.id
|
211
211
|
end
|
212
212
|
|
213
213
|
# For Appium
|
@@ -215,7 +215,7 @@ module Appium
|
|
215
215
|
def element_attribute(element, name)
|
216
216
|
# For W3C in Selenium Client
|
217
217
|
# execute_atom :getAttribute, element, name
|
218
|
-
execute :get_element_attribute, id: element.
|
218
|
+
execute :get_element_attribute, id: element.id, name: name
|
219
219
|
end
|
220
220
|
|
221
221
|
# For Appium
|
@@ -227,26 +227,39 @@ module Appium
|
|
227
227
|
|
228
228
|
# For Appium
|
229
229
|
# override
|
230
|
-
def find_element_by(how, what,
|
230
|
+
def find_element_by(how, what, parent_ref = [])
|
231
231
|
how, what = convert_locator(how, what)
|
232
232
|
|
233
|
-
|
234
|
-
|
233
|
+
return execute_atom(:findElements, Support::RelativeLocator.new(what).as_json).first if how == 'relative'
|
234
|
+
|
235
|
+
parent_type, parent_id = parent_ref
|
236
|
+
id = case parent_type
|
237
|
+
when :element
|
238
|
+
execute :find_child_element, { id: parent_id }, { using: how, value: what.to_s }
|
239
|
+
when :shadow_root
|
240
|
+
execute :find_shadow_child_element, { id: parent_id }, { using: how, value: what.to_s }
|
235
241
|
else
|
236
|
-
execute :find_element, {}, { using: how, value: what }
|
242
|
+
execute :find_element, {}, { using: how, value: what.to_s }
|
237
243
|
end
|
244
|
+
|
238
245
|
::Appium::Core::Element.new self, element_id_from(id)
|
239
246
|
end
|
240
247
|
|
241
248
|
# For Appium
|
242
249
|
# override
|
243
|
-
def find_elements_by(how, what,
|
250
|
+
def find_elements_by(how, what, parent_ref = [])
|
244
251
|
how, what = convert_locator(how, what)
|
245
252
|
|
246
|
-
|
247
|
-
|
253
|
+
return execute_atom :findElements, Support::RelativeLocator.new(what).as_json if how == 'relative'
|
254
|
+
|
255
|
+
parent_type, parent_id = parent_ref
|
256
|
+
ids = case parent_type
|
257
|
+
when :element
|
258
|
+
execute :find_child_elements, { id: parent_id }, { using: how, value: what.to_s }
|
259
|
+
when :shadow_root
|
260
|
+
execute :find_shadow_child_elements, { id: parent_id }, { using: how, value: what.to_s }
|
248
261
|
else
|
249
|
-
execute :find_elements, {}, { using: how, value: what }
|
262
|
+
execute :find_elements, {}, { using: how, value: what.to_s }
|
250
263
|
end
|
251
264
|
|
252
265
|
ids.map { |id| ::Appium::Core::Element.new self, element_id_from(id) }
|
@@ -283,9 +296,10 @@ module Appium
|
|
283
296
|
|
284
297
|
# For Appium
|
285
298
|
# No implementation for W3C webdriver module
|
286
|
-
def set_location(lat, lon, alt = 0.0, speed: nil)
|
299
|
+
def set_location(lat, lon, alt = 0.0, speed: nil, satellites: nil)
|
287
300
|
loc = { latitude: lat, longitude: lon, altitude: alt }
|
288
301
|
loc[:speed] = speed unless speed.nil?
|
302
|
+
loc[:satellites] = satellites unless satellites.nil?
|
289
303
|
execute :set_location, {}, { location: loc }
|
290
304
|
end
|
291
305
|
|
@@ -326,12 +340,12 @@ module Appium
|
|
326
340
|
execute :get_log_events, {}, args
|
327
341
|
end
|
328
342
|
|
329
|
-
def
|
343
|
+
def viewport_screenshot
|
330
344
|
execute_script('mobile: viewportScreenshot')
|
331
345
|
end
|
332
346
|
|
333
|
-
def
|
334
|
-
execute :take_element_screenshot, id:
|
347
|
+
def element_screenshot(element_id)
|
348
|
+
execute :take_element_screenshot, id: element_id
|
335
349
|
end
|
336
350
|
|
337
351
|
private
|
@@ -22,6 +22,13 @@ module Appium
|
|
22
22
|
# @return [::Selenium::WebDriver::Remote::Capabilities] Return instance of Appium::Core::Base::Capabilities
|
23
23
|
# inherited ::Selenium::WebDriver::Remote::Capabilities
|
24
24
|
def self.create_capabilities(opts_caps = {})
|
25
|
+
# TODO: Move to 'Options' way instead of 'Capabilities'.
|
26
|
+
# Selenium 5 will have Options instead of 'Capabilities'.
|
27
|
+
# https://github.com/SeleniumHQ/selenium/blob/trunk/rb/lib/selenium/webdriver/common/options.rb
|
28
|
+
# Then, Ruby client also shoud move to the Options way.
|
29
|
+
# Appium's capabilities could change by depending on Appium versions. So it does not have
|
30
|
+
# standard options like chrome and firefox etc. So, the implementation should differ from
|
31
|
+
# other browsers. But here should inherit `Options` to follow Selenium.
|
25
32
|
::Selenium::WebDriver::Remote::Capabilities.new(opts_caps)
|
26
33
|
end
|
27
34
|
end
|
@@ -57,25 +57,7 @@ module Appium
|
|
57
57
|
# @return [::Appium::Core::Base::Bridge]
|
58
58
|
#
|
59
59
|
def create_bridge(**opts)
|
60
|
-
|
61
|
-
opts[:url] ||= service_url(opts)
|
62
|
-
caps = opts.delete(:capabilities)
|
63
|
-
# NOTE: This is deprecated
|
64
|
-
cap_array = caps.is_a?(Hash) ? [caps] : Array(caps)
|
65
|
-
|
66
|
-
desired_capabilities = opts.delete(:desired_capabilities)
|
67
|
-
if desired_capabilities
|
68
|
-
if desired_capabilities.is_a?(Hash)
|
69
|
-
desired_capabilities = ::Selenium::WebDriver::Remote::Capabilities(desired_capabilities)
|
70
|
-
end
|
71
|
-
cap_array << desired_capabilities
|
72
|
-
end
|
73
|
-
|
74
|
-
options = opts.delete(:options)
|
75
|
-
cap_array << options if options
|
76
|
-
|
77
|
-
capabilities = generate_capabilities(cap_array)
|
78
|
-
|
60
|
+
capabilities = opts.delete(:capabilities)
|
79
61
|
bridge_opts = { http_client: opts.delete(:http_client), url: opts.delete(:url) }
|
80
62
|
raise ::Appium::Core::Error::ArgumentError, "Unable to create a driver with parameters: #{opts}" unless opts.empty?
|
81
63
|
|
@@ -125,8 +107,17 @@ module Appium
|
|
125
107
|
# Other place holders can be specified with +:+ prefix like +:id+.
|
126
108
|
# Then, the +:id+ will be replaced with a given value as the seconds argument of +execute+
|
127
109
|
# @param [Symbol] name The name of method that is called as the driver instance method.
|
128
|
-
# @param [Proc] block The block to involve as the method
|
129
|
-
#
|
110
|
+
# @param [Proc] block The block to involve as the method.
|
111
|
+
# Please define a method that has the same +name+ with arguments you want.
|
112
|
+
# The method must has +execute+ method. tHe +execute+ is calls the +url+
|
113
|
+
# with the given parameters.
|
114
|
+
# The first argument should be +name+ as symbol.
|
115
|
+
# The second argument should be hash. If keys in the hash matches +:+ prefix
|
116
|
+
# string in the given url, the matched string in the given url will be
|
117
|
+
# values in the hash.
|
118
|
+
# The third argument should be hash. The hash will be the request body.
|
119
|
+
# Please read examples below for more details.
|
120
|
+
# @raise [ArgumentError] If the given +method+ is invalid value.
|
130
121
|
#
|
131
122
|
# @example
|
132
123
|
#
|
@@ -153,6 +144,7 @@ module Appium
|
|
153
144
|
# # ':session_id' in the given 'url' is replaced with current 'session id'.
|
154
145
|
# @driver.test_command(1)
|
155
146
|
#
|
147
|
+
#
|
156
148
|
# @driver.add_command(
|
157
149
|
# method: :post,
|
158
150
|
# url: 'session/:session_id/element/:id/custom/action',
|
@@ -167,7 +159,7 @@ module Appium
|
|
167
159
|
# # ':session_id' in the given url is replaced with current 'session id'.
|
168
160
|
# # ':id' in the given url is replaced with the given 'element_id'.
|
169
161
|
# e = @driver.find_element :accessibility_id, 'an element'
|
170
|
-
# @driver.test_action_command(e.
|
162
|
+
# @driver.test_action_command(e.id, 'action')
|
171
163
|
#
|
172
164
|
def add_command(method:, url:, name:, &block)
|
173
165
|
unless AVAILABLE_METHODS.include? method
|
@@ -246,22 +238,6 @@ module Appium
|
|
246
238
|
end
|
247
239
|
alias is_keyboard_shown keyboard_shown?
|
248
240
|
|
249
|
-
# [DEPRECATION]
|
250
|
-
# Send keys for a current active element
|
251
|
-
# @param [String] key Input text
|
252
|
-
#
|
253
|
-
# @example
|
254
|
-
#
|
255
|
-
# @driver.send_keys 'happy testing!'
|
256
|
-
#
|
257
|
-
def send_keys(*key)
|
258
|
-
::Appium::Logger.warn(
|
259
|
-
'[DEPRECATION] Driver#send_keys is deprecated in W3C spec. Use driver.action.<command>.perform instead'
|
260
|
-
)
|
261
|
-
@bridge.send_keys_to_active_element(key)
|
262
|
-
end
|
263
|
-
alias type send_keys
|
264
|
-
|
265
241
|
# Returns an instance of DriverSettings to call get/update.
|
266
242
|
#
|
267
243
|
# @example
|
@@ -434,30 +410,6 @@ module Appium
|
|
434
410
|
end
|
435
411
|
alias set_context context=
|
436
412
|
|
437
|
-
# Set the value to element directly
|
438
|
-
#
|
439
|
-
# @example
|
440
|
-
#
|
441
|
-
# @driver.set_immediate_value element, 'hello'
|
442
|
-
#
|
443
|
-
def set_immediate_value(element, *value)
|
444
|
-
::Appium::Logger.warn '[DEPRECATION] driver#set_immediate_value(element, *value) is deprecated. ' \
|
445
|
-
'Use Element#immediate_value(*value) instead'
|
446
|
-
@bridge.set_immediate_value(element, *value)
|
447
|
-
end
|
448
|
-
|
449
|
-
# Replace the value to element directly
|
450
|
-
#
|
451
|
-
# @example
|
452
|
-
#
|
453
|
-
# @driver.replace_value element, 'hello'
|
454
|
-
#
|
455
|
-
def replace_value(element, *value)
|
456
|
-
::Appium::Logger.warn '[DEPRECATION] driver#replace_value(element, *value) is deprecated. ' \
|
457
|
-
'Use Element#replace_value(*value) instead'
|
458
|
-
@bridge.replace_value(element, *value)
|
459
|
-
end
|
460
|
-
|
461
413
|
# Place a file in a specific location on the device.
|
462
414
|
# On iOS, the server should have ifuse libraries installed and configured properly for this feature to work on
|
463
415
|
# real devices.
|
@@ -52,19 +52,26 @@ module Appium
|
|
52
52
|
# @param [String, Number] latitude Set the latitude.
|
53
53
|
# @param [String, Number] longitude Set the longitude.
|
54
54
|
# @param [String, Number] altitude Set the altitude.
|
55
|
-
# @param [String, Number] speed Set the speed to apply the location on Android real devices
|
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.
|
56
59
|
# @param [::Selenium::WebDriver::Location]
|
57
60
|
#
|
58
61
|
# @example
|
59
62
|
#
|
60
63
|
# driver.location = ::Selenium::WebDriver::Location.new(10, 10, 10)
|
61
64
|
#
|
62
|
-
def set_location(latitude, longitude, altitude, speed: nil)
|
63
|
-
if speed.nil?
|
65
|
+
def set_location(latitude, longitude, altitude, speed: nil, satellites: nil)
|
66
|
+
if speed.nil? && satellites.nil?
|
64
67
|
self.location = ::Selenium::WebDriver::Location.new(Float(latitude), Float(longitude), Float(altitude))
|
65
68
|
else
|
66
69
|
loc = ::Selenium::WebDriver::Location.new(Float(latitude), Float(longitude), Float(altitude))
|
67
|
-
|
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
|
68
75
|
end
|
69
76
|
end
|
70
77
|
end
|
@@ -84,9 +84,9 @@ module Appium
|
|
84
84
|
def element_screenshot_as(element, format)
|
85
85
|
case format
|
86
86
|
when :base64
|
87
|
-
bridge.
|
87
|
+
bridge.element_screenshot element.id
|
88
88
|
when :png
|
89
|
-
bridge.
|
89
|
+
bridge.element_screenshot(element.id).unpack('m')[0]
|
90
90
|
else
|
91
91
|
raise Core::Error::UnsupportedOperationError, "unsupported format: #{format.inspect}"
|
92
92
|
end
|
@@ -106,7 +106,7 @@ module Appium
|
|
106
106
|
::Appium::Logger.warn 'name used for saved screenshot does not match file type. '\
|
107
107
|
'It should end with .png extension'
|
108
108
|
end
|
109
|
-
viewport_screenshot_encode64 = bridge.
|
109
|
+
viewport_screenshot_encode64 = bridge.viewport_screenshot
|
110
110
|
File.open(png_path, 'wb') { |f| f << viewport_screenshot_encode64.unpack('m')[0] }
|
111
111
|
end
|
112
112
|
end
|
@@ -17,12 +17,12 @@ module Appium
|
|
17
17
|
class Base
|
18
18
|
module Device
|
19
19
|
module Value
|
20
|
-
def set_immediate_value(
|
21
|
-
execute :set_immediate_value, { id:
|
20
|
+
def set_immediate_value(element_id, *value)
|
21
|
+
execute :set_immediate_value, { id: element_id }, generate_value_and_text(value)
|
22
22
|
end
|
23
23
|
|
24
|
-
def replace_value(
|
25
|
-
execute :replace_value, { id:
|
24
|
+
def replace_value(element_id, *value)
|
25
|
+
execute :replace_value, { id: element_id }, generate_value_and_text(value)
|
26
26
|
end
|
27
27
|
|
28
28
|
private
|
@@ -40,7 +40,7 @@ module Appium
|
|
40
40
|
|
41
41
|
def initialize(appium_lib_opts)
|
42
42
|
@custom_url = appium_lib_opts.fetch :server_url, nil
|
43
|
-
@default_wait = appium_lib_opts.fetch :wait,
|
43
|
+
@default_wait = appium_lib_opts.fetch :wait, nil
|
44
44
|
@enable_idempotency_header = appium_lib_opts.fetch :enable_idempotency_header, true
|
45
45
|
|
46
46
|
# bump current session id into a particular file
|
@@ -135,11 +135,9 @@ module Appium
|
|
135
135
|
attr_reader :export_session_path
|
136
136
|
|
137
137
|
# Default wait time for elements to appear in Appium server side.
|
138
|
-
# Defaults to {::Appium::Core::Driver::DEFAULT_IMPLICIT_WAIT}.<br>
|
139
138
|
# Provide <code>{ appium_lib: { wait: 30 } }</code> to {::Appium::Core.for}
|
140
139
|
# @return [Integer]
|
141
140
|
attr_reader :default_wait
|
142
|
-
DEFAULT_IMPLICIT_WAIT = 0
|
143
141
|
|
144
142
|
# Appium's server port. 4723 is by default. Defaults to {::Appium::Core::Driver::DEFAULT_APPIUM_PORT}.<br>
|
145
143
|
# Provide <code>{ appium_lib: { port: 8080 } }</code> to {::Appium::Core.for}.
|
@@ -187,8 +185,6 @@ module Appium
|
|
187
185
|
# @option opts [Hash] :caps Appium capabilities.
|
188
186
|
# @option opts [Hash] :capabilities The same as :caps.
|
189
187
|
# This param is for compatibility with Selenium WebDriver format
|
190
|
-
# @option opts [Hash] :desired_capabilities The same as :caps.
|
191
|
-
# This param is for compatibility with Selenium WebDriver format
|
192
188
|
# @option opts [Appium::Core::Options] :appium_lib Capabilities affect only ruby client
|
193
189
|
# @option opts [String] :url The same as :custom_url in :appium_lib.
|
194
190
|
# This param is for compatibility with Selenium WebDriver format
|
@@ -199,10 +195,8 @@ module Appium
|
|
199
195
|
#
|
200
196
|
# # format 1
|
201
197
|
# @core = Appium::Core.for caps: {...}, appium_lib: {...}
|
202
|
-
# # format 2. 'capabilities:'
|
198
|
+
# # format 2. 'capabilities:' is also available instead of 'caps:'.
|
203
199
|
# @core = Appium::Core.for url: "http://127.0.0.1:8080/wd/hub", capabilities: {...}, appium_lib: {...}
|
204
|
-
# # format 3. 'appium_lib: {...}' can be blank
|
205
|
-
# @core = Appium::Core.for url: "http://127.0.0.1:8080/wd/hub", desired_capabilities: {...}
|
206
200
|
#
|
207
201
|
#
|
208
202
|
# require 'rubygems'
|
@@ -230,7 +224,7 @@ module Appium
|
|
230
224
|
# @core.start_driver # Connect to 'http://127.0.0.1:8080/wd/hub' because of 'port: 8080'
|
231
225
|
#
|
232
226
|
# # Start iOS driver with .zip file over HTTP
|
233
|
-
# #
|
227
|
+
# # 'capabilities:' is also available instead of 'caps:'. Either is fine.
|
234
228
|
# opts = {
|
235
229
|
# capabilities: {
|
236
230
|
# platformName: :ios,
|
@@ -254,7 +248,7 @@ module Appium
|
|
254
248
|
# # Start iOS driver as another format. 'url' is available like below
|
255
249
|
# opts = {
|
256
250
|
# url: "http://custom-host:8080/wd/hub.com",
|
257
|
-
#
|
251
|
+
# capabilities: {
|
258
252
|
# platformName: :ios,
|
259
253
|
# platformVersion: '11.0',
|
260
254
|
# deviceName: 'iPhone Simulator',
|
@@ -368,8 +362,8 @@ module Appium
|
|
368
362
|
|
369
363
|
begin
|
370
364
|
@driver = ::Appium::Core::Base::Driver.new(listener: @listener,
|
371
|
-
|
372
|
-
|
365
|
+
http_client: @http_client,
|
366
|
+
capabilities: @caps, # ::Selenium::WebDriver::Remote::Capabilities
|
373
367
|
url: @custom_url)
|
374
368
|
|
375
369
|
if @direct_connect
|
@@ -411,6 +405,8 @@ module Appium
|
|
411
405
|
|
412
406
|
# Ignore setting default wait if the target driver has no implementation
|
413
407
|
def set_implicit_wait_by_default(wait)
|
408
|
+
return if @default_wait.nil?
|
409
|
+
|
414
410
|
@driver.manage.timeouts.implicit_wait = wait
|
415
411
|
rescue ::Selenium::WebDriver::Error::UnknownError => e
|
416
412
|
unless e.message.include?('The operation requested is not yet implemented')
|
@@ -480,21 +476,6 @@ module Appium
|
|
480
476
|
p_version.split('.').map(&:to_i)
|
481
477
|
end
|
482
478
|
|
483
|
-
# Takes a png screenshot and saves to the target path.
|
484
|
-
#
|
485
|
-
# @param png_save_path [String] the full path to save the png
|
486
|
-
# @return [File]
|
487
|
-
#
|
488
|
-
# @example
|
489
|
-
#
|
490
|
-
# @core.screenshot '/tmp/hi.png' #=> nil
|
491
|
-
# # same as '@driver.save_screenshot png_save_path'
|
492
|
-
#
|
493
|
-
def screenshot(png_save_path)
|
494
|
-
::Appium::Logger.warn '[DEPRECATION] screenshot will be removed. Please use driver.save_screenshot instead.'
|
495
|
-
@driver.save_screenshot png_save_path
|
496
|
-
end
|
497
|
-
|
498
479
|
private
|
499
480
|
|
500
481
|
# @private
|
@@ -567,10 +548,7 @@ module Appium
|
|
567
548
|
def validate_keys(opts)
|
568
549
|
flatten_ops = flatten_hash_keys(opts)
|
569
550
|
|
570
|
-
|
571
|
-
unless opts.member?(:caps) || opts.member?(:capabilities) || opts.member?(:desired_capabilities)
|
572
|
-
raise Error::NoCapabilityError
|
573
|
-
end
|
551
|
+
raise Error::NoCapabilityError unless opts.member?(:caps) || opts.member?(:capabilities)
|
574
552
|
|
575
553
|
if !opts.member?(:appium_lib) && flatten_ops.member?(:appium_lib)
|
576
554
|
raise Error::CapabilityStructureError, 'Please check the value of appium_lib in the capability'
|
@@ -591,8 +569,7 @@ module Appium
|
|
591
569
|
|
592
570
|
# @private
|
593
571
|
def get_caps(opts)
|
594
|
-
|
595
|
-
Core::Base::Capabilities.create_capabilities(opts[:caps] || opts[:capabilities] || opts[:desired_capabilities] || {})
|
572
|
+
Core::Base::Capabilities.create_capabilities(opts[:caps] || opts[:capabilities] || {})
|
596
573
|
end
|
597
574
|
|
598
575
|
# @private
|
@@ -20,6 +20,15 @@ module Appium
|
|
20
20
|
include ::Appium::Core::Base::SearchContext
|
21
21
|
include ::Appium::Core::Base::TakesScreenshot
|
22
22
|
|
23
|
+
# Retuns the element id.
|
24
|
+
#
|
25
|
+
# @return [String]
|
26
|
+
# @example
|
27
|
+
# e = @driver.find_element :accessibility_id, 'something'
|
28
|
+
# e.id
|
29
|
+
#
|
30
|
+
attr_reader :id
|
31
|
+
|
23
32
|
# Returns the value of attributes like below. Read each platform to know more details.
|
24
33
|
#
|
25
34
|
# uiautomator2: https://github.com/appium/appium-uiautomator2-server/blob/203cc7e57ce477f3cff5d95b135d1b3450a6033a/app/src/main/java/io/appium/uiautomator2/utils/Attribute.java#L19
|
@@ -59,20 +68,20 @@ module Appium
|
|
59
68
|
#
|
60
69
|
# @example
|
61
70
|
#
|
62
|
-
#
|
71
|
+
# element.immediate_value 'hello'
|
63
72
|
#
|
64
73
|
def immediate_value(*value)
|
65
|
-
@bridge.set_immediate_value
|
74
|
+
@bridge.set_immediate_value @id, *value
|
66
75
|
end
|
67
76
|
|
68
77
|
# Replace the value to element directly
|
69
78
|
#
|
70
79
|
# @example
|
71
80
|
#
|
72
|
-
#
|
81
|
+
# element.replace_value 'hello'
|
73
82
|
#
|
74
83
|
def replace_value(*value)
|
75
|
-
@bridge.replace_value
|
84
|
+
@bridge.replace_value @id, *value
|
76
85
|
end
|
77
86
|
|
78
87
|
# For use with location_rel.
|
@@ -108,7 +117,7 @@ module Appium
|
|
108
117
|
# element.screenshot #=> "iVBORw0KGgoAAAANSUhEUgAABDgAAAB+CAIAAABOPDa6AAAAAX"
|
109
118
|
#
|
110
119
|
def screenshot
|
111
|
-
bridge.
|
120
|
+
bridge.element_screenshot @id
|
112
121
|
end
|
113
122
|
|
114
123
|
# Return an element screenshot in the given format
|
@@ -123,9 +132,9 @@ module Appium
|
|
123
132
|
def screenshot_as(format)
|
124
133
|
case format
|
125
134
|
when :base64
|
126
|
-
bridge.
|
135
|
+
bridge.element_screenshot @id
|
127
136
|
when :png
|
128
|
-
bridge.
|
137
|
+
bridge.element_screenshot(@id).unpack('m')[0]
|
129
138
|
else
|
130
139
|
raise Core::Error::UnsupportedOperationError, "unsupported format: #{format.inspect}"
|
131
140
|
end
|
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
module Appium
|
16
16
|
module Core
|
17
|
-
VERSION = '5.0.0.
|
18
|
-
DATE = '2021-
|
17
|
+
VERSION = '5.0.0.rc4' unless defined? ::Appium::Core::VERSION
|
18
|
+
DATE = '2021-10-14' unless defined? ::Appium::Core::DATE
|
19
19
|
end
|
20
20
|
end
|
data/release_notes.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
#### v4.7.0 2021-07-17
|
2
|
+
|
3
|
+
- [0059974](https://github.com/appium/ruby_lib_core/commit/0059974b0b1d79a822db84d8b0169e8393e00ef9) Release 4.7.0
|
4
|
+
- [0f93a52](https://github.com/appium/ruby_lib_core/commit/0f93a52bbdc44bf916c9b974fe9fd09d48e5ff39) test: add more example and test (#328)
|
5
|
+
- [9e37b3b](https://github.com/appium/ruby_lib_core/commit/9e37b3bc15f72f7c0117a49945a3fe482598f374) feat: add satellites for Android emulators (#327)
|
6
|
+
- [3063a73](https://github.com/appium/ruby_lib_core/commit/3063a73fa291dc378daa53b7df2e4b0b8a6f03d2) ci: calls quit_driver to ensure close the previous session
|
7
|
+
- [43fb9e7](https://github.com/appium/ruby_lib_core/commit/43fb9e77f5492a92f4f8c5a5bda71be9c3a9e2c8) chore: tweak naming in an internal variable
|
8
|
+
|
9
|
+
|
1
10
|
#### v4.6.0 2021-06-03
|
2
11
|
|
3
12
|
- [0dacfab](https://github.com/appium/ruby_lib_core/commit/0dacfab1256e1447e1f7a5974dfcf48ee0a72b9d) Release 4.6.0
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appium_lib_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.0.
|
4
|
+
version: 5.0.0.rc4
|
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-10-14 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
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.0.0
|
19
|
+
version: 4.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.0.0
|
26
|
+
version: 4.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: faye-websocket
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,28 +114,28 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 3.
|
117
|
+
version: 3.14.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: 3.
|
124
|
+
version: 3.14.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rubocop
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - '='
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 1.12.
|
131
|
+
version: 1.12.1
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - '='
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 1.12.
|
138
|
+
version: 1.12.1
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: appium_thor
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|