appium_lib_core 1.3.0 → 1.3.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 +25 -0
- data/lib/appium_lib_core.rb +1 -0
- data/lib/appium_lib_core/android.rb +0 -1
- data/lib/appium_lib_core/android/device.rb +21 -18
- data/lib/appium_lib_core/android/espresso/bridge.rb +0 -2
- data/lib/appium_lib_core/android/uiautomator1/bridge.rb +0 -2
- data/lib/appium_lib_core/android/uiautomator2/bridge.rb +0 -2
- data/lib/appium_lib_core/android_espresso.rb +0 -1
- data/lib/appium_lib_core/android_uiautomator2.rb +0 -1
- data/lib/appium_lib_core/common/command.rb +3 -0
- data/lib/appium_lib_core/common/device.rb +162 -31
- data/lib/appium_lib_core/device/app_state.rb +13 -0
- data/lib/appium_lib_core/device/touch_actions.rb +23 -29
- data/lib/appium_lib_core/driver.rb +2 -1
- data/lib/appium_lib_core/ios.rb +0 -1
- data/lib/appium_lib_core/ios/uiautomation/bridge.rb +0 -2
- data/lib/appium_lib_core/ios/xcuitest/bridge.rb +0 -2
- data/lib/appium_lib_core/ios/xcuitest/device.rb +13 -12
- data/lib/appium_lib_core/ios_xcuitest.rb +0 -1
- data/lib/appium_lib_core/version.rb +2 -2
- data/release_notes.md +11 -0
- metadata +3 -4
- data/lib/appium_lib_core/android/touch.rb +0 -19
- data/lib/appium_lib_core/ios/touch.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c04b7c34dd2c6871b41e81187a83b88ff5d88d1d
|
4
|
+
data.tar.gz: 2cb5ab6893ac740b4302364110a8b4fdf67afcbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e246e7f8d8c553bf034a90fc9a11678c50e4a171c77cc1ea9cb1a74bc4600a7e176908f70c30edd5c93d3c12519794aa2ff6135d8844215d82b489a9460a5f35
|
7
|
+
data.tar.gz: 49060b3ba5fd7bc18ada2e6f01f4e3e5e9021759d6d4f9ed208f54ce01a9173298b329d04306db627d8745b73c41ae071a70441c52092dc4d9f121d4bc24fde7
|
data/CHANGELOG.md
CHANGED
@@ -8,6 +8,31 @@ All notable changes to this project will be documented in this file.
|
|
8
8
|
|
9
9
|
### Deprecations
|
10
10
|
|
11
|
+
## [1.3.1] - 2018-02-14
|
12
|
+
### Enhancements
|
13
|
+
- add some app management commands [#58](https://github.com/appium/ruby_lib_core/pull/58)
|
14
|
+
- Require Appium 1.8.0+
|
15
|
+
- Both platforms work absolute based axis for `move_to` and `swipe`
|
16
|
+
- **Breaking Changes**
|
17
|
+
- Android was relevant, previously.
|
18
|
+
- e.g.:
|
19
|
+
```ruby
|
20
|
+
# Do not move because of the start and end point is the same
|
21
|
+
# Tap (75, 500) and move the point to (75, 500) with duration 500ms.
|
22
|
+
Appium::Core::TouchAction.new(@driver)
|
23
|
+
.swipe(start_x: 75, start_y: 500, offset_x: 75, offset_y: 500, duration: 500)
|
24
|
+
.perform
|
25
|
+
|
26
|
+
# Tap (75, 500) and move the point to (75, 1000) with duration 500ms.
|
27
|
+
Appium::Core::TouchAction.new(@driver)
|
28
|
+
.swipe(start_x: 75, start_y: 500, offset_x: 75, offset_y: 1000, duration: 500)
|
29
|
+
.perform
|
30
|
+
```
|
31
|
+
|
32
|
+
### Bug fixes
|
33
|
+
|
34
|
+
### Deprecations
|
35
|
+
|
11
36
|
## [1.3.0] - 2018-01-28
|
12
37
|
### Enhancements
|
13
38
|
- `start_recording_screen`/`stop_recording_screen` support iOS from `Appium 1.8.0` [#48](https://github.com/appium/ruby_lib_core/issues/48)
|
data/lib/appium_lib_core.rb
CHANGED
@@ -9,6 +9,7 @@ require_relative 'appium_lib_core/driver'
|
|
9
9
|
require_relative 'appium_lib_core/device/touch_actions'
|
10
10
|
require_relative 'appium_lib_core/device/multi_touch'
|
11
11
|
require_relative 'appium_lib_core/device/screen_record'
|
12
|
+
require_relative 'appium_lib_core/device/app_state'
|
12
13
|
|
13
14
|
require_relative 'appium_lib_core/android'
|
14
15
|
require_relative 'appium_lib_core/android_uiautomator2'
|
@@ -3,6 +3,8 @@ module Appium
|
|
3
3
|
module Device
|
4
4
|
extend Forwardable
|
5
5
|
|
6
|
+
# rubocop:disable Metrics/LineLength
|
7
|
+
|
6
8
|
# @!method hide_keyboard(close_key = nil, strategy = nil)
|
7
9
|
# Hide the onscreen keyboard
|
8
10
|
# @param [String] close_key The name of the key which closes the keyboard.
|
@@ -27,10 +29,11 @@ module Appium
|
|
27
29
|
# @!method start_activity(opts)
|
28
30
|
# Android only. Start a new activity within the current app or launch a new app and start the target activity.
|
29
31
|
#
|
30
|
-
# @
|
31
|
-
# @option [String] The
|
32
|
-
# @option opts [String] The
|
33
|
-
# @option opts [String] The
|
32
|
+
# @param opts [Hash] Options
|
33
|
+
# @option opts [String] :app_package The package owning the activity [required]
|
34
|
+
# @option opts [String] :app_activity The target activity [required]
|
35
|
+
# @option opts [String] :app_wait_package The package to start before the target package [optional]
|
36
|
+
# @option opts [String] :app_wait_activity The activity to start before the target activity [optional]
|
34
37
|
#
|
35
38
|
# @example
|
36
39
|
#
|
@@ -69,19 +72,17 @@ module Appium
|
|
69
72
|
# @!method get_performance_data(package_name:, data_type:, data_read_timeout: 1000)
|
70
73
|
# Get the resource usage information of the application.
|
71
74
|
# https://github.com/appium/appium-base-driver/blob/be29aec2318316d12b5c3295e924a5ba8f09b0fb/lib/mjsonwp/routes.js#L303
|
72
|
-
# @param [String] package_name Package name
|
73
|
-
# @param [String] data_type Data type get with `get_performance_data_types`
|
74
|
-
# @param [String] data_read_timeout Command timeout. Default is 2.
|
75
|
+
# @param [String] package_name: Package name
|
76
|
+
# @param [String] data_type: Data type get with `get_performance_data_types`
|
77
|
+
# @param [String] data_read_timeout: Command timeout. Default is 2.
|
75
78
|
#
|
76
79
|
# @example
|
77
80
|
#
|
78
81
|
# @driver.get_performance_data package_name: package_name, data_type: data_type, data_read_timeout: 2
|
79
82
|
#
|
80
83
|
|
81
|
-
# @!method start_recording_screen(remote_path
|
82
|
-
#
|
83
|
-
#
|
84
|
-
# @option [String] remote_path The path to the remote location, where the resulting video should be uploaded.
|
84
|
+
# @!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')
|
85
|
+
# @param [String] remote_path: The path to the remote location, where the resulting video should be uploaded.
|
85
86
|
# The following protocols are supported: http/https, ftp.
|
86
87
|
# Null or empty string value (the default setting) means the content of resulting
|
87
88
|
# file should be encoded as Base64 and passed as the endpoint response value.
|
@@ -89,20 +90,20 @@ module Appium
|
|
89
90
|
# fit into the available process memory.
|
90
91
|
# This option only has an effect if there is screen recording process in progress
|
91
92
|
# and `forceRestart` parameter is not set to `true`.
|
92
|
-
# @
|
93
|
-
# @
|
94
|
-
# @
|
95
|
-
# @
|
93
|
+
# @param [String] user: The name of the user for the remote authentication.
|
94
|
+
# @param [String] pass: The password for the remote authentication.
|
95
|
+
# @param [String] method: The http multipart upload method name. The 'PUT' one is used by default.
|
96
|
+
# @param [Boolean] force_restart: Whether to try to catch and upload/return the currently running screen recording
|
96
97
|
# (`false`, the default setting on server) or ignore the result of it
|
97
98
|
# and start a new recording immediately (`true`).
|
98
99
|
#
|
99
|
-
# @
|
100
|
+
# @param [String] video_size: The format is widthxheight.
|
100
101
|
# The default value is the device's native display resolution (if supported),
|
101
102
|
# 1280x720 if not. For best results,
|
102
103
|
# use a size supported by your device's Advanced Video Coding (AVC) encoder.
|
103
104
|
# For example, "1280x720"
|
104
|
-
# @param [String] time_limit Recording time. 180 seconds is by default.
|
105
|
-
# @param [String] bit_rate The video bit rate for the video, in megabits per second. 4 Mbps(4000000) is by default.
|
105
|
+
# @param [String] time_limit: Recording time. 180 seconds is by default.
|
106
|
+
# @param [String] bit_rate: The video bit rate for the video, in megabits per second. 4 Mbps(4000000) is by default.
|
106
107
|
#
|
107
108
|
# @example
|
108
109
|
#
|
@@ -114,6 +115,8 @@ module Appium
|
|
114
115
|
## class << self
|
115
116
|
####
|
116
117
|
|
118
|
+
# rubocop:enable Metrics/LineLength
|
119
|
+
|
117
120
|
class << self
|
118
121
|
def extended(_mod)
|
119
122
|
Appium::Core::Device.extend_webdriver_with_forwardable
|
@@ -38,6 +38,9 @@ module Appium
|
|
38
38
|
install_app: [:post, 'session/:session_id/appium/device/install_app'.freeze],
|
39
39
|
remove_app: [:post, 'session/:session_id/appium/device/remove_app'.freeze],
|
40
40
|
app_installed?: [:post, 'session/:session_id/appium/device/app_installed'.freeze],
|
41
|
+
activate_app: [:post, 'session/:session_id/appium/device/activate_app'.freeze],
|
42
|
+
terminate_app: [:post, 'session/:session_id/appium/device/terminate_app'.freeze],
|
43
|
+
app_state: [:post, 'session/:session_id/appium/device/app_state'.freeze],
|
41
44
|
background_app: [:post, 'session/:session_id/appium/app/background'.freeze],
|
42
45
|
hide_keyboard: [:post, 'session/:session_id/appium/device/hide_keyboard'.freeze],
|
43
46
|
press_keycode: [:post, 'session/:session_id/appium/device/press_keycode'.freeze],
|
@@ -5,6 +5,8 @@ module Appium
|
|
5
5
|
module Device
|
6
6
|
extend Forwardable
|
7
7
|
|
8
|
+
# rubocop:disable Metrics/LineLength
|
9
|
+
|
8
10
|
####
|
9
11
|
## No argument
|
10
12
|
####
|
@@ -47,7 +49,7 @@ module Appium
|
|
47
49
|
|
48
50
|
# @!method is_keyboard_shown
|
49
51
|
# Get whether keyboard is displayed or not.
|
50
|
-
# @return [
|
52
|
+
# @return [Boolean] Return true if keyboard is shown. Return false if keyboard is hidden.
|
51
53
|
#
|
52
54
|
# @example
|
53
55
|
# @driver.is_keyboard_shown # false
|
@@ -140,31 +142,83 @@ module Appium
|
|
140
142
|
## With arguments
|
141
143
|
####
|
142
144
|
|
143
|
-
# @!method install_app(path)
|
145
|
+
# @!method install_app(path, replace: nil, timeout: nil, allow_test_packages: nil, use_sdcard: nil, grant_permissions: nil)
|
144
146
|
# Install the given app onto the device
|
145
147
|
#
|
148
|
+
# @param [String] path The absolute local path or remote http URL to an .ipa or .apk file, or a .zip containing one of these.
|
149
|
+
# @param [Boolean] replace: Only for Android. Whether to reinstall/upgrade the package if it is already present on the device under test. `true` by default
|
150
|
+
# @param [Integer] timeout: Only for Android. How much time to wait for the installation to complete. 60000ms by default.
|
151
|
+
# @param [Boolean] allow_test_packages: Only for Android. Whether to allow installation of packages marked as test in the manifest. `false` by default
|
152
|
+
# @param [Boolean] use_sdcard: Only for Android. Whether to use the SD card to install the app. `false` by default
|
153
|
+
# @param [Boolean] grant_permissions: Only for Android. whether to automatically grant application permissions on Android 6+ after the installation completes. `false` by default
|
154
|
+
#
|
146
155
|
# @example
|
147
156
|
#
|
148
157
|
# @driver.install_app("/path/to/test.apk")
|
158
|
+
# @driver.install_app("/path/to/test.apk", replace: true, timeout: 20000, allow_test_packages: true, use_sdcard: false, grant_permissions: false)
|
149
159
|
#
|
150
160
|
|
151
|
-
# @!method remove_app(app_id)
|
152
|
-
#
|
161
|
+
# @!method remove_app(app_id, keep_data: nil, timeout: nil)
|
162
|
+
#
|
163
|
+
# @param [Strong] app_id BundleId for iOS or package name for Android
|
164
|
+
# @param [Boolean] keep_data: Only for Android. Whether to keep application data and caches after it is uninstalled. `false` by default
|
165
|
+
# @param [Integer] timeout: Only for Android. How much time to wait for the uninstall to complete. 20000ms by default.
|
153
166
|
#
|
154
167
|
# @example
|
155
168
|
#
|
156
169
|
# @driver.remove_app("io.appium.bundle")
|
170
|
+
# @driver.remove_app("io.appium.bundle", keep_data: false, timeout, 10000)
|
157
171
|
#
|
158
172
|
|
159
173
|
# @!method app_installed?(app_id)
|
160
174
|
# Check whether the specified app is installed on the device
|
161
|
-
# @return [
|
175
|
+
# @return [Boolean]
|
162
176
|
#
|
163
177
|
# @example
|
164
178
|
#
|
165
179
|
# @driver.app_installed?("io.appium.bundle")
|
166
180
|
#
|
167
181
|
|
182
|
+
# @!method terminate_app(app_id)
|
183
|
+
# Terminate the specified app.
|
184
|
+
#
|
185
|
+
# @param [Strong] app_id BundleId for iOS or package name for Android
|
186
|
+
# @param [Integer] timeout: Only for Android. How much time to wait for the application termination to complete. 500ms by default.
|
187
|
+
# @return [Boolean]
|
188
|
+
#
|
189
|
+
# @example
|
190
|
+
#
|
191
|
+
# @driver.terminate_app("io.appium.bundle") # true
|
192
|
+
# @driver.terminate_app("io.appium.bundle", timeout: 500)
|
193
|
+
#
|
194
|
+
|
195
|
+
# @!method activate_app(app_id)
|
196
|
+
# Activate(Launch) the specified app.
|
197
|
+
# @return [Hash]
|
198
|
+
#
|
199
|
+
# @example
|
200
|
+
#
|
201
|
+
# @driver.activate_app("io.appium.bundle") #=> {}
|
202
|
+
#
|
203
|
+
|
204
|
+
# Get the status of an existing application on the device.
|
205
|
+
# State:
|
206
|
+
# AppState::NOT_INSTALLED : The current application state cannot be determined/is unknown
|
207
|
+
# AppState::NOT_RUNNING : The application is not running
|
208
|
+
# AppState::RUNNING_IN_BACKGROUND_SUSPENDED : The application is running in the background and is suspended
|
209
|
+
# AppState::RUNNING_IN_BACKGROUND : The application is running in the background and is not suspended
|
210
|
+
# AppState::RUNNING_IN_FOREGROUND : The application is running in the foreground
|
211
|
+
#
|
212
|
+
# For more details: https://developer.apple.com/documentation/xctest/xcuiapplicationstate
|
213
|
+
#
|
214
|
+
# @param [String] bundle_id A target app's bundle id
|
215
|
+
# @return [AppManagement::APP_STATE_NOT_INSTALLED|AppManagement::APP_STATE_NOT_RUNNING|APP_STATE_RUNNING_IN_BACKGROUND_SUSPEND|AppManagement::APP_STATE_RUNNING_IN_BACKGROUND|AppManagement::APP_STATE_RUNNING_IN_FOREGROUND] A number of the state
|
216
|
+
#
|
217
|
+
# @example
|
218
|
+
#
|
219
|
+
# @driver.app_state("io.appium.bundle") #=> 1
|
220
|
+
#
|
221
|
+
|
168
222
|
# @!method app_strings(language = nil)
|
169
223
|
# Return the hash of all localization strings.
|
170
224
|
# @return [Hash]
|
@@ -402,17 +456,16 @@ module Appium
|
|
402
456
|
# @driver.take_element_screenshot(element, "fine_name.png")
|
403
457
|
#
|
404
458
|
|
405
|
-
# @!method stop_recording_screen(remote_path
|
406
|
-
#
|
407
|
-
# @option [String] remote_path The path to the remote location, where the resulting video should be uploaded.
|
459
|
+
# @!method stop_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT')
|
460
|
+
# @param [String] remote_path: The path to the remote location, where the resulting video should be uploaded.
|
408
461
|
# The following protocols are supported: http/https, ftp.
|
409
462
|
# Null or empty string value (the default setting) means the content of resulting
|
410
463
|
# file should be encoded as Base64 and passed as the endpoint response value.
|
411
464
|
# An exception will be thrown if the generated media file is too big to
|
412
465
|
# fit into the available process memory.
|
413
|
-
# @
|
414
|
-
# @
|
415
|
-
# @
|
466
|
+
# @param [String] user: The name of the user for the remote authentication.
|
467
|
+
# @param [String] pass: The password for the remote authentication.
|
468
|
+
# @param [String] method: The http multipart upload method name. The 'PUT' one is used by default.
|
416
469
|
#
|
417
470
|
# @example
|
418
471
|
#
|
@@ -421,14 +474,15 @@ module Appium
|
|
421
474
|
#
|
422
475
|
|
423
476
|
# @!method stop_and_save_recording_screen(file_path)
|
424
|
-
#
|
425
|
-
# @option [String] file_path The path to save video decoded from base64 from Appium server.
|
477
|
+
# @param [String] file_path The path to save video decoded from base64 from Appium server.
|
426
478
|
#
|
427
479
|
# @example
|
428
480
|
#
|
429
481
|
# @driver.stop_and_save_recording_screen 'example.mp4'
|
430
482
|
#
|
431
483
|
|
484
|
+
# rubocop:enable Metrics/LineLength
|
485
|
+
|
432
486
|
####
|
433
487
|
## class << self
|
434
488
|
####
|
@@ -462,24 +516,6 @@ module Appium
|
|
462
516
|
end
|
463
517
|
end
|
464
518
|
|
465
|
-
add_endpoint_method(:install_app) do
|
466
|
-
def install_app(path)
|
467
|
-
execute :install_app, {}, appPath: path
|
468
|
-
end
|
469
|
-
end
|
470
|
-
|
471
|
-
add_endpoint_method(:remove_app) do
|
472
|
-
def remove_app(id)
|
473
|
-
execute :remove_app, {}, appId: id
|
474
|
-
end
|
475
|
-
end
|
476
|
-
|
477
|
-
add_endpoint_method(:app_installed?) do
|
478
|
-
def app_installed?(app_id)
|
479
|
-
execute :app_installed?, {}, bundleId: app_id
|
480
|
-
end
|
481
|
-
end
|
482
|
-
|
483
519
|
add_endpoint_method(:background_app) do
|
484
520
|
def background_app(duration = 0)
|
485
521
|
execute :background_app, {}, seconds: duration
|
@@ -568,6 +604,7 @@ module Appium
|
|
568
604
|
add_ime_actions
|
569
605
|
add_handling_context
|
570
606
|
add_screen_recording
|
607
|
+
add_app_management
|
571
608
|
end
|
572
609
|
|
573
610
|
# def extended
|
@@ -609,6 +646,100 @@ module Appium
|
|
609
646
|
end
|
610
647
|
end
|
611
648
|
|
649
|
+
# rubocop:disable Metrics/ParameterLists,Metrics/PerceivedComplexity,Metrics/CyclomaticComplexity
|
650
|
+
def add_app_management
|
651
|
+
add_endpoint_method(:install_app) do
|
652
|
+
def install_app(path,
|
653
|
+
replace: nil,
|
654
|
+
timeout: nil,
|
655
|
+
allow_test_packages: nil,
|
656
|
+
use_sdcard: nil,
|
657
|
+
grant_permissions: nil)
|
658
|
+
args = { appPath: path }
|
659
|
+
|
660
|
+
args[:options] = {} unless options?(replace, timeout, allow_test_packages, use_sdcard, grant_permissions)
|
661
|
+
|
662
|
+
args[:options][:replace] = replace unless replace.nil?
|
663
|
+
args[:options][:timeout] = timeout unless timeout.nil?
|
664
|
+
args[:options][:allowTestPackages] = allow_test_packages unless allow_test_packages.nil?
|
665
|
+
args[:options][:useSdcard] = use_sdcard unless use_sdcard.nil?
|
666
|
+
args[:options][:grantPermissions] = grant_permissions unless grant_permissions.nil?
|
667
|
+
|
668
|
+
execute :install_app, {}, args
|
669
|
+
end
|
670
|
+
|
671
|
+
private
|
672
|
+
|
673
|
+
def options?(replace, timeout, allow_test_packages, use_sdcard, grant_permissions)
|
674
|
+
replace.nil? || timeout.nil? || allow_test_packages.nil? || use_sdcard.nil? || grant_permissions.nil?
|
675
|
+
end
|
676
|
+
end
|
677
|
+
|
678
|
+
add_endpoint_method(:remove_app) do
|
679
|
+
def remove_app(id, keep_data: nil, timeout: nil)
|
680
|
+
# required: [['appId'], ['bundleId']]
|
681
|
+
args = { appId: id }
|
682
|
+
|
683
|
+
args[:options] = {} unless keep_data.nil? || timeout.nil?
|
684
|
+
args[:options][:keepData] = keep_data unless keep_data.nil?
|
685
|
+
args[:options][:timeout] = timeout unless timeout.nil?
|
686
|
+
|
687
|
+
execute :remove_app, {}, args
|
688
|
+
end
|
689
|
+
end
|
690
|
+
|
691
|
+
add_endpoint_method(:app_installed?) do
|
692
|
+
def app_installed?(app_id)
|
693
|
+
# required: [['appId'], ['bundleId']]
|
694
|
+
execute :app_installed?, {}, bundleId: app_id
|
695
|
+
end
|
696
|
+
end
|
697
|
+
|
698
|
+
add_endpoint_method(:activate_app) do
|
699
|
+
def activate_app(app_id)
|
700
|
+
# required: [['appId'], ['bundleId']]
|
701
|
+
execute :activate_app, {}, bundleId: app_id
|
702
|
+
end
|
703
|
+
end
|
704
|
+
|
705
|
+
add_endpoint_method(:terminate_app) do
|
706
|
+
def terminate_app(app_id, timeout: nil)
|
707
|
+
# required: [['appId'], ['bundleId']]
|
708
|
+
#
|
709
|
+
args = { appId: app_id }
|
710
|
+
|
711
|
+
args[:options] = {} unless timeout.nil?
|
712
|
+
args[:options][:timeout] = timeout unless timeout.nil?
|
713
|
+
|
714
|
+
execute :terminate_app, {}, args
|
715
|
+
end
|
716
|
+
end
|
717
|
+
|
718
|
+
add_endpoint_method(:app_state) do
|
719
|
+
def app_state(app_id)
|
720
|
+
# required: [['appId'], ['bundleId']]
|
721
|
+
response = execute :app_state, {}, appId: app_id
|
722
|
+
|
723
|
+
case response
|
724
|
+
when 0
|
725
|
+
Appium::Core::Device::AppState::NOT_INSTALLED
|
726
|
+
when 1
|
727
|
+
Appium::Core::Device::AppState::NOT_RUNNING
|
728
|
+
when 2
|
729
|
+
Appium::Core::Device::AppState::RUNNING_IN_BACKGROUND_SUSPENDED
|
730
|
+
when 3
|
731
|
+
Appium::Core::Device::AppState::RUNNING_IN_BACKGROUND
|
732
|
+
when 4
|
733
|
+
Appium::Core::Device::AppState::RUNNING_IN_FOREGROUND
|
734
|
+
else
|
735
|
+
Appium::Logger.debug("Unexpected status in app_state: #{response}")
|
736
|
+
response
|
737
|
+
end
|
738
|
+
end
|
739
|
+
end
|
740
|
+
end
|
741
|
+
# rubocop:enable Metrics/ParameterLists,Metrics/PerceivedComplexity,Metrics/CyclomaticComplexity
|
742
|
+
|
612
743
|
def add_keyevent
|
613
744
|
# Only for Selendroid
|
614
745
|
add_endpoint_method(:keyevent) do
|
@@ -4,6 +4,11 @@ module Appium
|
|
4
4
|
#
|
5
5
|
# Each method returns the object itself, so calls can be chained.
|
6
6
|
#
|
7
|
+
# Consider to use W3C spec touch action like the followings.
|
8
|
+
# https://seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/W3CActionBuilder.html
|
9
|
+
# https://github.com/appium/ruby_lib_core/blob/master/test/functional/android/webdriver/w3c_actions_test.rb
|
10
|
+
# https://github.com/appium/ruby_lib_core/blob/master/test/functional/ios/webdriver/w3c_actions_test.rb
|
11
|
+
#
|
7
12
|
# @example
|
8
13
|
#
|
9
14
|
# @driver = Appium::Core.for(self, opts).start_driver
|
@@ -28,6 +33,7 @@ module Appium
|
|
28
33
|
#
|
29
34
|
# `move_to`'s `x` and `y` have two case. One is working as coordinate, the other is working as offset.
|
30
35
|
#
|
36
|
+
# @param opts [Hash] Options
|
31
37
|
# @option opts [integer] :x x co-ordinate to move to if element isn't set. Works as an offset if x is set with Element.
|
32
38
|
# @option opts [integer] :y y co-ordinate to move to if element isn't set. Works as an offset if y is set with Element.
|
33
39
|
# @option opts [WebDriver::Element] Element to scope this move within.
|
@@ -41,19 +47,20 @@ module Appium
|
|
41
47
|
# https://github.com/appium/ruby_lib/issues/231#issuecomment-269895512
|
42
48
|
# e.g. Appium::TouchAction.new.press(x: 280, y: 530).wait(2000).release.perform
|
43
49
|
#
|
44
|
-
# @
|
45
|
-
# @option
|
46
|
-
# @option
|
47
|
-
# @option
|
50
|
+
# @param opts [Hash] Options
|
51
|
+
# @option opts [WebDriver::Element] element the element to press.
|
52
|
+
# @option opts [integer] x X co-ordinate to press on.
|
53
|
+
# @option opts [integer] y Y co-ordinate to press on.
|
54
|
+
# @option opts [integer] duration Number of milliseconds to press.
|
48
55
|
def long_press(opts)
|
49
56
|
args = opts.select { |k, _v| %i(element x y duration).include? k }
|
50
57
|
args = args_with_ele_ref(args)
|
51
58
|
chain_method(:longPress, args) # longPress is what the appium server expects
|
52
59
|
end
|
53
60
|
|
54
|
-
# Press a finger onto the screen. Finger will stay down until you call
|
55
|
-
# `release`.
|
61
|
+
# Press a finger onto the screen. Finger will stay down until you call `release`.
|
56
62
|
#
|
63
|
+
# @param opts [Hash] Options
|
57
64
|
# @option opts [WebDriver::Element] :element (Optional) Element to press within.
|
58
65
|
# @option opts [integer] :x x co-ordinate to press on
|
59
66
|
# @option opts [integer] :y y co-ordinate to press on
|
@@ -65,6 +72,7 @@ module Appium
|
|
65
72
|
|
66
73
|
# Remove a finger from the screen.
|
67
74
|
#
|
75
|
+
# @param opts [Hash] Options
|
68
76
|
# @option opts [WebDriver::Element] :element (Optional) Element to release from.
|
69
77
|
# @option opts [integer] :x x co-ordinate to release from
|
70
78
|
# @option opts [integer] :y y co-ordinate to release from
|
@@ -76,6 +84,7 @@ module Appium
|
|
76
84
|
# Touch a point on the screen.
|
77
85
|
# Alternatively, you can use `press(...).release.perform` instead of `tap(...).perform`.
|
78
86
|
#
|
87
|
+
# @param opts [Hash] Options
|
79
88
|
# @option opts [WebDriver::Element] :element (Optional) Element to restrict scope too.
|
80
89
|
# @option opts [integer] :x x co-ordinate to tap
|
81
90
|
# @option opts [integer] :y y co-ordinate to tap
|
@@ -89,6 +98,7 @@ module Appium
|
|
89
98
|
|
90
99
|
# Double tap an element on the screen
|
91
100
|
#
|
101
|
+
# @param opts [Hash] Options
|
92
102
|
# @option opts [WebDriver::Element] :element (Optional) Element to restrict scope too.
|
93
103
|
# @option opts [integer] :x x co-ordinate to tap
|
94
104
|
# @option opts [integer] :y y co-ordinate to tap
|
@@ -101,6 +111,7 @@ module Appium
|
|
101
111
|
|
102
112
|
# Two finger tap an element on the screen
|
103
113
|
#
|
114
|
+
# @param opts [Hash] Options
|
104
115
|
# @option opts [WebDriver::Element] :element (Optional) Element to restrict scope too.
|
105
116
|
# @option opts [integer] :x x co-ordinate to tap
|
106
117
|
# @option opts [integer] :y y co-ordinate to tap
|
@@ -117,21 +128,13 @@ module Appium
|
|
117
128
|
chain_method(:wait, args)
|
118
129
|
end
|
119
130
|
|
120
|
-
# Convenience method to
|
121
|
-
#
|
122
|
-
# Note that iOS 7 simulators have broken swipe.
|
123
|
-
#
|
124
|
-
# For iOS: Use `offset_x` and `offset_y` to define the end point.
|
125
|
-
#
|
126
|
-
# For Android: Use `end_x` and `end_y` to define the end point.
|
127
|
-
#
|
128
|
-
# If you'd like more details, please read tests and its log samples in
|
129
|
-
# `ios_tests/lib/ios/specs/device/touch_actions.rb` and `ios_tests/lib/ios/specs/device/touch_actions.rb`
|
131
|
+
# Convenience method to perform a swipe.
|
130
132
|
#
|
133
|
+
# @param opts [Hash] Options
|
131
134
|
# @option opts [int] :start_x Where to start swiping, on the x axis. Default 0.
|
132
135
|
# @option opts [int] :start_y Where to start swiping, on the y axis. Default 0.
|
133
|
-
# @option opts [int] :offset_x
|
134
|
-
# @option opts [int] :offset_y
|
136
|
+
# @option opts [int] :offset_x Move to the end, on the x axis. Default 0.
|
137
|
+
# @option opts [int] :offset_y Move to the end, on the y axis. Default 0.
|
135
138
|
# @option opts [int] :duration How long the actual swipe takes to complete in milliseconds. Default 200.
|
136
139
|
def swipe(opts, ele = nil)
|
137
140
|
start_x = opts.fetch :start_x, 0
|
@@ -140,15 +143,13 @@ module Appium
|
|
140
143
|
offset_y = opts.fetch :offset_y, 0
|
141
144
|
duration = opts.fetch :duration, 200
|
142
145
|
|
143
|
-
coordinates = swipe_coordinates(start_x: start_x, start_y: start_y, offset_x: offset_x, offset_y: offset_y)
|
144
|
-
|
145
146
|
if ele # pinch/zoom for XCUITest
|
146
147
|
press x: start_x, y: start_y, element: ele
|
147
|
-
move_to x:
|
148
|
+
move_to x: offset_x, y: offset_y, element: ele
|
148
149
|
else
|
149
150
|
press x: start_x, y: start_y
|
150
151
|
wait(duration) if duration
|
151
|
-
move_to x:
|
152
|
+
move_to x: offset_x, y: offset_y
|
152
153
|
end
|
153
154
|
release
|
154
155
|
|
@@ -169,13 +170,6 @@ module Appium
|
|
169
170
|
self
|
170
171
|
end
|
171
172
|
|
172
|
-
# Visible for testing
|
173
|
-
# @private
|
174
|
-
def swipe_coordinates(start_x: 0, start_y: 0, offset_x: 0, offset_y: 0)
|
175
|
-
Appium::Logger.info "start_x: #{start_x}, start_y: #{start_y}, offset_x: #{offset_x}, offset_y: #{offset_y}"
|
176
|
-
{ offset_x: offset_x, offset_y: offset_y }
|
177
|
-
end
|
178
|
-
|
179
173
|
private
|
180
174
|
|
181
175
|
def chain_method(method, args = nil)
|
@@ -19,7 +19,7 @@ module Appium
|
|
19
19
|
attr_reader :automation_name
|
20
20
|
|
21
21
|
# Custom URL for the selenium server. If set this attribute, ruby_lib_core try to handshake to the custom url.
|
22
|
-
# False is by default and then "http://127.0.0.1:#{
|
22
|
+
# False is by default and then "http://127.0.0.1:#{port}/wd/hub" is used.
|
23
23
|
# @return [String]
|
24
24
|
attr_reader :custom_url
|
25
25
|
|
@@ -116,6 +116,7 @@ module Appium
|
|
116
116
|
# You can customise http_client as the following
|
117
117
|
#
|
118
118
|
# @param [String] server_url Custom server url to send to requests. Default is "http://127.0.0.1:4723/wd/hub".
|
119
|
+
# @param http_client_ops [Hash] Options for http client
|
119
120
|
# @option http_client_ops [Hash] :http_client Custom HTTP Client
|
120
121
|
# @option http_client_ops [Hash] :open_timeout Custom open timeout for http client.
|
121
122
|
# @option http_client_ops [Hash] :read_timeout Custom read timeout for http client.
|
data/lib/appium_lib_core/ios.rb
CHANGED
@@ -4,6 +4,8 @@ module Appium
|
|
4
4
|
module Device
|
5
5
|
extend Forwardable
|
6
6
|
|
7
|
+
# rubocop:disable Metrics/LineLength
|
8
|
+
|
7
9
|
# @!method hide_keyboard(close_key = nil, strategy = nil)
|
8
10
|
# Hide the onscreen keyboard
|
9
11
|
# @param [String] close_key The name of the key which closes the keyboard.
|
@@ -29,10 +31,8 @@ module Appium
|
|
29
31
|
# @driver.background_app(-1) #=> the app never come back. https://github.com/appium/appium/issues/7741
|
30
32
|
#
|
31
33
|
|
32
|
-
# @!method start_recording_screen(remote_path
|
33
|
-
#
|
34
|
-
#
|
35
|
-
# @option [String] remote_path The path to the remote location, where the resulting video should be uploaded.
|
34
|
+
# @!method start_recording_screen(remote_path: nil, user: nil, pass: nil, method: nil, force_restart: nil, video_type: 'mp4', time_limit: '180', video_quality: 'medium')
|
35
|
+
# @param [String] remote_path: The path to the remote location, where the resulting video should be uploaded.
|
36
36
|
# The following protocols are supported: http/https, ftp.
|
37
37
|
# Null or empty string value (the default setting) means the content of resulting
|
38
38
|
# file should be encoded as Base64 and passed as the endpount response value.
|
@@ -40,18 +40,17 @@ module Appium
|
|
40
40
|
# fit into the available process memory.
|
41
41
|
# This option only has an effect if there is screen recording process in progreess
|
42
42
|
# and `forceRestart` parameter is not set to `true`.
|
43
|
-
# @
|
44
|
-
# @
|
45
|
-
# @
|
46
|
-
# @
|
43
|
+
# @param [String] user: The name of the user for the remote authentication.
|
44
|
+
# @param [String] pass: The password for the remote authentication.
|
45
|
+
# @param [String] method: The http multipart upload method name. The 'PUT' one is used by default.
|
46
|
+
# @param [Boolean] force_restart: Whether to try to catch and upload/return the currently running screen recording
|
47
47
|
# (`false`, the default setting on server) or ignore the result of it
|
48
48
|
# and start a new recording immediately (`true`).
|
49
|
-
#
|
50
|
-
# @param [String] video_type The format of the screen capture to be recorded.
|
49
|
+
# @param [String] video_type: The format of the screen capture to be recorded.
|
51
50
|
# Available formats: "h264", "mp4" or "fmp4". Default is "mp4".
|
52
51
|
# Only works for Simulator.
|
53
|
-
# @param [String] time_limit Recording time. 180 seconds is by default.
|
54
|
-
# @param [String] video_quality The video encoding quality (low, medium, high, photo - defaults to medium).
|
52
|
+
# @param [String] time_limit: Recording time. 180 seconds is by default.
|
53
|
+
# @param [String] video_quality: The video encoding quality (low, medium, high, photo - defaults to medium).
|
55
54
|
# Only works for real devices.
|
56
55
|
#
|
57
56
|
# @example
|
@@ -60,6 +59,8 @@ module Appium
|
|
60
59
|
# @driver.start_recording_screen video_type: 'h264', time_limit: '260'
|
61
60
|
#
|
62
61
|
|
62
|
+
# rubocop:enable Metrics/LineLength
|
63
|
+
|
63
64
|
####
|
64
65
|
## class << self
|
65
66
|
####
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Appium
|
2
2
|
module Core
|
3
|
-
VERSION = '1.3.
|
4
|
-
DATE = '2018-
|
3
|
+
VERSION = '1.3.1'.freeze unless defined? ::Appium::Core::VERSION
|
4
|
+
DATE = '2018-02-14'.freeze unless defined? ::Appium::Core::DATE
|
5
5
|
end
|
6
6
|
end
|
data/release_notes.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
#### v1.3.1 2018-02-14
|
2
|
+
|
3
|
+
- [d107749](https://github.com/appium/ruby_lib_core/commit/d107749782e3eae49aeb9c17411a120eecb5a242) Release 1.3.1
|
4
|
+
- [9dc38d6](https://github.com/appium/ruby_lib_core/commit/9dc38d65a1c0d8975fc67a8274c1d2ebd43e7e5d) remove unused method
|
5
|
+
- [3ca89ff](https://github.com/appium/ruby_lib_core/commit/3ca89ff6a81e016739f602a1cc60c4a7538ae96a) remove corrdinator for moveTo in swipe (#57)
|
6
|
+
- [29c528e](https://github.com/appium/ruby_lib_core/commit/29c528e8b407591072a65d4a544af65413a93b9d) arrange consts names and add some options for app management (#59)
|
7
|
+
- [da7fd55](https://github.com/appium/ruby_lib_core/commit/da7fd55fb7a8330e778fe7295807646e984f262a) Update CHANGELOG.md
|
8
|
+
- [b1b484d](https://github.com/appium/ruby_lib_core/commit/b1b484ddced5011daedca6c0546d236624511d1a) add terminate, app_state and activate app (#58)
|
9
|
+
- [0ba7b1c](https://github.com/appium/ruby_lib_core/commit/0ba7b1c726f02e11d6daa46481309b1e0e54b00e) fix documentation
|
10
|
+
|
11
|
+
|
1
12
|
#### v1.3.0 2018-01-28
|
2
13
|
|
3
14
|
- [b7a994b](https://github.com/appium/ruby_lib_core/commit/b7a994ba29b3870257cf7e8af602deb147afd791) Release 1.3.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: 1.3.
|
4
|
+
version: 1.3.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: 2018-
|
11
|
+
date: 2018-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: selenium-webdriver
|
@@ -196,7 +196,6 @@ files:
|
|
196
196
|
- lib/appium_lib_core/android/device.rb
|
197
197
|
- lib/appium_lib_core/android/espresso/bridge.rb
|
198
198
|
- lib/appium_lib_core/android/search_context.rb
|
199
|
-
- lib/appium_lib_core/android/touch.rb
|
200
199
|
- lib/appium_lib_core/android/uiautomator1/bridge.rb
|
201
200
|
- lib/appium_lib_core/android/uiautomator2/bridge.rb
|
202
201
|
- lib/appium_lib_core/android_espresso.rb
|
@@ -217,6 +216,7 @@ files:
|
|
217
216
|
- lib/appium_lib_core/common/error.rb
|
218
217
|
- lib/appium_lib_core/common/log.rb
|
219
218
|
- lib/appium_lib_core/common/logger.rb
|
219
|
+
- lib/appium_lib_core/device/app_state.rb
|
220
220
|
- lib/appium_lib_core/device/multi_touch.rb
|
221
221
|
- lib/appium_lib_core/device/screen_record.rb
|
222
222
|
- lib/appium_lib_core/device/touch_actions.rb
|
@@ -224,7 +224,6 @@ files:
|
|
224
224
|
- lib/appium_lib_core/ios.rb
|
225
225
|
- lib/appium_lib_core/ios/device.rb
|
226
226
|
- lib/appium_lib_core/ios/search_context.rb
|
227
|
-
- lib/appium_lib_core/ios/touch.rb
|
228
227
|
- lib/appium_lib_core/ios/uiautomation/bridge.rb
|
229
228
|
- lib/appium_lib_core/ios/uiautomation/patch.rb
|
230
229
|
- lib/appium_lib_core/ios/xcuitest/bridge.rb
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Appium
|
2
|
-
module Core
|
3
|
-
module Android
|
4
|
-
module Touch
|
5
|
-
def self.extend_touch_actions
|
6
|
-
::Appium::Core::TouchAction.class_eval do
|
7
|
-
# Visible for testing
|
8
|
-
# @private
|
9
|
-
def swipe_coordinates(start_x: 0, start_y: 0, offset_x: 0, offset_y: 0)
|
10
|
-
Appium::Logger.info "extended Appium::Core::Android::Touch, start_x: #{start_x},"\
|
11
|
-
" start_y: #{start_y}, offset_x: #{offset_x}, offset_y: #{offset_y}"
|
12
|
-
{ offset_x: (start_x + offset_x), offset_y: (start_y + offset_y) }
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Appium
|
2
|
-
module Core
|
3
|
-
module Ios
|
4
|
-
module Touch
|
5
|
-
def self.extend_touch_actions
|
6
|
-
::Appium::Core::TouchAction.class_eval do
|
7
|
-
# Visible for testing
|
8
|
-
# @private
|
9
|
-
def swipe_coordinates(start_x: 0, start_y: 0, offset_x: 0, offset_y: 0)
|
10
|
-
Appium::Logger.info "extended Appium::Core::Ios::Touch, start_x: #{start_x},"\
|
11
|
-
" start_y: #{start_y}, offset_x: #{offset_x}, offset_y: #{offset_y}"
|
12
|
-
{ offset_x: offset_x, offset_y: offset_y }
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|