appium_lib 11.0.0 → 11.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.azure-pipelines.yml +18 -0
- data/.github/workflows/rubocop.yml +1 -1
- data/.rubocop.yml +17 -1
- data/CHANGELOG.md +9 -6
- data/appium_lib.gemspec +3 -3
- data/docs/android_docs.md +209 -209
- data/docs/ios_docs.md +247 -247
- data/lib/appium_lib/android/common/helper.rb +2 -2
- data/lib/appium_lib/appium.rb +12 -8
- data/lib/appium_lib/common/helper.rb +7 -5
- data/lib/appium_lib/common/wait.rb +1 -1
- data/lib/appium_lib/driver.rb +6 -10
- data/lib/appium_lib/ios/common/helper.rb +2 -1
- data/lib/appium_lib/ios/xcuitest.rb +0 -1
- data/lib/appium_lib/ios/xcuitest/command/gestures.rb +5 -5
- data/lib/appium_lib/ios/xcuitest/command/multi_app_handler.rb +6 -12
- data/lib/appium_lib/ios/xcuitest/helper.rb +1 -1
- data/lib/appium_lib/version.rb +2 -2
- data/release_notes.md +11 -0
- metadata +15 -14
@@ -27,7 +27,7 @@ module Appium
|
|
27
27
|
@filter = value.to_s.downcase
|
28
28
|
end
|
29
29
|
|
30
|
-
def initialize
|
30
|
+
def initialize # rubocop:disable Lint/MissingSuper
|
31
31
|
reset
|
32
32
|
@filter = false
|
33
33
|
end
|
@@ -217,7 +217,7 @@ module Appium
|
|
217
217
|
# [^\/]+ - type is made up of at least one non-/ characters
|
218
218
|
# \\/ - / ends the type and starts the name
|
219
219
|
# [\S]+$ - the name contains at least one non-space character and then the line is ended
|
220
|
-
resource_id = /^[a-zA-Z_][a-zA-Z0-9
|
220
|
+
resource_id = /^[a-zA-Z_][a-zA-Z0-9._]*:[^\/]+\/\S+$/
|
221
221
|
string.match(resource_id) ? on_match : ''
|
222
222
|
end
|
223
223
|
|
data/lib/appium_lib/appium.rb
CHANGED
@@ -77,9 +77,8 @@ module Appium
|
|
77
77
|
Appium::Logger.info "Loading #{toml}" if verbose
|
78
78
|
|
79
79
|
data = Tomlrb.load_file(toml, symbolize_keys: true)
|
80
|
-
|
81
|
-
|
82
|
-
end
|
80
|
+
|
81
|
+
Appium::Logger.info data if verbose && !data.empty?
|
83
82
|
|
84
83
|
if data && data[:caps] && data[:caps][:app] && !data[:caps][:app].empty?
|
85
84
|
data[:caps][:app] = Appium::Driver.absolute_app_path data
|
@@ -200,12 +199,17 @@ module Appium
|
|
200
199
|
raise 'Driver is nil' if driver.nil?
|
201
200
|
|
202
201
|
# Wrap single class into an array
|
203
|
-
class_array = [class_array] unless class_array.
|
202
|
+
class_array = [class_array] unless class_array.instance_of? Array
|
204
203
|
# Promote Appium driver methods to class instance methods.
|
205
204
|
class_array.each do |klass|
|
206
|
-
driver.public_methods(false).each do |
|
205
|
+
driver.public_methods(false).each do |method|
|
207
206
|
klass.class_eval do
|
208
|
-
|
207
|
+
if method_defined? method
|
208
|
+
::Appium::Logger.warn "'#{method}' is already defined. Skipping to override it."
|
209
|
+
next
|
210
|
+
end
|
211
|
+
|
212
|
+
define_method method do |*args, &block|
|
209
213
|
begin
|
210
214
|
# Prefer existing method.
|
211
215
|
# super will invoke method missing on driver
|
@@ -217,11 +221,11 @@ module Appium
|
|
217
221
|
rescue NoMethodError, ArgumentError
|
218
222
|
if args.size == 1 && args.first.is_a?(Hash)
|
219
223
|
# To prevent warnings by keyword arguments (for Ruby 2.7 and 3)
|
220
|
-
driver.send
|
224
|
+
driver.send method, **args.first, &block if driver.respond_to?(method)
|
221
225
|
else
|
222
226
|
::Appium::Logger.warn "Should fix this '#{args}' for Ruby 2.7 (and 3)" if args.first.is_a?(Hash)
|
223
227
|
|
224
|
-
driver.send
|
228
|
+
driver.send method, *args, &block if driver.respond_to?(method)
|
225
229
|
end
|
226
230
|
end
|
227
231
|
end
|
@@ -29,7 +29,8 @@ module Appium
|
|
29
29
|
# Return yield and ignore any exceptions.
|
30
30
|
def ignore
|
31
31
|
yield
|
32
|
-
rescue Exception # rubocop:disable Lint/
|
32
|
+
rescue Exception # rubocop:disable Lint/RescueException
|
33
|
+
# Ignored
|
33
34
|
end
|
34
35
|
|
35
36
|
# Navigate back.
|
@@ -73,7 +74,7 @@ module Appium
|
|
73
74
|
class CountElements < Nokogiri::XML::SAX::Document
|
74
75
|
attr_reader :result
|
75
76
|
|
76
|
-
def initialize(platform)
|
77
|
+
def initialize(platform) # rubocop:disable Lint/MissingSuper
|
77
78
|
reset
|
78
79
|
@platform = platform
|
79
80
|
end
|
@@ -213,7 +214,7 @@ module Appium
|
|
213
214
|
@filter = value.to_s.downcase
|
214
215
|
end
|
215
216
|
|
216
|
-
def initialize
|
217
|
+
def initialize # rubocop:disable Lint/MissingSuper
|
217
218
|
reset
|
218
219
|
@filter = false
|
219
220
|
end
|
@@ -232,8 +233,9 @@ module Appium
|
|
232
233
|
"#{string} #{attr[0]}: #{attr1}\n"
|
233
234
|
end
|
234
235
|
|
235
|
-
r
|
236
|
-
|
236
|
+
return r if attr_string.nil? || attr_string.empty?
|
237
|
+
|
238
|
+
"#{r}\n#{name}\n#{attr_string}"
|
237
239
|
end
|
238
240
|
end
|
239
241
|
|
@@ -45,7 +45,7 @@ module Appium
|
|
45
45
|
opts = opts.is_a?(Numeric) ? { timeout: opts } : opts
|
46
46
|
|
47
47
|
if opts.is_a? Hash
|
48
|
-
opts.empty? ? @core.wait_true { yield } : @core.wait_true(opts) { yield }
|
48
|
+
opts.empty? ? @core.wait_true { yield } : @core.wait_true(**opts) { yield }
|
49
49
|
else
|
50
50
|
::Appium::Logger.warn('Arguments should be Hash like {timeout: 100}')
|
51
51
|
end
|
data/lib/appium_lib/driver.rb
CHANGED
@@ -276,7 +276,6 @@ module Appium
|
|
276
276
|
|
277
277
|
# Returns a hash of the driver attributes
|
278
278
|
def driver_attributes
|
279
|
-
# rubocop:disable Layout/AlignHash
|
280
279
|
{
|
281
280
|
caps: @core.caps,
|
282
281
|
automation_name: @core.automation_name,
|
@@ -294,7 +293,6 @@ module Appium
|
|
294
293
|
wait_timeout: @core.wait_timeout,
|
295
294
|
wait_interval: @core.wait_interval
|
296
295
|
}
|
297
|
-
# rubocop:enable Layout/AlignHash
|
298
296
|
end
|
299
297
|
|
300
298
|
def device_is_android?
|
@@ -425,14 +423,12 @@ module Appium
|
|
425
423
|
return app_path if app_path =~ URI::DEFAULT_PARSER.make_regexp # public URL for Sauce
|
426
424
|
|
427
425
|
absolute_app_path = File.expand_path app_path
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
app_path
|
426
|
+
if File.exist? absolute_app_path
|
427
|
+
absolute_app_path
|
428
|
+
else
|
429
|
+
::Appium::Logger.info("Use #{app_path}")
|
430
|
+
app_path
|
431
|
+
end
|
436
432
|
end
|
437
433
|
|
438
434
|
# Get the server url
|
@@ -49,6 +49,7 @@ module Appium
|
|
49
49
|
puts " visible: #{visible}" if visible
|
50
50
|
end
|
51
51
|
end
|
52
|
+
|
52
53
|
# iOS only. On Android uiautomator always returns an empty string for EditText password.
|
53
54
|
#
|
54
55
|
# Password character returned from value of UIASecureTextField
|
@@ -470,7 +471,7 @@ module Appium
|
|
470
471
|
# will be present.
|
471
472
|
_validate_object opts[:name], opts[:label], opts[:value]
|
472
473
|
|
473
|
-
#
|
474
|
+
# NOTE: that mainWindow is sometimes nil so it's passed as a param
|
474
475
|
# $._elementOrElementsByType will validate that the window isn't nil
|
475
476
|
element_or_elements_by_type = <<-JS
|
476
477
|
(function() {
|
@@ -79,7 +79,7 @@ module Appium
|
|
79
79
|
# double_tap x: 100, y: 100
|
80
80
|
# double_tap element: find_element(:accessibility_id, "some item")
|
81
81
|
# ```
|
82
|
-
def double_tap(x: nil, y: nil, element: nil)
|
82
|
+
def double_tap(x: nil, y: nil, element: nil)
|
83
83
|
return 'Set x, y or element' if (x.nil? || y.nil?) && element.nil?
|
84
84
|
|
85
85
|
args = element.nil? ? { x: x, y: y } : { element: element.ref }
|
@@ -96,7 +96,7 @@ module Appium
|
|
96
96
|
# touch_and_hold x: 100, y: 100, duration: 2.0
|
97
97
|
# touch_and_hold element: find_element(:accessibility_id, "some item")
|
98
98
|
# ```
|
99
|
-
def touch_and_hold(x: nil, y: nil, element: nil, duration: 1.0)
|
99
|
+
def touch_and_hold(x: nil, y: nil, element: nil, duration: 1.0)
|
100
100
|
return 'Set x, y or element' if (x.nil? || y.nil?) && element.nil?
|
101
101
|
|
102
102
|
args = element.nil? ? { x: x, y: y } : { element: element.ref }
|
@@ -121,10 +121,10 @@ module Appium
|
|
121
121
|
# Otherwise they should be calculated relatively to screen borders.
|
122
122
|
#
|
123
123
|
# ```ruby
|
124
|
-
#
|
125
|
-
#
|
124
|
+
# one_finger_tap x: 100, y: 100
|
125
|
+
# one_finger_tap x: 100, y: 100, element: find_element(:accessibility_id, "some item")
|
126
126
|
# ```
|
127
|
-
def
|
127
|
+
def one_finger_tap(x:, y:, element: nil)
|
128
128
|
args = { x: x, y: y }
|
129
129
|
args[:element] = element.ref if element
|
130
130
|
@driver.execute_script 'mobile: tap', args
|
@@ -33,8 +33,7 @@ module Appium
|
|
33
33
|
# xcuitest_install_app(app: "path/to/app.app")
|
34
34
|
#
|
35
35
|
def xcuitest_install_app(app:)
|
36
|
-
|
37
|
-
@driver.execute_script 'mobile: installApp', args
|
36
|
+
@driver.install_app app
|
38
37
|
end
|
39
38
|
|
40
39
|
# Verifies whether the application with given bundle identifier is installed on the device.
|
@@ -47,8 +46,7 @@ module Appium
|
|
47
46
|
# xcuitest_app_installed?(bundle_id: "io.appium.bundle") #=> true or false
|
48
47
|
#
|
49
48
|
def xcuitest_app_installed?(bundle_id:)
|
50
|
-
|
51
|
-
@driver.execute_script 'mobile: isAppInstalled', args
|
49
|
+
@driver.app_installed? bundle_id
|
52
50
|
end
|
53
51
|
|
54
52
|
# Uninstalls an existing application from the device under test. This endpoint does not verify
|
@@ -62,8 +60,7 @@ module Appium
|
|
62
60
|
# xcuitest_remove_app(bundle_id: "io.appium.bundle") #=> 1
|
63
61
|
#
|
64
62
|
def xcuitest_remove_app(bundle_id:)
|
65
|
-
|
66
|
-
@driver.execute_script 'mobile: removeApp', args
|
63
|
+
@driver.remove_app bundle_id
|
67
64
|
end
|
68
65
|
|
69
66
|
# Executes an existing application on the device. If the application is already running then
|
@@ -92,8 +89,7 @@ module Appium
|
|
92
89
|
# xcuitest_terminate_app(bundle_id: "io.appium.bundle") #=> 1
|
93
90
|
#
|
94
91
|
def xcuitest_terminate_app(bundle_id:)
|
95
|
-
|
96
|
-
@driver.execute_script 'mobile: terminateApp', args
|
92
|
+
@driver.terminate_app bundle_id
|
97
93
|
end
|
98
94
|
|
99
95
|
# Get the status of an existing application on the device.
|
@@ -114,8 +110,7 @@ module Appium
|
|
114
110
|
# xcuitest_query_app_status(bundle_id: "io.appium.bundle") #=> 1
|
115
111
|
#
|
116
112
|
def xcuitest_query_app_status(bundle_id:)
|
117
|
-
|
118
|
-
@driver.execute_script 'mobile: queryAppState', args
|
113
|
+
@driver.app_state bundle_id
|
119
114
|
end
|
120
115
|
|
121
116
|
# Activates an existing application on the device under test and moves it to the foreground.
|
@@ -130,8 +125,7 @@ module Appium
|
|
130
125
|
# xcuitest_activate_app(bundle_id: "io.appium.bundle") #=> 1
|
131
126
|
#
|
132
127
|
def xcuitest_activate_app(bundle_id:)
|
133
|
-
|
134
|
-
@driver.execute_script 'mobile: activateApp', args
|
128
|
+
@driver.activate_app bundle_id
|
135
129
|
end
|
136
130
|
end
|
137
131
|
end # module Xcuitest
|
@@ -74,7 +74,7 @@ module Appium
|
|
74
74
|
c_names = class_names.map { |class_name| %(type == "#{class_name}") }.join(' || ')
|
75
75
|
|
76
76
|
predicate = if value
|
77
|
-
%((#{c_names}) && (name contains[c] "#{value}" || label contains[c] "#{value}" || value contains[c] "#{value}")) # rubocop:disable
|
77
|
+
%((#{c_names}) && (name contains[c] "#{value}" || label contains[c] "#{value}" || value contains[c] "#{value}")) # rubocop:disable Layout/LineLength
|
78
78
|
else
|
79
79
|
c_names
|
80
80
|
end
|
data/lib/appium_lib/version.rb
CHANGED
@@ -14,6 +14,6 @@
|
|
14
14
|
|
15
15
|
module Appium
|
16
16
|
# Version and Date are defined on the 'Appium' module, not 'Appium::Common'
|
17
|
-
VERSION = '11.
|
18
|
-
DATE = '2020-12-
|
17
|
+
VERSION = '11.1.0' unless defined? ::Appium::VERSION
|
18
|
+
DATE = '2020-12-29' unless defined? ::Appium::DATE
|
19
19
|
end
|
data/release_notes.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
#### v11.1.0 2020-12-29
|
2
|
+
|
3
|
+
- [bc3da9b](https://github.com/appium/ruby_lib/commit/bc3da9bc1ee58d5e96811b72f3ed737ed0e9c401) Release 11.1.0
|
4
|
+
- [3c33cd6](https://github.com/appium/ruby_lib/commit/3c33cd639f8ce55fb81c5ae2116a863407529599) ci: Set up CI with Azure Pipelines (#895)
|
5
|
+
- [ecee089](https://github.com/appium/ruby_lib/commit/ecee08981f935295e6413cd98dea4366cbc7bc69) feat: work with Ruby 3 (#893)
|
6
|
+
- [bb3d715](https://github.com/appium/ruby_lib/commit/bb3d715e39509ac091b8f493cca42eb4fe8fd5bf) feat: work with Ruby 3 (#892)
|
7
|
+
- [eb5cee7](https://github.com/appium/ruby_lib/commit/eb5cee7a926b90bbedd6aa28f013a0b3c5f38510) chore: Update rubocop requirement from = 1.6.1 to = 1.7.0 (#891)
|
8
|
+
- [219181d](https://github.com/appium/ruby_lib/commit/219181d80f3b86999706f90a68996945fdc7b1d0) fix: rubocop (#890)
|
9
|
+
- [334b791](https://github.com/appium/ruby_lib/commit/334b791a3c4420598e3e832023aa1a16af92492f) chore: Update fakefs requirement from ~> 0.13.0 to ~> 1.3.0 (#888)
|
10
|
+
|
11
|
+
|
1
12
|
#### v11.0.0 2020-12-19
|
2
13
|
|
3
14
|
- [b4313b0](https://github.com/appium/ruby_lib/commit/b4313b09e62dd22bb95c2e0bc6edd296c7ece7b4) Release 11.0.0
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appium_lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 11.
|
4
|
+
version: 11.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- code@bootstraponline.com
|
8
8
|
- Kazuaki Matsuo
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-12-
|
12
|
+
date: 2020-12-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: appium_lib_core
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '4.
|
20
|
+
version: '4.1'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '4.
|
27
|
+
version: '4.1'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: nokogiri
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -85,14 +85,14 @@ dependencies:
|
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version:
|
88
|
+
version: 1.3.0
|
89
89
|
type: :development
|
90
90
|
prerelease: false
|
91
91
|
version_requirements: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
95
|
+
version: 1.3.0
|
96
96
|
- !ruby/object:Gem::Dependency
|
97
97
|
name: hashdiff
|
98
98
|
requirement: !ruby/object:Gem::Requirement
|
@@ -153,16 +153,16 @@ dependencies:
|
|
153
153
|
name: rubocop
|
154
154
|
requirement: !ruby/object:Gem::Requirement
|
155
155
|
requirements:
|
156
|
-
- -
|
156
|
+
- - '='
|
157
157
|
- !ruby/object:Gem::Version
|
158
|
-
version:
|
158
|
+
version: 1.7.0
|
159
159
|
type: :development
|
160
160
|
prerelease: false
|
161
161
|
version_requirements: !ruby/object:Gem::Requirement
|
162
162
|
requirements:
|
163
|
-
- -
|
163
|
+
- - '='
|
164
164
|
- !ruby/object:Gem::Version
|
165
|
-
version:
|
165
|
+
version: 1.7.0
|
166
166
|
- !ruby/object:Gem::Dependency
|
167
167
|
name: spec
|
168
168
|
requirement: !ruby/object:Gem::Requirement
|
@@ -205,6 +205,7 @@ executables: []
|
|
205
205
|
extensions: []
|
206
206
|
extra_rdoc_files: []
|
207
207
|
files:
|
208
|
+
- ".azure-pipelines.yml"
|
208
209
|
- ".github/ISSUE_TEMPLATE.md"
|
209
210
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
210
211
|
- ".github/workflows/rubocop.yml"
|
@@ -289,7 +290,7 @@ homepage: https://github.com/appium/ruby_lib
|
|
289
290
|
licenses:
|
290
291
|
- Apache-2.0
|
291
292
|
metadata: {}
|
292
|
-
post_install_message:
|
293
|
+
post_install_message:
|
293
294
|
rdoc_options: []
|
294
295
|
require_paths:
|
295
296
|
- lib
|
@@ -304,8 +305,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
304
305
|
- !ruby/object:Gem::Version
|
305
306
|
version: '0'
|
306
307
|
requirements: []
|
307
|
-
rubygems_version: 3.
|
308
|
-
signing_key:
|
308
|
+
rubygems_version: 3.2.0
|
309
|
+
signing_key:
|
309
310
|
specification_version: 4
|
310
311
|
summary: Ruby library for Appium
|
311
312
|
test_files: []
|