appium_lib_core 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -3
- data/README.md +6 -1
- data/lib/appium_lib_core/android/device.rb +25 -25
- data/lib/appium_lib_core/common/base/bridge.rb +1 -1
- data/lib/appium_lib_core/common/base/driver.rb +50 -44
- data/lib/appium_lib_core/common/base/http_default.rb +6 -7
- data/lib/appium_lib_core/common/base/search_context.rb +47 -24
- data/lib/appium_lib_core/common/device/image_comparison.rb +51 -62
- data/lib/appium_lib_core/common/wait.rb +18 -18
- data/lib/appium_lib_core/common/ws/websocket.rb +11 -11
- data/lib/appium_lib_core/driver.rb +81 -40
- data/lib/appium_lib_core/ios/xcuitest/device.rb +40 -43
- data/lib/appium_lib_core/version.rb +2 -2
- data/release_notes.md +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92b2cc51e93cc1cafd0eab292b939f2c8a4857d37c4b058d1cd3d88efc3905c5
|
4
|
+
data.tar.gz: 35b8bd65ee71b69e266a12f79f0f8a47817e3ac3049657808a5c19b0b78651dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5cdd8c9da12e8a996b1b314ab56a04e31b8411323bb4de172e721f7e48f4bd9807cb1b25466361448c2189d1f0eec1b37ea81303e29e580cdc59b2d5f2ed2d0
|
7
|
+
data.tar.gz: 419ce910892d446ebeb341c34853bee00e48a363f631d97362c6435a31d187a9223defcc25ac273cdd212ee4d082710afdc0e321a1a0c9f45ccf620dc15a9b32
|
data/CHANGELOG.md
CHANGED
@@ -10,6 +10,15 @@ Read `release_notes.md` for commit level details.
|
|
10
10
|
|
11
11
|
### Deprecations
|
12
12
|
|
13
|
+
## [3.0.1] - 2019-02-25
|
14
|
+
|
15
|
+
### Enhancements
|
16
|
+
- Add `:data_matcher` find_element/s attribute [appium-espresso-driver#386](https://github.com/appium/appium-espresso-driver/pull/386)
|
17
|
+
|
18
|
+
### Bug fixes
|
19
|
+
|
20
|
+
### Deprecations
|
21
|
+
|
13
22
|
## [3.0.0] - 2019-02-06
|
14
23
|
|
15
24
|
This release has a breaking change about an implicit wait.
|
@@ -18,9 +27,9 @@ The behaviour follows the default spec in WebDriver.
|
|
18
27
|
|
19
28
|
### Enhancements
|
20
29
|
- **Breaking changes**
|
21
|
-
- Set implicit wait zero by default
|
30
|
+
- Set implicit wait zero by default [#186](https://github.com/appium/ruby_lib_core/pull/186)
|
22
31
|
- Can configure `wait: 20` as `appium_lib` capability to keep the behaviour
|
23
|
-
- [Experimental] Add `direct_connect` capability for the Ruby client in order to handle `directConnect` capability in a create session response by Appium server
|
32
|
+
- [Experimental] Add `direct_connect` capability for the Ruby client in order to handle `directConnect` capability in a create session response by Appium server [#189](https://github.com/appium/ruby_lib_core/pull/189)
|
24
33
|
- Update http client following `directConnectProtocol`, `directConnectHost`, `directConnectPort` and `directConnectPath`
|
25
34
|
if `direct_connect` capability for ruby_lib_core is `true`
|
26
35
|
- This will resolve a performance issue if a user has a proxy server to handle requests from client to Appium server.
|
@@ -33,7 +42,7 @@ The behaviour follows the default spec in WebDriver.
|
|
33
42
|
```
|
34
43
|
|
35
44
|
### Bug fixes
|
36
|
-
- Fix potential override of `AppManagement#background_app`
|
45
|
+
- Fix potential override of `AppManagement#background_app` [#188](https://github.com/appium/ruby_lib_core/pull/188)
|
37
46
|
|
38
47
|
### Deprecations
|
39
48
|
|
data/README.md
CHANGED
@@ -40,7 +40,7 @@ $ appium --relaxed-security # To run all tests in local
|
|
40
40
|
```bash
|
41
41
|
$ bundle install
|
42
42
|
$ rake test:func:android # Andorid, uiautomator2
|
43
|
-
$
|
43
|
+
$ AUTOMATION_NAME_DROID=espresso rake test:func:android # Andorid, uiautomator2
|
44
44
|
$ rake test:func:ios # iOS
|
45
45
|
```
|
46
46
|
|
@@ -97,6 +97,11 @@ $ PARALLEL=1 bundle exec parallel_test test/functional/ios -n 2
|
|
97
97
|
# shell 2
|
98
98
|
$ ruby test.rb
|
99
99
|
```
|
100
|
+
|
101
|
+
### Capabilities
|
102
|
+
|
103
|
+
Read [Appium/Core/Driver](https://www.rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Driver) to catch up with available capabilities.
|
104
|
+
Capabilities affect only ruby_lib is [Appium/Core/Options](https://www.rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Options).
|
100
105
|
|
101
106
|
# Development
|
102
107
|
- Demo app
|
@@ -60,9 +60,9 @@ module Appium
|
|
60
60
|
# @!method get_network_connection
|
61
61
|
# Get the device network connection current status
|
62
62
|
# See set_network_connection method for return value
|
63
|
-
# Same as
|
63
|
+
# Same as #network_connection_type in selenium-webdriver.
|
64
64
|
#
|
65
|
-
# Returns a key of {:airplane_mode: 1, wifi: 2, data: 4, all: 6, none: 0} in
|
65
|
+
# Returns a key of <code>{:airplane_mode: 1, wifi: 2, data: 4, all: 6, none: 0}</code> in #network_connection_type
|
66
66
|
# Returns a number of the mode in `#get_network_connection`
|
67
67
|
#
|
68
68
|
# @example
|
@@ -150,7 +150,7 @@ module Appium
|
|
150
150
|
# Same as `#network_connection_type` in selenium-webdriver.
|
151
151
|
#
|
152
152
|
# @param [String] mode Bit mask that represent the network mode
|
153
|
-
# Or the key matched with
|
153
|
+
# Or the key matched with <code>{:airplane_mode: 1, wifi: 2, data: 4, all: 6, none: 0}</code>
|
154
154
|
#
|
155
155
|
# Value (Alias) | Data | Wifi | Airplane Mode
|
156
156
|
# -------------------------------------------------
|
@@ -189,8 +189,8 @@ module Appium
|
|
189
189
|
# @driver.get_performance_data package_name: package_name, data_type: data_type, data_read_timeout: 2
|
190
190
|
#
|
191
191
|
|
192
|
-
# @!method start_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT', force_restart: nil, video_size: nil, time_limit: '180', bit_rate: '4000000')
|
193
|
-
# @param [String] remote_path
|
192
|
+
# @!method start_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT', force_restart: nil, video_size: nil, time_limit: '180', bit_rate: '4000000', bug_report: nil)
|
193
|
+
# @param [String] remote_path The path to the remote location, where the resulting video should be uploaded.
|
194
194
|
# The following protocols are supported: http/https, ftp.
|
195
195
|
# Null or empty string value (the default setting) means the content of resulting
|
196
196
|
# file should be encoded as Base64 and passed as the endpoint response value.
|
@@ -198,29 +198,29 @@ module Appium
|
|
198
198
|
# fit into the available process memory.
|
199
199
|
# This option only has an effect if there is screen recording process in progress
|
200
200
|
# and `forceRestart` parameter is not set to `true`.
|
201
|
-
# @param [String] user
|
202
|
-
# @param [String] pass
|
203
|
-
# @param [String] method
|
204
|
-
# @param [Boolean] force_restart
|
201
|
+
# @param [String] user The name of the user for the remote authentication.
|
202
|
+
# @param [String] pass The password for the remote authentication.
|
203
|
+
# @param [String] method The http multipart upload method name. The 'PUT' one is used by default.
|
204
|
+
# @param [Boolean] force_restart Whether to try to catch and upload/return the currently running screen recording
|
205
205
|
# (`false`, the default setting on server) or ignore the result of it
|
206
206
|
# and start a new recording immediately (`true`).
|
207
207
|
#
|
208
|
-
# @param [String] video_size
|
209
|
-
#
|
210
|
-
#
|
211
|
-
#
|
212
|
-
#
|
213
|
-
# @param [String] time_limit
|
214
|
-
#
|
215
|
-
#
|
216
|
-
#
|
217
|
-
#
|
218
|
-
#
|
219
|
-
# @param [String] bit_rate
|
220
|
-
#
|
221
|
-
# @param [Boolean] bug_report
|
222
|
-
#
|
223
|
-
#
|
208
|
+
# @param [String] video_size The format is widthxheight.
|
209
|
+
# The default value is the device's native display resolution (if supported),
|
210
|
+
# 1280x720 if not. For best results,
|
211
|
+
# use a size supported by your device's Advanced Video Coding (AVC) encoder.
|
212
|
+
# For example, "1280x720"
|
213
|
+
# @param [String] time_limit Recording time. 180 seconds is by default.
|
214
|
+
# Since Appium 1.8.2 the time limit can be up to 1800 seconds (30 minutes).
|
215
|
+
# Appium will automatically try to merge the 3-minutes chunks recorded
|
216
|
+
# by the screenrecord utility, however, this requires FFMPEG utility
|
217
|
+
# to be installed and available in PATH on the server machine. If the utility is not
|
218
|
+
# present then the most recent screen recording chunk is going to be returned as the result.
|
219
|
+
# @param [String] bit_rate The video bit rate for the video, in megabits per second.
|
220
|
+
# 4 Mbp/s(4000000) is by default for Android API level below 27. 20 Mb/s(20000000) for API level 27 and above.
|
221
|
+
# @param [Boolean] bug_report Set it to `true` in order to display additional information on the video overlay,
|
222
|
+
# such as a timestamp, that is helpful in videos captured to illustrate bugs.
|
223
|
+
# This option is only supported since API level 27 (Android P).
|
224
224
|
#
|
225
225
|
# @example
|
226
226
|
#
|
@@ -49,7 +49,7 @@ module Appium
|
|
49
49
|
# If `desired_capabilities` has `forceMjsonwp: true` in the capability, this bridge works with mjsonwp protocol.
|
50
50
|
# If `forceMjsonwp: false` or no the capability, it depends on server side whether this bridge works as w3c or mjsonwp.
|
51
51
|
#
|
52
|
-
# @param [::Selenium::WebDriver::Remote::W3C::Capabilities, Hash]
|
52
|
+
# @param [::Selenium::WebDriver::Remote::W3C::Capabilities, Hash] desired_capabilities A capability
|
53
53
|
# @return [::Selenium::WebDriver::Remote::Capabilities, ::Selenium::WebDriver::Remote::W3C::Capabilities]
|
54
54
|
#
|
55
55
|
# @example
|
@@ -371,9 +371,11 @@ module Appium
|
|
371
371
|
# On Android, the application under test should be built with debuggable flag enabled in order to get access to
|
372
372
|
# its container on the internal file system.
|
373
373
|
#
|
374
|
-
#
|
375
|
-
#
|
376
|
-
#
|
374
|
+
# {https://github.com/libimobiledevice/ifuse iFuse GitHub page6}
|
375
|
+
#
|
376
|
+
# {https://github.com/osxfuse/osxfuse/wiki/FAQ osxFuse FAQ}
|
377
|
+
#
|
378
|
+
# {https://developer.android.com/studio/debug 'Debug Your App' developer article}
|
377
379
|
#
|
378
380
|
# @param [String] path Either an absolute path OR, for iOS devices, a path relative to the app, as described.
|
379
381
|
# If the path starts with application id prefix, then the file will be pushed to the root of
|
@@ -397,9 +399,11 @@ module Appium
|
|
397
399
|
# On Android the application under test should be built with debuggable flag enabled in order to get access
|
398
400
|
# to its container on the internal file system.
|
399
401
|
#
|
400
|
-
#
|
401
|
-
#
|
402
|
-
#
|
402
|
+
# {https://github.com/libimobiledevice/ifuse iFuse GitHub page6}
|
403
|
+
#
|
404
|
+
# {https://github.com/osxfuse/osxfuse/wiki/FAQ osxFuse FAQ}
|
405
|
+
#
|
406
|
+
# {https://developer.android.com/studio/debug 'Debug Your App' developer article}
|
403
407
|
#
|
404
408
|
# @param [String] path Either an absolute path OR, for iOS devices, a path relative to the app, as described.
|
405
409
|
# If the path starts with application id prefix, then the file will be pulled from the root
|
@@ -423,9 +427,9 @@ module Appium
|
|
423
427
|
# On Android the application under test should be built with debuggable flag enabled in order to get access to
|
424
428
|
# its container on the internal file system.
|
425
429
|
#
|
426
|
-
#
|
427
|
-
#
|
428
|
-
#
|
430
|
+
# {https://github.com/libimobiledevice/ifuse iFuse GitHub page6}
|
431
|
+
# {https://github.com/osxfuse/osxfuse/wiki/FAQ osxFuse FAQ}
|
432
|
+
# {https://developer.android.com/studio/debug/ 'Debug Your App' developer article}
|
429
433
|
#
|
430
434
|
# @param [String] path Absolute path to the folder.
|
431
435
|
# If the path starts with <em>@applicationId/</em> prefix, then the folder will be pulled
|
@@ -460,13 +464,13 @@ module Appium
|
|
460
464
|
# http://developer.android.com/reference/android/view/KeyEvent.html
|
461
465
|
# @param [Integer] key The key to press. The values which have `KEYCODE_` prefix in http://developer.android.com/reference/android/view/KeyEvent.html
|
462
466
|
# e.g.: KEYCODE_HOME is `3` or `0x00000003`
|
463
|
-
# @param [[Integer]] metastate
|
464
|
-
#
|
465
|
-
#
|
466
|
-
# @param [[Integer]] flags
|
467
|
-
#
|
468
|
-
#
|
469
|
-
#
|
467
|
+
# @param [[Integer]] metastate The state the metakeys should be in when pressing the key. Default is empty Array.
|
468
|
+
# Metastate have `META_` prefix in https://developer.android.com/reference/android/view/KeyEvent.html
|
469
|
+
# e.g.: META_SHIFT_ON is `1` or `0x00000001`
|
470
|
+
# @param [[Integer]] flags Native Android flag value. Several flags can be combined into a single key event.
|
471
|
+
# Default is empty Array. Can set multiple flags as Array.
|
472
|
+
# Flags have `FLAG_` prefix in http://developer.android.com/reference/android/view/KeyEvent.html
|
473
|
+
# e.g.: FLAG_CANCELED is `32` or `0x00000020`
|
470
474
|
#
|
471
475
|
# @example
|
472
476
|
#
|
@@ -482,13 +486,13 @@ module Appium
|
|
482
486
|
# http://developer.android.com/reference/android/view/KeyEvent.html
|
483
487
|
# @param [Integer] key The key to long press. The values which have `KEYCODE_` prefix in http://developer.android.com/reference/android/view/KeyEvent.html
|
484
488
|
# e.g.: KEYCODE_HOME is `3` or `0x00000003`
|
485
|
-
# @param [[Integer]] metastate
|
486
|
-
#
|
487
|
-
#
|
488
|
-
# @param [[Integer]] flags
|
489
|
-
#
|
490
|
-
#
|
491
|
-
#
|
489
|
+
# @param [[Integer]] metastate The state the metakeys should be in when pressing the key. Default is empty Array.
|
490
|
+
# Metastate have `META_` prefix in https://developer.android.com/reference/android/view/KeyEvent.html
|
491
|
+
# e.g.: META_SHIFT_ON is `1` or `0x00000001`
|
492
|
+
# @param [[Integer]] flags Native Android flag value. Several flags can be combined into a single key event.
|
493
|
+
# Default is empty Array. Can set multiple flags as Array.
|
494
|
+
# Flags have `FLAG_` prefix in http://developer.android.com/reference/android/view/KeyEvent.html
|
495
|
+
# e.g.: FLAG_CANCELED is `32` or `0x00000020`
|
492
496
|
#
|
493
497
|
# @example
|
494
498
|
#
|
@@ -560,15 +564,15 @@ module Appium
|
|
560
564
|
#
|
561
565
|
# @param [String] path The absolute local path or remote http URL to an .ipa or .apk file,
|
562
566
|
# or a .zip containing one of these.
|
563
|
-
# @param [Boolean] replace
|
564
|
-
#
|
565
|
-
# @param [Integer] timeout
|
566
|
-
#
|
567
|
-
# @param [Boolean] allow_test_packages
|
568
|
-
#
|
569
|
-
# @param [Boolean] use_sdcard
|
570
|
-
# @param [Boolean] grant_permissions
|
571
|
-
#
|
567
|
+
# @param [Boolean] replace Only for Android. Whether to reinstall/upgrade the package if it is already present
|
568
|
+
# on the device under test. `true` by default
|
569
|
+
# @param [Integer] timeout Only for Android. How much time to wait for the installation to complete.
|
570
|
+
# 60000ms by default.
|
571
|
+
# @param [Boolean] allow_test_packages Only for Android. Whether to allow installation of packages marked as test
|
572
|
+
# in the manifest. `false` by default
|
573
|
+
# @param [Boolean] use_sdcard Only for Android. Whether to use the SD card to install the app. `false` by default
|
574
|
+
# @param [Boolean] grant_permissions Only for Android. whether to automatically grant application permissions
|
575
|
+
# on Android 6+ after the installation completes. `false` by default
|
572
576
|
#
|
573
577
|
# @example
|
574
578
|
#
|
@@ -591,9 +595,9 @@ module Appium
|
|
591
595
|
end
|
592
596
|
|
593
597
|
# @param [Strong] app_id BundleId for iOS or package name for Android
|
594
|
-
# @param [Boolean] keep_data
|
598
|
+
# @param [Boolean] keep_data Only for Android. Whether to keep application data and caches after it is uninstalled.
|
595
599
|
# `false` by default
|
596
|
-
# @param [Integer] timeout
|
600
|
+
# @param [Integer] timeout Only for Android. How much time to wait for the uninstall to complete. 20000ms by default.
|
597
601
|
#
|
598
602
|
# @example
|
599
603
|
#
|
@@ -629,8 +633,8 @@ module Appium
|
|
629
633
|
# Terminate the specified app.
|
630
634
|
#
|
631
635
|
# @param [Strong] app_id BundleId for iOS or package name for Android
|
632
|
-
# @param [Integer] timeout
|
633
|
-
#
|
636
|
+
# @param [Integer] timeout Only for Android. How much time to wait for the application termination to complete.
|
637
|
+
# 500ms by default.
|
634
638
|
# @return [Boolean]
|
635
639
|
#
|
636
640
|
# @example
|
@@ -666,15 +670,15 @@ module Appium
|
|
666
670
|
end
|
667
671
|
alias query_app_state app_state
|
668
672
|
|
669
|
-
# @param [String] remote_path
|
673
|
+
# @param [String] remote_path The path to the remote location, where the resulting video should be uploaded.
|
670
674
|
# The following protocols are supported: http/https, ftp.
|
671
675
|
# Null or empty string value (the default setting) means the content of resulting
|
672
676
|
# file should be encoded as Base64 and passed as the endpoint response value.
|
673
677
|
# An exception will be thrown if the generated media file is too big to
|
674
678
|
# fit into the available process memory.
|
675
|
-
# @param [String] user
|
676
|
-
# @param [String] pass
|
677
|
-
# @param [String] method
|
679
|
+
# @param [String] user The name of the user for the remote authentication.
|
680
|
+
# @param [String] pass The password for the remote authentication.
|
681
|
+
# @param [String] method The http multipart upload method name. The 'PUT' one is used by default.
|
678
682
|
#
|
679
683
|
# @example
|
680
684
|
#
|
@@ -951,9 +955,10 @@ module Appium
|
|
951
955
|
|
952
956
|
# @since Appium 1.8.2
|
953
957
|
# Return an element if current view has a partial image. The logic depends on template matching by OpenCV.
|
954
|
-
#
|
958
|
+
# {https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/image-comparison.md image-comparison}
|
959
|
+
#
|
955
960
|
# You can handle settings for the comparision following below.
|
956
|
-
#
|
961
|
+
# {https://github.com/appium/appium-base-driver/blob/master/lib/basedriver/device-settings.js#L6 device-settings}
|
957
962
|
#
|
958
963
|
# @param [String] img_path A path to a partial image you'd like to find
|
959
964
|
#
|
@@ -972,9 +977,10 @@ module Appium
|
|
972
977
|
|
973
978
|
# @since Appium 1.8.2
|
974
979
|
# Return elements if current view has a partial image. The logic depends on template matching by OpenCV.
|
975
|
-
#
|
980
|
+
# {https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/image-comparison.md image-comparison}
|
981
|
+
#
|
976
982
|
# You can handle settings for the comparision following below.
|
977
|
-
#
|
983
|
+
# {https://github.com/appium/appium-base-driver/blob/master/lib/basedriver/device-settings.js#L6 device-settings}
|
978
984
|
#
|
979
985
|
# @param [String] img_path A path to a partial image you'd like to find
|
980
986
|
#
|
@@ -12,14 +12,13 @@ module Appium
|
|
12
12
|
"appium/ruby_lib_core/#{VERSION} (#{::Selenium::WebDriver::Remote::Http::Common::DEFAULT_HEADERS['User-Agent']})"
|
13
13
|
}.freeze
|
14
14
|
|
15
|
-
# Update
|
16
|
-
# Set
|
17
|
-
# @private
|
15
|
+
# Update <code>server_url</code> provided when ruby_lib _core created a default http client.
|
16
|
+
# Set <code>@http</code> as nil to re-create http client for the <code>server_url</code>
|
18
17
|
#
|
19
|
-
# @param [string] scheme
|
20
|
-
# @param [string] host
|
21
|
-
# @param [string|integer] port
|
22
|
-
# @param [string] path
|
18
|
+
# @param [string] scheme A scheme to update server_url to
|
19
|
+
# @param [string] host A host to update server_url to
|
20
|
+
# @param [string|integer] port A port number to update server_url to
|
21
|
+
# @param [string] path A path to update server_url to
|
23
22
|
#
|
24
23
|
# @return [URI] An instance of URI updated to. Returns default `server_url` if some of arguments are `nil`
|
25
24
|
def update_sending_request_to(scheme:, host:, port:, path:)
|
@@ -12,29 +12,49 @@ module Appium
|
|
12
12
|
# Android
|
13
13
|
uiautomator: '-android uiautomator', # Unavailable in Espresso
|
14
14
|
viewtag: '-android viewtag', # Available in Espresso
|
15
|
+
data_matcher: '-android datamatcher', # Available in Espresso
|
15
16
|
# iOS
|
16
17
|
uiautomation: '-ios uiautomation',
|
17
18
|
predicate: '-ios predicate string',
|
18
19
|
class_chain: '-ios class chain',
|
19
|
-
# Windows
|
20
|
+
# Windows with windows prefix
|
20
21
|
windows_uiautomation: '-windows uiautomation',
|
21
|
-
# Tizen
|
22
|
+
# Tizen with Tizen prefix
|
22
23
|
tizen_uiautomation: '-tizen uiautomation'
|
23
24
|
)
|
24
25
|
# rubocop:enable Layout/AlignHash
|
25
26
|
|
27
|
+
# rubocop:disable Metrics/LineLength
|
26
28
|
#
|
27
29
|
# Find the first element matching the given arguments
|
28
30
|
#
|
29
|
-
# Android can find with uiautomator like a
|
30
|
-
# iOS can find with a
|
31
|
-
# iOS, only for XCUITest(WebDriverAgent), can find with a
|
31
|
+
# - Android can find with uiautomator like a {http://developer.android.com/tools/help/uiautomator/UiSelector.html UISelector}.
|
32
|
+
# - iOS can find with a {https://developer.apple.com/library/ios/documentation/ToolsLanguages/Reference/UIAWindowClassReference/UIAWindow/UIAWindow.html#//apple_ref/doc/uid/TP40009930 UIAutomation command}.
|
33
|
+
# - iOS, only for XCUITest(WebDriverAgent), can find with a {https://github.com/facebook/WebDriverAgent/wiki/Queries class chain}
|
32
34
|
#
|
33
|
-
# Find with image
|
35
|
+
# == Find with image
|
34
36
|
# Return an element if current view has a partial image. The logic depends on template matching by OpenCV.
|
35
|
-
#
|
36
|
-
#
|
37
|
-
#
|
37
|
+
# {https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/image-comparison.md image-comparison}
|
38
|
+
#
|
39
|
+
# You can handle settings for the comparision following {https://github.com/appium/appium-base-driver/blob/master/lib/basedriver/device-settings.js#L6 here}
|
40
|
+
#
|
41
|
+
# == Espresso datamatcher
|
42
|
+
# Espresso has an {https://medium.com/androiddevelopers/adapterviews-and-espresso-f4172aa853cf _onData_ matcher} for more reference
|
43
|
+
# that allows you to target adapters instead of Views. This method find methods based on reflections
|
44
|
+
#
|
45
|
+
# This is a selector strategy that allows users to pass a selector of the form:
|
46
|
+
#
|
47
|
+
# <code>{ name: '<name>', args: ['arg1', 'arg2', '...'], class: '<optional class>' }</code>
|
48
|
+
#
|
49
|
+
# - _name_: The name of a method to invoke. The method must return
|
50
|
+
# a Hamcrest {http://hamcrest.org/JavaHamcrest/javadoc/1.3/org/hamcrest/Matcher.html Matcher}
|
51
|
+
# - _args_: The args provided to the method
|
52
|
+
# - _class_: The class name that the method is part of (defaults to <code>org.hamcrest.Matchers</code>).
|
53
|
+
# Can be fully qualified, or simple, and simple defaults to <code>androidx.test.espresso.matcher</code> package
|
54
|
+
# (e.g.: <code>class=CursorMatchers</code> fully qualified is <code>class=androidx.test.espresso.matcher.CursorMatchers</code>
|
55
|
+
#
|
56
|
+
# See example how to send datamatcher in Ruby client
|
57
|
+
#
|
38
58
|
#
|
39
59
|
# @overload find_element(how, what)
|
40
60
|
# @param [Symbol, String] how The method to find the element by
|
@@ -49,48 +69,51 @@ module Appium
|
|
49
69
|
# @example Find element with each keys
|
50
70
|
#
|
51
71
|
# # with accessibility id. All platforms.
|
52
|
-
# find_elements :accessibility_id, 'Animation'
|
53
|
-
# find_elements :accessibility_id, 'Animation'
|
72
|
+
# @driver.find_elements :accessibility_id, 'Animation'
|
73
|
+
# @driver.find_elements :accessibility_id, 'Animation'
|
54
74
|
#
|
55
75
|
# # with base64 encoded template image. All platforms.
|
56
|
-
# find_elements :image, Base64.strict_encode64(File.read(file_path))
|
76
|
+
# @driver.find_elements :image, Base64.strict_encode64(File.read(file_path))
|
57
77
|
#
|
58
78
|
# # For Android
|
59
79
|
# ## With uiautomator
|
60
|
-
# find_elements :uiautomator, 'new UiSelector().clickable(true)'
|
80
|
+
# @driver.find_elements :uiautomator, 'new UiSelector().clickable(true)'
|
61
81
|
# ## With viewtag, but only for Espresso
|
62
82
|
# ## `setTag`/`getTag` in https://developer.android.com/reference/android/view/View
|
63
|
-
# find_elements :viewtag, 'new UiSelector().clickable(true)'
|
83
|
+
# @driver.find_elements :viewtag, 'new UiSelector().clickable(true)'
|
84
|
+
# # With data_matcher. The argument should be JSON format.
|
85
|
+
# @driver.find_elements :data_matcher, { name: 'hasEntry', args: %w(title Animation) }.to_json
|
64
86
|
#
|
65
87
|
# # For iOS
|
66
88
|
# ## With :predicate
|
67
|
-
# find_elements :predicate, "isWDVisible == 1"
|
68
|
-
# find_elements :predicate, 'wdName == "Buttons"'
|
69
|
-
# find_elements :predicate, 'wdValue == "SearchBar" AND isWDDivisible == 1'
|
89
|
+
# @driver.find_elements :predicate, "isWDVisible == 1"
|
90
|
+
# @driver.find_elements :predicate, 'wdName == "Buttons"'
|
91
|
+
# @driver.find_elements :predicate, 'wdValue == "SearchBar" AND isWDDivisible == 1'
|
70
92
|
#
|
71
93
|
# ## With Class Chain
|
72
94
|
# ### select the third child button of the first child window element
|
73
|
-
# find_elements :class_chain, 'XCUIElementTypeWindow/XCUIElementTypeButton[3]'
|
95
|
+
# @driver.find_elements :class_chain, 'XCUIElementTypeWindow/XCUIElementTypeButton[3]'
|
74
96
|
# ### select all the children windows
|
75
|
-
# find_elements :class_chain, 'XCUIElementTypeWindow'
|
97
|
+
# @driver.find_elements :class_chain, 'XCUIElementTypeWindow'
|
76
98
|
# ### select the second last child of the second child window
|
77
|
-
# find_elements :class_chain, 'XCUIElementTypeWindow[2]/XCUIElementTypeAny[-2]'
|
99
|
+
# @driver.find_elements :class_chain, 'XCUIElementTypeWindow[2]/XCUIElementTypeAny[-2]'
|
78
100
|
# ### matching predicate. <code>`</code> is the mark.
|
79
|
-
# find_elements :class_chain, 'XCUIElementTypeWindow[`visible = 1][`name = "bla"`]'
|
101
|
+
# @driver.find_elements :class_chain, 'XCUIElementTypeWindow[`visible = 1][`name = "bla"`]'
|
80
102
|
# ### containing predicate. `$` is the mark.
|
81
103
|
# ### Require appium-xcuitest-driver 2.54.0+. PR: https://github.com/facebook/WebDriverAgent/pull/707/files
|
82
|
-
# find_elements :class_chain, 'XCUIElementTypeWindow[$name = \"bla$$$bla\"$]'
|
104
|
+
# @driver.find_elements :class_chain, 'XCUIElementTypeWindow[$name = \"bla$$$bla\"$]'
|
83
105
|
# e = find_element :class_chain, "**/XCUIElementTypeWindow[$name == 'Buttons'$]"
|
84
106
|
# e.tag_name #=> "XCUIElementTypeWindow"
|
85
107
|
# e = find_element :class_chain, "**/XCUIElementTypeStaticText[$name == 'Buttons'$]"
|
86
108
|
# e.tag_name #=> "XCUIElementTypeStaticText"
|
87
109
|
#
|
88
110
|
# # For Windows
|
89
|
-
# find_elements :windows_uiautomation, '....'
|
111
|
+
# @driver.find_elements :windows_uiautomation, '....'
|
90
112
|
#
|
91
113
|
# # For Tizen
|
92
|
-
# find_elements :tizen_uiautomation, '....'
|
114
|
+
# @driver.find_elements :tizen_uiautomation, '....'
|
93
115
|
#
|
116
|
+
# rubocop:enable Metrics/LineLength
|
94
117
|
def find_element(*args)
|
95
118
|
how, what = extract_args(args)
|
96
119
|
by = _set_by_from_finders(how)
|
@@ -22,9 +22,8 @@ module Appium
|
|
22
22
|
visualize: [true, false]
|
23
23
|
}.freeze
|
24
24
|
|
25
|
-
#
|
26
|
-
#
|
27
|
-
# Performs images matching by features with default options. Read https://docs.opencv.org/3.0-beta/doc/py_tutorials/py_feature2d/py_matcher/py_matcher.html
|
25
|
+
# Performs images matching by features with default options.
|
26
|
+
# Read {https://docs.opencv.org/3.0-beta/doc/py_tutorials/py_feature2d/py_matcher/py_matcher.html py_matcher}
|
28
27
|
# for more details on this topic.
|
29
28
|
#
|
30
29
|
# @param [String] first_image An image data. All image formats, that OpenCV library itself accepts, are supported.
|
@@ -36,8 +35,8 @@ module Appium
|
|
36
35
|
# @param [String] match_func The name of the matching function. The default one is 'BruteForce'.
|
37
36
|
# @param [String] good_matches_factor The maximum count of "good" matches (e. g. with minimal distances).
|
38
37
|
# The default one is nil.
|
39
|
-
# @param [Bool]
|
40
|
-
#
|
38
|
+
# @param [Bool] visualize Makes the endpoint to return an image, which contains the visualized result of
|
39
|
+
# the corresponding picture matching operation. This option is disabled by default.
|
41
40
|
#
|
42
41
|
# @example
|
43
42
|
# @driver.match_images_features first_image: "image data 1", second_image: "image data 2"
|
@@ -45,63 +44,6 @@ module Appium
|
|
45
44
|
# visual = @@driver.match_images_features first_image: image1, second_image: image2, visualize: true
|
46
45
|
# File.write 'match_images_visual.png', Base64.decode64(visual['visualization']) # if the image is PNG
|
47
46
|
#
|
48
|
-
|
49
|
-
# @!method find_image_occurrence(full_image:, partial_image:, visualize: false, threshold: nil)
|
50
|
-
# Performs images matching by template to find possible occurrence of the partial image
|
51
|
-
# in the full image with default options. Read https://docs.opencv.org/2.4/doc/tutorials/imgproc/histograms/template_matching/template_matching.html
|
52
|
-
# for more details on this topic.
|
53
|
-
#
|
54
|
-
# @param [String] full_image: A full image data.
|
55
|
-
# @param [String] partial_image: A partial image data. All image formats, that OpenCV library itself accepts,
|
56
|
-
# are supported.
|
57
|
-
# @param [Bool] visualise: Makes the endpoint to return an image, which contains the visualized result of
|
58
|
-
# the corresponding picture matching operation. This option is disabled by default.
|
59
|
-
# @param [Float] threshold: [0.5] At what normalized threshold to reject
|
60
|
-
#
|
61
|
-
# @example
|
62
|
-
# @driver.find_image_occurrence full_image: "image data 1", partial_image: "image data 2"
|
63
|
-
#
|
64
|
-
# visual = @@driver.find_image_occurrence full_image: image1, partial_image: image2, visualize: true
|
65
|
-
# File.write 'find_result_visual.png', Base64.decode64(visual['visualization']) # if the image is PNG
|
66
|
-
#
|
67
|
-
|
68
|
-
# @!method get_images_similarity(first_image:, second_image:, detector_name: 'ORB', visualize: false)
|
69
|
-
# Performs images matching to calculate the similarity score between them
|
70
|
-
# with default options. The flow there is similar to the one used in `find_image_occurrence`
|
71
|
-
# but it is mandatory that both images are of equal size.
|
72
|
-
#
|
73
|
-
# @param [String] first_image: An image data. All image formats, that OpenCV library itself accepts, are supported.
|
74
|
-
# @param [String] second_image: An image data. All image formats, that OpenCV library itself accepts, are supported.
|
75
|
-
# @param [Bool] visualise: Makes the endpoint to return an image, which contains the visualized result of
|
76
|
-
# the corresponding picture matching operation. This option is disabled by default.
|
77
|
-
#
|
78
|
-
# @example
|
79
|
-
# @driver.get_images_similarity first_image: "image data 1", second_image: "image data 2"
|
80
|
-
#
|
81
|
-
# visual = @@driver.get_images_similarity first_image: image1, second_image: image2, visualize: true
|
82
|
-
# File.write 'images_similarity_visual.png', Base64.decode64(visual['visualization']) # if the image is PNG
|
83
|
-
#
|
84
|
-
|
85
|
-
# @!method compare_images(mode:, first_image:, second_image:, options:)
|
86
|
-
#
|
87
|
-
# Performs images comparison using OpenCV framework features.
|
88
|
-
# It is expected that both OpenCV framework and opencv4nodejs
|
89
|
-
# module are installed on the machine where Appium server is running.
|
90
|
-
#
|
91
|
-
# @param [Symbol] mode: One of possible comparison modes: `:matchFeatures`, `:getSimilarity`, `:matchTemplate`.
|
92
|
-
# `:matchFeatures is by default.
|
93
|
-
# @param [String] first_image: An image data. All image formats, that OpenCV library itself accepts, are supported.
|
94
|
-
# @param [String] second_image: An image data. All image formats, that OpenCV library itself accepts, are supported.
|
95
|
-
# @param [Hash] options: The content of this dictionary depends on the actual `mode` value.
|
96
|
-
# See the documentation on `appium-support` module for more details.
|
97
|
-
# @returns [Hash] The content of the resulting dictionary depends on the actual `mode` and `options` values.
|
98
|
-
# See the documentation on `appium-support` module for more details.
|
99
|
-
#
|
100
|
-
|
101
|
-
####
|
102
|
-
## class << self
|
103
|
-
####
|
104
|
-
|
105
47
|
def match_images_features(first_image:,
|
106
48
|
second_image:,
|
107
49
|
detector_name: 'ORB',
|
@@ -127,6 +69,25 @@ module Appium
|
|
127
69
|
compare_images(mode: :matchFeatures, first_image: first_image, second_image: second_image, options: options)
|
128
70
|
end
|
129
71
|
|
72
|
+
# Performs images matching by template to find possible occurrence of the partial image
|
73
|
+
# in the full image with default options. Read
|
74
|
+
# {https://docs.opencv.org/2.4/doc/tutorials/imgproc/histograms/template_matching/template_matching.html
|
75
|
+
# template_matching}
|
76
|
+
# for more details on this topic.
|
77
|
+
#
|
78
|
+
# @param [String] full_image A full image data.
|
79
|
+
# @param [String] partial_image A partial image data. All image formats, that OpenCV library itself accepts,
|
80
|
+
# are supported.
|
81
|
+
# @param [Bool] visualize Makes the endpoint to return an image, which contains the visualized result of
|
82
|
+
# the corresponding picture matching operation. This option is disabled by default.
|
83
|
+
# @param [Float] threshold [0.5] At what normalized threshold to reject
|
84
|
+
#
|
85
|
+
# @example
|
86
|
+
# @driver.find_image_occurrence full_image: "image data 1", partial_image: "image data 2"
|
87
|
+
#
|
88
|
+
# visual = @@driver.find_image_occurrence full_image: image1, partial_image: image2, visualize: true
|
89
|
+
# File.write 'find_result_visual.png', Base64.decode64(visual['visualization']) # if the image is PNG
|
90
|
+
#
|
130
91
|
def find_image_occurrence(full_image:, partial_image:, visualize: false, threshold: nil)
|
131
92
|
raise "visualize should be #{MATCH_TEMPLATE[:visualize]}" unless MATCH_TEMPLATE[:visualize].member?(visualize)
|
132
93
|
|
@@ -137,6 +98,21 @@ module Appium
|
|
137
98
|
compare_images(mode: :matchTemplate, first_image: full_image, second_image: partial_image, options: options)
|
138
99
|
end
|
139
100
|
|
101
|
+
# Performs images matching to calculate the similarity score between them
|
102
|
+
# with default options. The flow there is similar to the one used in `find_image_occurrence`
|
103
|
+
# but it is mandatory that both images are of equal size.
|
104
|
+
#
|
105
|
+
# @param [String] first_image An image data. All image formats, that OpenCV library itself accepts, are supported.
|
106
|
+
# @param [String] second_image An image data. All image formats, that OpenCV library itself accepts, are supported.
|
107
|
+
# @param [Bool] visualize Makes the endpoint to return an image, which contains the visualized result of
|
108
|
+
# the corresponding picture matching operation. This option is disabled by default.
|
109
|
+
#
|
110
|
+
# @example
|
111
|
+
# @driver.get_images_similarity first_image: "image data 1", second_image: "image data 2"
|
112
|
+
#
|
113
|
+
# visual = @@driver.get_images_similarity first_image: image1, second_image: image2, visualize: true
|
114
|
+
# File.write 'images_similarity_visual.png', Base64.decode64(visual['visualization']) # if the image is PNG
|
115
|
+
#
|
140
116
|
def get_images_similarity(first_image:, second_image:, visualize: false)
|
141
117
|
raise "visualize should be #{GET_SIMILARITY[:visualize]}" unless GET_SIMILARITY[:visualize].member?(visualize)
|
142
118
|
|
@@ -146,6 +122,19 @@ module Appium
|
|
146
122
|
compare_images(mode: :getSimilarity, first_image: first_image, second_image: second_image, options: options)
|
147
123
|
end
|
148
124
|
|
125
|
+
# Performs images comparison using OpenCV framework features.
|
126
|
+
# It is expected that both OpenCV framework and opencv4nodejs
|
127
|
+
# module are installed on the machine where Appium server is running.
|
128
|
+
#
|
129
|
+
# @param [Symbol] mode One of possible comparison modes: `:matchFeatures`, `:getSimilarity`, `:matchTemplate`.
|
130
|
+
# `:matchFeatures is by default.
|
131
|
+
# @param [String] first_image An image data. All image formats, that OpenCV library itself accepts, are supported.
|
132
|
+
# @param [String] second_image An image data. All image formats, that OpenCV library itself accepts, are supported.
|
133
|
+
# @param [Hash] options The content of this dictionary depends on the actual `mode` value.
|
134
|
+
# See the documentation on `appium-support` module for more details.
|
135
|
+
# @return [Hash] The content of the resulting dictionary depends on the actual `mode` and `options` values.
|
136
|
+
# See the documentation on `appium-support` module for more details.
|
137
|
+
#
|
149
138
|
def compare_images(mode: :matchFeatures, first_image:, second_image:, options: nil)
|
150
139
|
raise "content_type should be #{MODE}" unless MODE.member?(mode)
|
151
140
|
|
@@ -14,11 +14,11 @@ module Appium
|
|
14
14
|
#
|
15
15
|
# If only a number is provided then it's treated as the timeout value.
|
16
16
|
#
|
17
|
-
# @param [Integer] timeout
|
18
|
-
# @param [Integer] interval
|
19
|
-
# @param [String] message
|
20
|
-
# @param [Array, Exception] ignored
|
21
|
-
# @param [Object, NilClass] object
|
17
|
+
# @param [Integer] timeout Seconds to wait before timing out. Set default by `appium_wait_timeout` (30).
|
18
|
+
# @param [Integer] interval Seconds to sleep between polls. Set default by `appium_wait_interval` (0.5).
|
19
|
+
# @param [String] message Exception message if timed out.
|
20
|
+
# @param [Array, Exception] ignored Exceptions to ignore while polling (default: Exception)
|
21
|
+
# @param [Object, NilClass] object Object to evaluate block against
|
22
22
|
#
|
23
23
|
# @example
|
24
24
|
#
|
@@ -58,11 +58,11 @@ module Appium
|
|
58
58
|
#
|
59
59
|
# If only a number is provided then it's treated as the timeout value.
|
60
60
|
#
|
61
|
-
# @param [Integer] timeout
|
62
|
-
# @param [Integer] interval
|
63
|
-
# @param [String] message
|
64
|
-
# @param [Array, Exception] ignored
|
65
|
-
# @param [Object, NilClass] object
|
61
|
+
# @param [Integer] timeout Seconds to wait before timing out. Set default by `appium_wait_timeout` (30).
|
62
|
+
# @param [Integer] interval Seconds to sleep between polls. Set default by `appium_wait_interval` (0.5).
|
63
|
+
# @param [String] message Exception message if timed out.
|
64
|
+
# @param [Array, Exception] ignored Exceptions to ignore while polling (default: Exception)
|
65
|
+
# @param [Object, NilClass] object Object to evaluate block against
|
66
66
|
#
|
67
67
|
# @example
|
68
68
|
#
|
@@ -114,10 +114,10 @@ module Appium
|
|
114
114
|
#
|
115
115
|
# If only a number is provided then it's treated as the timeout value.
|
116
116
|
#
|
117
|
-
# @param [Integer] timeout
|
118
|
-
# @param [Integer] interval
|
119
|
-
# @param [String] message
|
120
|
-
# @param [Array, Exception] ignored
|
117
|
+
# @param [Integer] timeout Seconds to wait before timing out. Set default by `appium_wait_timeout` (30).
|
118
|
+
# @param [Integer] interval Seconds to sleep between polls. Set default by `appium_wait_interval` (0.5).
|
119
|
+
# @param [String] message Exception message if timed out.
|
120
|
+
# @param [Array, Exception] ignored Exceptions to ignore while polling (default: Exception)
|
121
121
|
#
|
122
122
|
# @example
|
123
123
|
#
|
@@ -136,10 +136,10 @@ module Appium
|
|
136
136
|
#
|
137
137
|
# If only a number is provided then it's treated as the timeout value.
|
138
138
|
#
|
139
|
-
# @param [Integer] timeout
|
140
|
-
# @param [Integer] interval
|
141
|
-
# @param [String] message
|
142
|
-
# @param [Array, Exception] ignored
|
139
|
+
# @param [Integer] timeout Seconds to wait before timing out. Set default by `appium_wait_timeout` (30).
|
140
|
+
# @param [Integer] interval Seconds to sleep between polls. Set default by `appium_wait_interval` (0.5).
|
141
|
+
# @param [String] message Exception message if timed out.
|
142
|
+
# @param [Array, Exception] ignored Exceptions to ignore while polling (default: Exception)
|
143
143
|
#
|
144
144
|
# @example
|
145
145
|
#
|
@@ -10,14 +10,14 @@ module Appium
|
|
10
10
|
# Uses eventmachine to wait response from the peer. The eventmachine works on a thread. The thread will exit
|
11
11
|
# with close method.
|
12
12
|
#
|
13
|
-
# @param [String] url
|
14
|
-
#
|
15
|
-
# @param [Array] protocols
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
# @param [Hash] options
|
20
|
-
#
|
13
|
+
# @param [String] url URL to establish web socket connection. If the URL has no port, the client use:
|
14
|
+
# `ws`: 80, `wss`: 443 ports.
|
15
|
+
# @param [Array] protocols An array of strings representing acceptable subprotocols for use over the socket.
|
16
|
+
# The driver will negotiate one of these to use via the Sec-WebSocket-Protocol header
|
17
|
+
# if supported by the other peer. Default is nil.
|
18
|
+
# The protocols is equal to https://github.com/faye/faye-websocket-ruby/ 's one for client.
|
19
|
+
# @param [Hash] options Initialize options for Faye client. Read https://github.com/faye/faye-websocket-ruby#initialization-options
|
20
|
+
# for more details. Default is `{}`.
|
21
21
|
#
|
22
22
|
# @example
|
23
23
|
# ws = WebSocket.new(url: "ws://#{host}:#{port}/ws/session/#{@session_id}/appium/device/logcat")
|
@@ -57,7 +57,7 @@ module Appium
|
|
57
57
|
# Sends a ping frame with an optional message and fires the callback when a matching pong is received.
|
58
58
|
#
|
59
59
|
# @param [String] message A message to send ping.
|
60
|
-
# @param [Block]
|
60
|
+
# @param [Block] callback
|
61
61
|
#
|
62
62
|
# @example
|
63
63
|
# ws = WebSocket.new(url: "ws://#{host}:#{port}/ws/session/#{@session_id}/appium/device/logcat")
|
@@ -82,8 +82,8 @@ module Appium
|
|
82
82
|
|
83
83
|
# Closes the connection, sending the given status code and reason text, both of which are optional.
|
84
84
|
#
|
85
|
-
# @param [Integer] code
|
86
|
-
# @param [String] reason
|
85
|
+
# @param [Integer] code A status code to send to the peer with close signal. Default is nil.
|
86
|
+
# @param [String] reason A reason to send to the peer with close signal. Default is 'close from ruby_lib_core'.
|
87
87
|
#
|
88
88
|
# @example
|
89
89
|
# ws = WebSocket.new(url: "ws://#{host}:#{port}/ws/session/#{@session_id}/appium/device/logcat")
|
@@ -13,6 +13,41 @@ module Appium
|
|
13
13
|
autoload :Xcuitest, 'appium_lib_core/ios_xcuitest'
|
14
14
|
end
|
15
15
|
|
16
|
+
# This options affects only client side as <code>:appium_lib</code> key.<br>
|
17
|
+
# Read {::Appium::Core::Driver} about each attribute
|
18
|
+
class Options
|
19
|
+
attr_reader :custom_url, :default_wait, :export_session, :export_session_path,
|
20
|
+
:port, :wait_timeout, :wait_interval, :listener,
|
21
|
+
:direct_connect
|
22
|
+
|
23
|
+
def initialize(appium_lib_opts)
|
24
|
+
@custom_url = appium_lib_opts.fetch :server_url, nil
|
25
|
+
@default_wait = appium_lib_opts.fetch :wait, Driver::DEFAULT_IMPLICIT_WAIT
|
26
|
+
|
27
|
+
# bump current session id into a particular file
|
28
|
+
@export_session = appium_lib_opts.fetch :export_session, false
|
29
|
+
@export_session_path = appium_lib_opts.fetch :export_session_path, default_tmp_appium_lib_session
|
30
|
+
|
31
|
+
@direct_connect = appium_lib_opts.fetch :direct_connect, false
|
32
|
+
|
33
|
+
@port = appium_lib_opts.fetch :port, Driver::DEFAULT_APPIUM_PORT
|
34
|
+
|
35
|
+
# timeout and interval used in ::Appium::Comm.wait/wait_true
|
36
|
+
@wait_timeout = appium_lib_opts.fetch :wait_timeout, ::Appium::Core::Wait::DEFAULT_TIMEOUT
|
37
|
+
@wait_interval = appium_lib_opts.fetch :wait_interval, ::Appium::Core::Wait::DEFAULT_INTERVAL
|
38
|
+
|
39
|
+
# to pass it in Selenium.new.
|
40
|
+
# `listener = opts.delete(:listener)` is called in Selenium::Driver.new
|
41
|
+
@listener = appium_lib_opts.fetch :listener, nil
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def default_tmp_appium_lib_session
|
47
|
+
::Appium::Core::Base.platform.windows? ? 'C:\\\\Windows\\Temp\\appium_lib_session' : '/tmp/appium_lib_session'
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
16
51
|
class Driver
|
17
52
|
include Waitable
|
18
53
|
# Selenium webdriver capabilities
|
@@ -27,13 +62,13 @@ module Appium
|
|
27
62
|
# @return [Symbol] :android and :ios, for example
|
28
63
|
attr_reader :device
|
29
64
|
|
30
|
-
# Automation name sent to appium server or received
|
31
|
-
# If automation_name is nil
|
65
|
+
# Automation name sent to appium server or received by server.<br>
|
66
|
+
# If automation_name is <code>nil</code>, it is not set both client side and server side.
|
32
67
|
# @return [Hash]
|
33
68
|
attr_reader :automation_name
|
34
69
|
|
35
|
-
# Custom URL for the selenium server. If set this attribute, ruby_lib_core try to handshake to the custom url
|
36
|
-
#
|
70
|
+
# Custom URL for the selenium server. If set this attribute, ruby_lib_core try to handshake to the custom url.<br>
|
71
|
+
# Defaults to false. Then try to connect to <code>http://127.0.0.1:#{port}/wd/hub<code>.
|
37
72
|
# @return [String]
|
38
73
|
attr_reader :custom_url
|
39
74
|
|
@@ -44,28 +79,28 @@ module Appium
|
|
44
79
|
attr_reader :export_session_path
|
45
80
|
|
46
81
|
# Default wait time for elements to appear in Appium server side.
|
47
|
-
#
|
48
|
-
# Provide
|
82
|
+
# Defaults to {::Appium::Core::Driver::DEFAULT_IMPLICIT_WAIT}.<br>
|
83
|
+
# Provide <code>{ appium_lib: { wait: 30 } }</code> to {::Appium::Core.for}
|
49
84
|
# @return [Integer]
|
50
85
|
attr_reader :default_wait
|
51
86
|
DEFAULT_IMPLICIT_WAIT = 0
|
52
87
|
|
53
|
-
# Appium's server port. 4723 is by default.
|
54
|
-
# Provide
|
55
|
-
#
|
88
|
+
# Appium's server port. 4723 is by default. Defaults to {::Appium::Core::Driver::DEFAULT_APPIUM_PORT}.<br>
|
89
|
+
# Provide <code>{ appium_lib: { port: 8080 } }</code> to {::Appium::Core.for}.
|
90
|
+
# <code>:custom_url</code> is prior than <code>:port</code> if <code>:custom_url</code> is set.
|
56
91
|
# @return [Integer]
|
57
92
|
attr_reader :port
|
58
93
|
DEFAULT_APPIUM_PORT = 4723
|
59
94
|
|
60
|
-
# Return a time wait timeout. 30 seconds is by default
|
61
|
-
# Wait time for ::Appium::Core::Base::Wait, wait and wait_true
|
62
|
-
# Provide
|
95
|
+
# Return a time wait timeout. 30 seconds is by default {::Appium::Core::Wait::DEFAULT_TIMEOUT}.<br>
|
96
|
+
# Wait time for {::Appium::Core::Base::Wait}, wait and wait_true.<br>
|
97
|
+
# Provide <code>{ appium_lib: { wait_timeout: 20 } }</code> to {::Appium::Core.for}.
|
63
98
|
# @return [Integer]
|
64
99
|
attr_reader :wait_timeout
|
65
100
|
|
66
|
-
# Return a time to wait interval. 0.5 seconds is by default
|
67
|
-
# Wait interval time for ::Appium::Core::Base::Wait, wait and wait_true
|
68
|
-
# Provide
|
101
|
+
# Return a time to wait interval. 0.5 seconds is by default {::Appium::Core::Wait::DEFAULT_INTERVAL}.<br>
|
102
|
+
# Wait interval time for {::Appium::Core::Base::Wait}, wait and wait_true.<br>
|
103
|
+
# Provide <code>{ appium_lib: { wait_interval: 0.1 } }</code> to {::Appium::Core.for}.
|
69
104
|
# @return [Integer]
|
70
105
|
attr_reader :wait_interval
|
71
106
|
|
@@ -76,19 +111,30 @@ module Appium
|
|
76
111
|
# @return [Appium::Core::Base::Driver]
|
77
112
|
attr_reader :driver
|
78
113
|
|
79
|
-
# [Experimental feature]
|
80
|
-
# Enable an experimental feature updating
|
81
|
-
#
|
82
|
-
# capability in _create session_.
|
114
|
+
# <b>[Experimental feature]</b><br>
|
115
|
+
# Enable an experimental feature updating Http client endpoint following below keys by Appium/Selenium server.<br>
|
116
|
+
# This works with {Appium::Core::Base::Http::Default}.
|
83
117
|
#
|
84
|
-
#
|
118
|
+
# If your Selenium/Appium server decorates the new session capabilities response with the following keys:<br>
|
119
|
+
# - <code>directConnectProtocol</code>
|
120
|
+
# - <code>directConnectHost</code>
|
121
|
+
# - <code>directConnectPort</code>
|
122
|
+
# - <code>directConnectPath</code>
|
123
|
+
#
|
124
|
+
# Ignore them if this parameter is <code>false</code>. Defaults to false.
|
85
125
|
#
|
86
126
|
# @return [Bool]
|
87
127
|
attr_reader :direct_connect
|
88
128
|
|
89
|
-
# Creates a new
|
90
|
-
# @param [Class] target Extend particular methods to this target.
|
129
|
+
# Creates a new driver and extend particular methods
|
91
130
|
# @param [Hash] opts A options include capabilities for the Appium Server and for the client.
|
131
|
+
# @option opts [Hash] :caps Appium capabilities. Prior than :desired_capabilities
|
132
|
+
# @option opts [Hash] :desired_capabilities The same as :caps.
|
133
|
+
# This param is for compatibility with Selenium WebDriver format
|
134
|
+
# @option opts [Appium::Core::Options] :appium_lib Capabilities affect only ruby client
|
135
|
+
# @option opts [String] :url The same as :custom_url in :appium_lib.
|
136
|
+
# This param is for compatibility with Selenium WebDriver format
|
137
|
+
#
|
92
138
|
# @return [Driver]
|
93
139
|
#
|
94
140
|
# @example
|
@@ -464,25 +510,25 @@ module Appium
|
|
464
510
|
end
|
465
511
|
|
466
512
|
# @private
|
513
|
+
# Below capabilities are set only for client side.
|
467
514
|
def set_appium_lib_specific_values(appium_lib_opts)
|
468
|
-
|
469
|
-
@default_wait = appium_lib_opts.fetch :wait, DEFAULT_IMPLICIT_WAIT
|
515
|
+
opts = Options.new appium_lib_opts
|
470
516
|
|
471
|
-
#
|
472
|
-
@export_session = appium_lib_opts.fetch :export_session, false
|
473
|
-
@export_session_path = appium_lib_opts.fetch :export_session_path, default_tmp_appium_lib_session
|
517
|
+
@custom_url ||= opts.custom_url # Keep existence capability if it's already provided
|
474
518
|
|
475
|
-
@
|
519
|
+
@default_wait = opts.default_wait
|
476
520
|
|
477
|
-
@
|
521
|
+
@export_session = opts.export_session
|
522
|
+
@export_session_path = opts.export_session_path
|
478
523
|
|
479
|
-
|
480
|
-
@wait_timeout = appium_lib_opts.fetch :wait_timeout, ::Appium::Core::Wait::DEFAULT_TIMEOUT
|
481
|
-
@wait_interval = appium_lib_opts.fetch :wait_interval, ::Appium::Core::Wait::DEFAULT_INTERVAL
|
524
|
+
@port = opts.port
|
482
525
|
|
483
|
-
|
484
|
-
|
485
|
-
|
526
|
+
@wait_timeout = opts.wait_timeout
|
527
|
+
@wait_interval = opts.wait_interval
|
528
|
+
|
529
|
+
@listener = opts.listener
|
530
|
+
|
531
|
+
@direct_connect = opts.direct_connect
|
486
532
|
end
|
487
533
|
|
488
534
|
# @private
|
@@ -511,11 +557,6 @@ module Appium
|
|
511
557
|
end
|
512
558
|
end
|
513
559
|
|
514
|
-
# @private
|
515
|
-
def default_tmp_appium_lib_session
|
516
|
-
::Appium::Core::Base.platform.windows? ? 'C:\\\\Windows\\Temp\\appium_lib_session' : '/tmp/appium_lib_session'
|
517
|
-
end
|
518
|
-
|
519
560
|
# @private
|
520
561
|
def write_session_id(session_id, export_path = '/tmp/appium_lib_session')
|
521
562
|
export_path.tr!('/', '\\') if ::Appium::Core::Base.platform.windows?
|
@@ -37,13 +37,13 @@ module Appium
|
|
37
37
|
#
|
38
38
|
|
39
39
|
# @since Appium 1.9.1
|
40
|
-
# @!method start_recording_screen(remote_path: nil, user: nil, pass: nil, method: nil, force_restart: nil, video_type: 'mjpeg', time_limit: '180', video_quality: 'medium', video_scale: '320:240')
|
40
|
+
# @!method start_recording_screen(remote_path: nil, user: nil, pass: nil, method: nil, force_restart: nil, video_type: 'mjpeg', video_fps: nil, time_limit: '180', video_quality: 'medium', video_scale: '320:240')
|
41
41
|
#
|
42
42
|
# Record the display of devices running iOS Simulator since Xcode 9 or real devices since iOS 11
|
43
43
|
# (ffmpeg utility is required: 'brew install ffmpeg').
|
44
44
|
# We would recommend to play the video by VLC or Mplayer if you can not play the video with other video players.
|
45
45
|
#
|
46
|
-
# @param [String] remote_path
|
46
|
+
# @param [String] remote_path The path to the remote location, where the resulting video should be uploaded.
|
47
47
|
# The following protocols are supported: http/https, ftp.
|
48
48
|
# Null or empty string value (the default setting) means the content of resulting
|
49
49
|
# file should be encoded as Base64 and passed as the endpount response value.
|
@@ -51,21 +51,21 @@ module Appium
|
|
51
51
|
# fit into the available process memory.
|
52
52
|
# This option only has an effect if there is screen recording process in progreess
|
53
53
|
# and `forceRestart` parameter is not set to `true`.
|
54
|
-
# @param [String] user
|
55
|
-
# @param [String] pass
|
56
|
-
# @param [String] method
|
57
|
-
# @param [Boolean] force_restart
|
58
|
-
#
|
59
|
-
#
|
60
|
-
# @param [String] video_type
|
61
|
-
#
|
62
|
-
#
|
63
|
-
# @param [String] time_limit
|
64
|
-
# @param [String] video_quality
|
65
|
-
# @param [String] video_fps
|
66
|
-
#
|
67
|
-
# @param [String] video_scale
|
68
|
-
#
|
54
|
+
# @param [String] user The name of the user for the remote authentication.
|
55
|
+
# @param [String] pass The password for the remote authentication.
|
56
|
+
# @param [String] method The http multipart upload method name. The 'PUT' one is used by default.
|
57
|
+
# @param [Boolean] force_restart Whether to try to catch and upload/return the currently running screen recording
|
58
|
+
# (`false`, the default setting on server) or ignore the result of it
|
59
|
+
# and start a new recording immediately (`true`).
|
60
|
+
# @param [String] video_type The video codec type used for encoding of the be recorded screen capture.
|
61
|
+
# Execute `ffmpeg -codecs` in the terminal to see the list of supported video codecs.
|
62
|
+
# 'mjpeg' by default.
|
63
|
+
# @param [String] time_limit Recording time. 180 seconds is by default.
|
64
|
+
# @param [String] video_quality The video encoding quality (low, medium, high, photo - defaults to medium).
|
65
|
+
# @param [String] video_fps The Frames Per Second rate of the recorded video. Change this value if the resulting video
|
66
|
+
# is too slow or too fast. Defaults to 10. This can decrease the resulting file size.
|
67
|
+
# @param [String] video_scale The scaling value to apply. Read https://trac.ffmpeg.org/wiki/Scaling for possible values.
|
68
|
+
# No scale is applied by default.
|
69
69
|
#
|
70
70
|
# @example
|
71
71
|
#
|
@@ -75,21 +75,21 @@ module Appium
|
|
75
75
|
#
|
76
76
|
|
77
77
|
# @since Appium 1.3.4
|
78
|
-
# @!method start_performance_record(timeout: 300000, profile_name: 'Activity Monitor')
|
78
|
+
# @!method start_performance_record(timeout: 300000, profile_name: 'Activity Monitor', pid: nil)
|
79
79
|
#
|
80
80
|
# This is a blocking application. Read https://help.apple.com/instruments/mac/current/ to understand the profiler.
|
81
81
|
#
|
82
|
-
# @param [Integer|String] timeout
|
83
|
-
# @param [String] profile_name
|
84
|
-
#
|
85
|
-
#
|
86
|
-
# @param [Integer|String] pid
|
87
|
-
#
|
88
|
-
#
|
89
|
-
#
|
90
|
-
#
|
91
|
-
#
|
92
|
-
#
|
82
|
+
# @param [Integer|String] timeout The maximum count of milliseconds to record the profiling information.
|
83
|
+
# @param [String] profile_name The name of existing performance profile to apply.
|
84
|
+
# Execute `instruments -s` to show the list of available profiles.
|
85
|
+
# Note, that not all profiles are supported on mobile devices.
|
86
|
+
# @param [Integer|String] pid The ID of the process to measure the performance for.
|
87
|
+
# Set it to `current` in order to measure the performance of
|
88
|
+
# the process, which belongs to the currently active application.
|
89
|
+
# All processes running on the device are measured if
|
90
|
+
# pid is unset (the default setting). Setting process ID while
|
91
|
+
# device under test is Simulator might require `instruments` to be launched
|
92
|
+
# with sudo privileges, which is not supported and will throw a timeout exception.
|
93
93
|
# @return nil
|
94
94
|
#
|
95
95
|
# @example
|
@@ -103,22 +103,19 @@ module Appium
|
|
103
103
|
#
|
104
104
|
# This is a blocking application.
|
105
105
|
#
|
106
|
-
# @param [String] save_file_path
|
107
|
-
# @param [String] profile_name
|
108
|
-
# Execute `instruments -s` to show the list of available profiles.
|
109
|
-
# Note, that not all profiles are supported on mobile devices.
|
110
|
-
# @param [String] save_file_path: The name of existing performance profile to apply.
|
106
|
+
# @param [String] save_file_path A path to save data as zipped .trace file
|
107
|
+
# @param [String] profile_name The name of existing performance profile to apply.
|
111
108
|
# Execute `instruments -s` to show the list of available profiles.
|
112
109
|
# Note, that not all profiles are supported on mobile devices.
|
113
|
-
# @param [String] remote_path
|
114
|
-
#
|
115
|
-
#
|
116
|
-
#
|
117
|
-
#
|
118
|
-
#
|
119
|
-
# @param [String] user
|
120
|
-
# @param [String] pass
|
121
|
-
# @param [String] method
|
110
|
+
# @param [String] remote_path The path to the remote location, where the resulting zipped .trace file should be uploaded.
|
111
|
+
# The following protocols are supported: http/https, ftp.
|
112
|
+
# Null or empty string value (the default setting) means the content of resulting
|
113
|
+
# file should be zipped, encoded as Base64 and passed as the endpount response value.
|
114
|
+
# An exception will be thrown if the generated file is too big to
|
115
|
+
# fit into the available process memory.
|
116
|
+
# @param [String] user The name of the user for the remote authentication. Only works if `remotePath` is provided.
|
117
|
+
# @param [String] pass The password for the remote authentication. Only works if `remotePath` is provided.
|
118
|
+
# @param [String] method The http multipart upload method name. Only works if `remotePath` is provided.
|
122
119
|
#
|
123
120
|
# @example
|
124
121
|
#
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Appium
|
2
2
|
module Core
|
3
|
-
VERSION = '3.0.
|
4
|
-
DATE = '2019-02-
|
3
|
+
VERSION = '3.0.1'.freeze unless defined? ::Appium::Core::VERSION
|
4
|
+
DATE = '2019-02-25'.freeze unless defined? ::Appium::Core::DATE
|
5
5
|
end
|
6
6
|
end
|
data/release_notes.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
#### v3.0.1 2019-02-25
|
2
|
+
|
3
|
+
- [8a63795](https://github.com/appium/ruby_lib_core/commit/8a63795df8ac9caa9a5e2208b69211a7db841108) Release 3.0.1
|
4
|
+
- [4d20509](https://github.com/appium/ruby_lib_core/commit/4d20509acca21e75e8e30a127be52b0c9c75f7a4) Separate appium lib (#194)
|
5
|
+
- [4c5ff26](https://github.com/appium/ruby_lib_core/commit/4c5ff26b1eb4439f7b8185e91429a3f315cd736a) tweak yardoc
|
6
|
+
- [22730a7](https://github.com/appium/ruby_lib_core/commit/22730a7dcfcc843c3030f4c89e3f9ee8fbf5c194) add strict find image (#193)
|
7
|
+
- [f6a3f7f](https://github.com/appium/ruby_lib_core/commit/f6a3f7f6eed308652265bd9527cf584e271292f2) add webatom example (#192)
|
8
|
+
- [3cd8585](https://github.com/appium/ruby_lib_core/commit/3cd8585b22d4a97958e6df0a29573d8b699e0c98) add a link to matcher
|
9
|
+
- [1dad363](https://github.com/appium/ruby_lib_core/commit/1dad3639c879b221480c7181b8f0fa74c6a1f6ae) clean yardoc style (#191)
|
10
|
+
- [712f6b1](https://github.com/appium/ruby_lib_core/commit/712f6b1d614369a35eb9cdf39a8661bd558158ce) add android datamatcher (#190)
|
11
|
+
- [caa9a9f](https://github.com/appium/ruby_lib_core/commit/caa9a9f7c97fe134166ff1fc629a1a62523d3db4) add links for issues in changelog
|
12
|
+
|
13
|
+
|
1
14
|
#### v3.0.0 2019-02-06
|
2
15
|
|
3
16
|
- [ba653c3](https://github.com/appium/ruby_lib_core/commit/ba653c3be70bad3b9a9e233121b4b3a9455fa287) Release 3.0.0
|
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: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kazuaki MATSUO
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: selenium-webdriver
|