appium_lib_core 1.3.7 → 1.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -1
- data/lib/appium_lib_core/android/device.rb +178 -1
- data/lib/appium_lib_core/common/base/driver.rb +2 -1
- data/lib/appium_lib_core/common/command.rb +31 -36
- data/lib/appium_lib_core/common/device.rb +116 -160
- data/lib/appium_lib_core/version.rb +2 -2
- data/release_notes.md +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac826aa2f98ead54a80272abc7fb36447e3a327b
|
4
|
+
data.tar.gz: a818a3ac3ffd0ed8c398da5c28c5cf65d9efa298
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab9ce470ee4053c5a22369b943ded09ac5f4b5671ae114736317730ca1a042eab6b87b1df77a8e53efb5328dba8101400a21b34872d3d1140624ad28f46208f1
|
7
|
+
data.tar.gz: abd00234f100e065759513a4b9ac1133f610bb09920e13b2826ee83b3940077d1a9db7a5a64135ea85e8a3c75cd7591bbf1678f5887a737a0633f770cf3022e1
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# Changelog
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
-
|
5
4
|
## [Unreleased]
|
6
5
|
### Enhancements
|
7
6
|
|
@@ -9,6 +8,14 @@ All notable changes to this project will be documented in this file.
|
|
9
8
|
|
10
9
|
### Deprecations
|
11
10
|
|
11
|
+
## [1.3.8] - 2018-04-12
|
12
|
+
### Enhancements
|
13
|
+
- Make no-argument commands friendly for IDE
|
14
|
+
|
15
|
+
### Bug fixes
|
16
|
+
|
17
|
+
### Deprecations
|
18
|
+
|
12
19
|
## [1.3.7] - 2018-04-02
|
13
20
|
### Enhancements
|
14
21
|
- Only for `ruby_lib_core` internal process
|
@@ -8,6 +8,106 @@ module Appium
|
|
8
8
|
|
9
9
|
# rubocop:disable Metrics/LineLength
|
10
10
|
|
11
|
+
# @!method open_notifications
|
12
|
+
# Open Android notifications
|
13
|
+
#
|
14
|
+
# @example
|
15
|
+
#
|
16
|
+
# @driver.open_notifications
|
17
|
+
#
|
18
|
+
|
19
|
+
# @!method current_activity
|
20
|
+
# Get current activity name
|
21
|
+
# @return [String] An activity name
|
22
|
+
#
|
23
|
+
# @example
|
24
|
+
#
|
25
|
+
# @driver.current_activity # '.ApiDemos'
|
26
|
+
#
|
27
|
+
|
28
|
+
# @!method current_package
|
29
|
+
# Get current package name
|
30
|
+
# @return [String] A package name
|
31
|
+
#
|
32
|
+
# @example
|
33
|
+
#
|
34
|
+
# @driver.current_package # 'com.example.android.apis'
|
35
|
+
#
|
36
|
+
|
37
|
+
# @!method get_system_bars
|
38
|
+
# Get system bar's information
|
39
|
+
# @return [String]
|
40
|
+
#
|
41
|
+
# @example
|
42
|
+
#
|
43
|
+
# @driver.get_system_bars
|
44
|
+
#
|
45
|
+
|
46
|
+
# @!method get_display_density
|
47
|
+
# Get connected device's density.
|
48
|
+
# @return [Integer] The size of density
|
49
|
+
#
|
50
|
+
# @example
|
51
|
+
#
|
52
|
+
# @driver.get_display_density # 320
|
53
|
+
#
|
54
|
+
|
55
|
+
# @!method is_keyboard_shown
|
56
|
+
# Get whether keyboard is displayed or not.
|
57
|
+
# @return [Boolean] Return true if keyboard is shown. Return false if keyboard is hidden.
|
58
|
+
#
|
59
|
+
# @example
|
60
|
+
# @driver.is_keyboard_shown # false
|
61
|
+
#
|
62
|
+
|
63
|
+
# @!method get_network_connection
|
64
|
+
# Get the device network connection current status
|
65
|
+
# See set_network_connection method for return value
|
66
|
+
#
|
67
|
+
# @example
|
68
|
+
#
|
69
|
+
# @driver.network_connection_type #=> 6
|
70
|
+
# @driver.get_network_connection #=> 6
|
71
|
+
#
|
72
|
+
|
73
|
+
# @!method toggle_wifi
|
74
|
+
# Switch the state of the wifi service only for Android
|
75
|
+
#
|
76
|
+
# @return [String]
|
77
|
+
#
|
78
|
+
# @example
|
79
|
+
#
|
80
|
+
# @driver.toggle_wifi
|
81
|
+
#
|
82
|
+
|
83
|
+
# @!method toggle_data
|
84
|
+
# Switch the state of data service only for Android, and the device should be rooted
|
85
|
+
#
|
86
|
+
# @return [String]
|
87
|
+
#
|
88
|
+
# @example
|
89
|
+
#
|
90
|
+
# @driver.toggle_data
|
91
|
+
#
|
92
|
+
|
93
|
+
# @!method toggle_location_services
|
94
|
+
# Switch the state of the location service
|
95
|
+
#
|
96
|
+
# @return [String]
|
97
|
+
#
|
98
|
+
# @example
|
99
|
+
#
|
100
|
+
# @driver.toggle_location_services
|
101
|
+
#
|
102
|
+
|
103
|
+
# @!method toggle_airplane_mode
|
104
|
+
# Toggle flight mode on or off
|
105
|
+
#
|
106
|
+
# @example
|
107
|
+
#
|
108
|
+
# @driver.toggle_airplane_mode
|
109
|
+
#
|
110
|
+
|
11
111
|
# @!method hide_keyboard(close_key = nil, strategy = nil)
|
12
112
|
# Hide the onscreen keyboard
|
13
113
|
# @param [String] close_key The name of the key which closes the keyboard.
|
@@ -149,7 +249,79 @@ module Appium
|
|
149
249
|
def extended(_mod)
|
150
250
|
Appium::Core::Device.extend_webdriver_with_forwardable
|
151
251
|
|
152
|
-
|
252
|
+
Appium::Core::Device.add_endpoint_method(:open_notifications) do
|
253
|
+
def open_notifications
|
254
|
+
execute :open_notifications
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
Appium::Core::Device.add_endpoint_method(:toggle_airplane_mode) do
|
259
|
+
def toggle_airplane_mode
|
260
|
+
execute :toggle_airplane_mode
|
261
|
+
end
|
262
|
+
alias_method :toggle_flight_mode, :toggle_airplane_mode
|
263
|
+
end
|
264
|
+
|
265
|
+
Appium::Core::Device.add_endpoint_method(:current_activity) do
|
266
|
+
def current_activity
|
267
|
+
execute :current_activity
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
Appium::Core::Device.add_endpoint_method(:current_package) do
|
272
|
+
def current_package
|
273
|
+
execute :current_package
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
Appium::Core::Device.add_endpoint_method(:get_system_bars) do
|
278
|
+
def get_system_bars
|
279
|
+
execute :get_system_bars
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
Appium::Core::Device.add_endpoint_method(:get_display_density) do
|
284
|
+
def get_display_density
|
285
|
+
execute :get_display_density
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
Appium::Core::Device.add_endpoint_method(:is_keyboard_shown) do
|
290
|
+
def is_keyboard_shown # rubocop:disable Naming/PredicateName for compatibility
|
291
|
+
execute :is_keyboard_shown
|
292
|
+
end
|
293
|
+
end
|
294
|
+
|
295
|
+
Appium::Core::Device.add_endpoint_method(:get_network_connection) do
|
296
|
+
def get_network_connection
|
297
|
+
execute :get_network_connection
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
301
|
+
Appium::Core::Device.add_endpoint_method(:get_performance_data_types) do
|
302
|
+
def get_performance_data_types
|
303
|
+
execute :get_performance_data_types
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
Appium::Core::Device.add_endpoint_method(:toggle_wifi) do
|
308
|
+
def toggle_wifi
|
309
|
+
execute :toggle_wifi
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
Appium::Core::Device.add_endpoint_method(:toggle_data) do
|
314
|
+
def toggle_data
|
315
|
+
execute :toggle_data
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
319
|
+
Appium::Core::Device.add_endpoint_method(:toggle_location_services) do
|
320
|
+
def toggle_location_services
|
321
|
+
execute :toggle_location_services
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
153
325
|
Appium::Core::Device.add_endpoint_method(:start_activity) do
|
154
326
|
def start_activity(opts)
|
155
327
|
raise 'opts must be a hash' unless opts.is_a? Hash
|
@@ -191,6 +363,11 @@ module Appium
|
|
191
363
|
|
192
364
|
Appium::Core::Device.add_endpoint_method(:set_network_connection) do
|
193
365
|
def set_network_connection(mode)
|
366
|
+
# TODO. Update set_network_connection as well
|
367
|
+
# connection_type = {airplane_mode: 1, wifi: 2, data: 4, all: 6, none: 0}
|
368
|
+
# raise ArgumentError, 'Invalid connection type' unless type_to_values.keys.include? mode
|
369
|
+
# type = connection_type[mode]
|
370
|
+
# execute :set_network_connection, {}, type: type
|
194
371
|
execute :set_network_connection, {}, type: mode
|
195
372
|
end
|
196
373
|
end
|
@@ -95,7 +95,8 @@ module Appium
|
|
95
95
|
@bridge.get_timeouts
|
96
96
|
end
|
97
97
|
|
98
|
-
# Retrieve the capabilities of the specified session
|
98
|
+
# Retrieve the capabilities of the specified session.
|
99
|
+
# It's almost same as `@driver.capabilities` but you can get more details.
|
99
100
|
#
|
100
101
|
# @return [Selenium::WebDriver::Remote::Capabilities]
|
101
102
|
#
|
@@ -4,55 +4,41 @@ module Appium
|
|
4
4
|
module Core
|
5
5
|
# ref: https://github.com/appium/appium-base-driver/blob/master/lib/mjsonwp/routes.js
|
6
6
|
module Commands
|
7
|
-
COMMAND_NO_ARG = {
|
8
|
-
# Common
|
9
|
-
shake: [:post, 'session/:session_id/appium/device/shake'.freeze],
|
10
|
-
launch_app: [:post, 'session/:session_id/appium/app/launch'.freeze],
|
11
|
-
close_app: [:post, 'session/:session_id/appium/app/close'.freeze],
|
12
|
-
reset: [:post, 'session/:session_id/appium/app/reset'.freeze],
|
13
|
-
device_locked?: [:post, 'session/:session_id/appium/device/is_locked'.freeze],
|
14
|
-
unlock: [:post, 'session/:session_id/appium/device/unlock'.freeze],
|
15
|
-
device_time: [:get, 'session/:session_id/appium/device/system_time'.freeze],
|
16
|
-
current_context: [:get, 'session/:session_id/context'.freeze],
|
17
|
-
|
18
|
-
# Android
|
19
|
-
open_notifications: [:post, 'session/:session_id/appium/device/open_notifications'.freeze],
|
20
|
-
toggle_airplane_mode: [:post, 'session/:session_id/appium/device/toggle_airplane_mode'.freeze],
|
21
|
-
current_activity: [:get, 'session/:session_id/appium/device/current_activity'.freeze],
|
22
|
-
current_package: [:get, 'session/:session_id/appium/device/current_package'.freeze],
|
23
|
-
get_system_bars: [:get, 'session/:session_id/appium/device/system_bars'.freeze],
|
24
|
-
get_display_density: [:get, 'session/:session_id/appium/device/display_density'.freeze],
|
25
|
-
is_keyboard_shown: [:get, 'session/:session_id/appium/device/is_keyboard_shown'.freeze],
|
26
|
-
get_network_connection: [:get, 'session/:session_id/network_connection'.freeze], # defined also in OSS
|
27
|
-
get_performance_data_types: [:post, 'session/:session_id/appium/performanceData/types'.freeze],
|
28
|
-
toggle_wifi: [:post, 'session/:session_id/appium/device/toggle_wifi'.freeze],
|
29
|
-
toggle_data: [:post, 'session/:session_id/appium/device/toggle_data'.freeze],
|
30
|
-
toggle_location_services: [:post, 'session/:session_id/appium/device/toggle_location_services'.freeze]
|
31
|
-
|
32
|
-
# iOS
|
33
|
-
}.freeze
|
34
|
-
|
35
7
|
# Some commands differ for each driver.
|
36
8
|
COMMAND = {
|
37
9
|
# common
|
38
10
|
available_contexts: [:get, 'session/:session_id/contexts'.freeze],
|
39
11
|
set_context: [:post, 'session/:session_id/context'.freeze],
|
12
|
+
current_context: [:get, 'session/:session_id/context'.freeze],
|
13
|
+
|
14
|
+
touch_actions: [:post, 'session/:session_id/touch/perform'.freeze],
|
15
|
+
multi_touch: [:post, 'session/:session_id/touch/multi/perform'.freeze],
|
16
|
+
|
17
|
+
set_immediate_value: [:post, 'session/:session_id/appium/element/:id/value'.freeze],
|
18
|
+
replace_value: [:post, 'session/:session_id/appium/element/:id/replace_value'.freeze],
|
19
|
+
|
20
|
+
launch_app: [:post, 'session/:session_id/appium/app/launch'.freeze],
|
21
|
+
close_app: [:post, 'session/:session_id/appium/app/close'.freeze],
|
22
|
+
reset: [:post, 'session/:session_id/appium/app/reset'.freeze],
|
23
|
+
background_app: [:post, 'session/:session_id/appium/app/background'.freeze],
|
40
24
|
app_strings: [:post, 'session/:session_id/appium/app/strings'.freeze],
|
25
|
+
|
26
|
+
device_locked?: [:post, 'session/:session_id/appium/device/is_locked'.freeze],
|
27
|
+
unlock: [:post, 'session/:session_id/appium/device/unlock'.freeze],
|
41
28
|
lock: [:post, 'session/:session_id/appium/device/lock'.freeze],
|
29
|
+
device_time: [:get, 'session/:session_id/appium/device/system_time'.freeze],
|
42
30
|
install_app: [:post, 'session/:session_id/appium/device/install_app'.freeze],
|
43
31
|
remove_app: [:post, 'session/:session_id/appium/device/remove_app'.freeze],
|
44
32
|
app_installed?: [:post, 'session/:session_id/appium/device/app_installed'.freeze],
|
45
33
|
activate_app: [:post, 'session/:session_id/appium/device/activate_app'.freeze],
|
46
34
|
terminate_app: [:post, 'session/:session_id/appium/device/terminate_app'.freeze],
|
47
35
|
app_state: [:post, 'session/:session_id/appium/device/app_state'.freeze],
|
48
|
-
|
36
|
+
shake: [:post, 'session/:session_id/appium/device/shake'.freeze],
|
49
37
|
hide_keyboard: [:post, 'session/:session_id/appium/device/hide_keyboard'.freeze],
|
50
38
|
press_keycode: [:post, 'session/:session_id/appium/device/press_keycode'.freeze],
|
51
39
|
long_press_keycode: [:post, 'session/:session_id/appium/device/long_press_keycode'.freeze],
|
52
40
|
# keyevent is only for Selendroid
|
53
41
|
keyevent: [:post, 'session/:session_id/appium/device/keyevent'.freeze],
|
54
|
-
set_immediate_value: [:post, 'session/:session_id/appium/element/:id/value'.freeze],
|
55
|
-
replace_value: [:post, 'session/:session_id/appium/element/:id/replace_value'.freeze],
|
56
42
|
push_file: [:post, 'session/:session_id/appium/device/push_file'.freeze],
|
57
43
|
pull_file: [:post, 'session/:session_id/appium/device/pull_file'.freeze],
|
58
44
|
pull_folder: [:post, 'session/:session_id/appium/device/pull_folder'.freeze],
|
@@ -60,17 +46,27 @@ module Appium
|
|
60
46
|
set_clipboard: [:post, 'session/:session_id/appium/device/set_clipboard'.freeze],
|
61
47
|
get_settings: [:get, 'session/:session_id/appium/settings'.freeze],
|
62
48
|
update_settings: [:post, 'session/:session_id/appium/settings'.freeze],
|
63
|
-
touch_actions: [:post, 'session/:session_id/touch/perform'.freeze],
|
64
|
-
multi_touch: [:post, 'session/:session_id/touch/multi/perform'.freeze],
|
65
49
|
stop_recording_screen: [:post, 'session/:session_id/appium/stop_recording_screen'.freeze],
|
66
50
|
start_recording_screen: [:post, 'session/:session_id/appium/start_recording_screen'.freeze]
|
67
51
|
}.freeze
|
68
52
|
|
69
53
|
COMMAND_ANDROID = {
|
54
|
+
open_notifications: [:post, 'session/:session_id/appium/device/open_notifications'.freeze],
|
55
|
+
toggle_airplane_mode: [:post, 'session/:session_id/appium/device/toggle_airplane_mode'.freeze],
|
70
56
|
start_activity: [:post, 'session/:session_id/appium/device/start_activity'.freeze],
|
57
|
+
current_activity: [:get, 'session/:session_id/appium/device/current_activity'.freeze],
|
58
|
+
current_package: [:get, 'session/:session_id/appium/device/current_package'.freeze],
|
59
|
+
get_system_bars: [:get, 'session/:session_id/appium/device/system_bars'.freeze],
|
60
|
+
get_display_density: [:get, 'session/:session_id/appium/device/display_density'.freeze],
|
61
|
+
is_keyboard_shown: [:get, 'session/:session_id/appium/device/is_keyboard_shown'.freeze],
|
62
|
+
toggle_wifi: [:post, 'session/:session_id/appium/device/toggle_wifi'.freeze],
|
63
|
+
toggle_data: [:post, 'session/:session_id/appium/device/toggle_data'.freeze],
|
64
|
+
toggle_location_services: [:post, 'session/:session_id/appium/device/toggle_location_services'.freeze],
|
71
65
|
end_coverage: [:post, 'session/:session_id/appium/app/end_test_coverage'.freeze],
|
72
|
-
|
66
|
+
get_performance_data_types: [:post, 'session/:session_id/appium/performanceData/types'.freeze],
|
73
67
|
get_performance_data: [:post, 'session/:session_id/appium/getPerformanceData'.freeze],
|
68
|
+
get_network_connection: [:get, 'session/:session_id/network_connection'.freeze], # defined also in OSS
|
69
|
+
set_network_connection: [:post, 'session/:session_id/network_connection'.freeze], # defined also in OSS
|
74
70
|
|
75
71
|
# only emulator
|
76
72
|
send_sms: [:post, 'session/:session_id/appium/device/send_sms'.freeze],
|
@@ -87,8 +83,7 @@ module Appium
|
|
87
83
|
toggle_touch_id_enrollment: [:post, 'session/:session_id/appium/simulator/toggle_touch_id_enrollment'.freeze]
|
88
84
|
}.freeze
|
89
85
|
|
90
|
-
COMMANDS = {}.merge(COMMAND).merge(COMMAND_ANDROID).merge(COMMAND_IOS)
|
91
|
-
.merge(COMMAND_NO_ARG).freeze
|
86
|
+
COMMANDS = {}.merge(COMMAND).merge(COMMAND_ANDROID).merge(COMMAND_IOS).freeze
|
92
87
|
|
93
88
|
COMMANDS_EXTEND_MJSONWP = COMMANDS.merge(::Appium::Core::Base::Commands::OSS).merge(
|
94
89
|
{
|
@@ -11,50 +11,6 @@ module Appium
|
|
11
11
|
## No argument
|
12
12
|
####
|
13
13
|
|
14
|
-
# @!method current_activity
|
15
|
-
# Get current activity name
|
16
|
-
# @return [String] An activity name
|
17
|
-
#
|
18
|
-
# @example
|
19
|
-
#
|
20
|
-
# @driver.current_activity # '.ApiDemos'
|
21
|
-
#
|
22
|
-
|
23
|
-
# @!method current_package
|
24
|
-
# Get current package name
|
25
|
-
# @return [String] A package name
|
26
|
-
#
|
27
|
-
# @example
|
28
|
-
#
|
29
|
-
# @driver.current_package # 'com.example.android.apis'
|
30
|
-
#
|
31
|
-
|
32
|
-
# @!method get_system_bars
|
33
|
-
# Get system bar's information
|
34
|
-
# @return [String]
|
35
|
-
#
|
36
|
-
# @example
|
37
|
-
#
|
38
|
-
# @driver.get_system_bars
|
39
|
-
#
|
40
|
-
|
41
|
-
# @!method get_display_density
|
42
|
-
# Get connected device's density.
|
43
|
-
# @return [Integer] The size of density
|
44
|
-
#
|
45
|
-
# @example
|
46
|
-
#
|
47
|
-
# @driver.get_display_density # 320
|
48
|
-
#
|
49
|
-
|
50
|
-
# @!method is_keyboard_shown
|
51
|
-
# Get whether keyboard is displayed or not.
|
52
|
-
# @return [Boolean] Return true if keyboard is shown. Return false if keyboard is hidden.
|
53
|
-
#
|
54
|
-
# @example
|
55
|
-
# @driver.is_keyboard_shown # false
|
56
|
-
#
|
57
|
-
|
58
14
|
# @!method launch_app
|
59
15
|
# Start the simulator and application configured with desired capabilities
|
60
16
|
#
|
@@ -87,14 +43,6 @@ module Appium
|
|
87
43
|
# @driver.shake
|
88
44
|
#
|
89
45
|
|
90
|
-
# @!method toggle_flight_mode
|
91
|
-
# Toggle flight mode on or off
|
92
|
-
#
|
93
|
-
# @example
|
94
|
-
#
|
95
|
-
# @driver.toggle_flight_mode
|
96
|
-
#
|
97
|
-
|
98
46
|
# @!method unlock
|
99
47
|
# Unlock the device
|
100
48
|
#
|
@@ -111,24 +59,6 @@ module Appium
|
|
111
59
|
# @driver.device_locked?
|
112
60
|
#
|
113
61
|
|
114
|
-
# @!method get_network_connection
|
115
|
-
# Get the device network connection current status
|
116
|
-
# See set_network_connection method for return value
|
117
|
-
#
|
118
|
-
# @example
|
119
|
-
#
|
120
|
-
# @driver.network_connection_type #=> 6
|
121
|
-
# @driver.get_network_connection #=> 6
|
122
|
-
#
|
123
|
-
|
124
|
-
# @!method open_notifications
|
125
|
-
# Open Android notifications
|
126
|
-
#
|
127
|
-
# @example
|
128
|
-
#
|
129
|
-
# @driver.open_notifications
|
130
|
-
#
|
131
|
-
|
132
62
|
# @!method device_time
|
133
63
|
# Get the time on the device
|
134
64
|
#
|
@@ -139,36 +69,6 @@ module Appium
|
|
139
69
|
# @driver.device_time
|
140
70
|
#
|
141
71
|
|
142
|
-
# @!method toggle_location_services
|
143
|
-
# Switch the state of the location service
|
144
|
-
#
|
145
|
-
# @return [String]
|
146
|
-
#
|
147
|
-
# @example
|
148
|
-
#
|
149
|
-
# @driver.toggle_location_services
|
150
|
-
#
|
151
|
-
|
152
|
-
# @!method toggle_wifi
|
153
|
-
# Switch the state of the wifi service only for Android
|
154
|
-
#
|
155
|
-
# @return [String]
|
156
|
-
#
|
157
|
-
# @example
|
158
|
-
#
|
159
|
-
# @driver.toggle_wifi
|
160
|
-
#
|
161
|
-
|
162
|
-
# @!method toggle_data
|
163
|
-
# Switch the state of data service only for Android, and the device should be rooted
|
164
|
-
#
|
165
|
-
# @return [String]
|
166
|
-
#
|
167
|
-
# @example
|
168
|
-
#
|
169
|
-
# @driver.toggle_data
|
170
|
-
#
|
171
|
-
|
172
72
|
####
|
173
73
|
## With arguments
|
174
74
|
####
|
@@ -531,40 +431,15 @@ module Appium
|
|
531
431
|
def extended(_mod)
|
532
432
|
extend_webdriver_with_forwardable
|
533
433
|
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
add_endpoint_method(:available_contexts) do
|
539
|
-
def available_contexts
|
540
|
-
# return empty array instead of nil on failure
|
541
|
-
execute(:available_contexts, {}) || []
|
434
|
+
add_endpoint_method(:shake) do
|
435
|
+
def shake
|
436
|
+
execute :shake
|
542
437
|
end
|
543
438
|
end
|
544
439
|
|
545
|
-
add_endpoint_method(:
|
546
|
-
def
|
547
|
-
|
548
|
-
execute :app_strings, {}, opts
|
549
|
-
end
|
550
|
-
end
|
551
|
-
|
552
|
-
add_endpoint_method(:lock) do
|
553
|
-
def lock(duration = nil)
|
554
|
-
opts = duration ? { seconds: duration } : {}
|
555
|
-
execute :lock, {}, opts
|
556
|
-
end
|
557
|
-
end
|
558
|
-
|
559
|
-
add_endpoint_method(:background_app) do
|
560
|
-
def background_app(duration = 0)
|
561
|
-
execute :background_app, {}, seconds: duration
|
562
|
-
end
|
563
|
-
end
|
564
|
-
|
565
|
-
add_endpoint_method(:set_context) do
|
566
|
-
def set_context(context = null)
|
567
|
-
execute :set_context, {}, name: context
|
440
|
+
add_endpoint_method(:device_time) do
|
441
|
+
def device_time
|
442
|
+
execute :device_time
|
568
443
|
end
|
569
444
|
end
|
570
445
|
|
@@ -585,7 +460,7 @@ module Appium
|
|
585
460
|
|
586
461
|
extension = File.extname(png_path).downcase
|
587
462
|
if extension != '.png'
|
588
|
-
|
463
|
+
::Appium::Logger.warn 'name used for saved screenshot does not match file type. '\
|
589
464
|
'It should end with .png extension'
|
590
465
|
end
|
591
466
|
File.open(png_path, 'wb') { |f| f << result.unpack('m')[0] }
|
@@ -606,27 +481,6 @@ module Appium
|
|
606
481
|
end
|
607
482
|
end
|
608
483
|
|
609
|
-
add_endpoint_method(:push_file) do
|
610
|
-
def push_file(path, filedata)
|
611
|
-
encoded_data = Base64.encode64 filedata
|
612
|
-
execute :push_file, {}, path: path, data: encoded_data
|
613
|
-
end
|
614
|
-
end
|
615
|
-
|
616
|
-
add_endpoint_method(:pull_file) do
|
617
|
-
def pull_file(path)
|
618
|
-
data = execute :pull_file, {}, path: path
|
619
|
-
Base64.decode64 data
|
620
|
-
end
|
621
|
-
end
|
622
|
-
|
623
|
-
add_endpoint_method(:pull_folder) do
|
624
|
-
def pull_folder(path)
|
625
|
-
data = execute :pull_folder, {}, path: path
|
626
|
-
Base64.decode64 data
|
627
|
-
end
|
628
|
-
end
|
629
|
-
|
630
484
|
add_endpoint_method(:get_settings) do
|
631
485
|
def get_settings
|
632
486
|
execute :get_settings, {}
|
@@ -643,7 +497,7 @@ module Appium
|
|
643
497
|
def save_viewport_screenshot(png_path)
|
644
498
|
extension = File.extname(png_path).downcase
|
645
499
|
if extension != '.png'
|
646
|
-
|
500
|
+
::Appium::Logger.warn 'name used for saved screenshot does not match file type. '\
|
647
501
|
'It should end with .png extension'
|
648
502
|
end
|
649
503
|
viewport_screenshot_encode64 = execute_script('mobile: viewportScreenshot')
|
@@ -657,6 +511,8 @@ module Appium
|
|
657
511
|
add_handling_context
|
658
512
|
add_screen_recording
|
659
513
|
add_app_management
|
514
|
+
add_device_lock
|
515
|
+
add_file_management
|
660
516
|
end
|
661
517
|
|
662
518
|
# def extended
|
@@ -698,8 +554,89 @@ module Appium
|
|
698
554
|
end
|
699
555
|
end
|
700
556
|
|
557
|
+
def add_device_lock
|
558
|
+
add_endpoint_method(:lock) do
|
559
|
+
def lock(duration = nil)
|
560
|
+
opts = duration ? { seconds: duration } : {}
|
561
|
+
execute :lock, {}, opts
|
562
|
+
end
|
563
|
+
end
|
564
|
+
|
565
|
+
add_endpoint_method(:device_locked?) do
|
566
|
+
def device_locked?
|
567
|
+
execute :device_locked?
|
568
|
+
end
|
569
|
+
end
|
570
|
+
|
571
|
+
add_endpoint_method(:unlock) do
|
572
|
+
def unlock
|
573
|
+
execute :unlock
|
574
|
+
end
|
575
|
+
end
|
576
|
+
end
|
577
|
+
|
578
|
+
def add_file_management
|
579
|
+
add_endpoint_method(:push_file) do
|
580
|
+
def push_file(path, filedata)
|
581
|
+
encoded_data = Base64.encode64 filedata
|
582
|
+
execute :push_file, {}, path: path, data: encoded_data
|
583
|
+
end
|
584
|
+
end
|
585
|
+
|
586
|
+
add_endpoint_method(:pull_file) do
|
587
|
+
def pull_file(path)
|
588
|
+
data = execute :pull_file, {}, path: path
|
589
|
+
Base64.decode64 data
|
590
|
+
end
|
591
|
+
end
|
592
|
+
|
593
|
+
add_endpoint_method(:pull_folder) do
|
594
|
+
def pull_folder(path)
|
595
|
+
data = execute :pull_folder, {}, path: path
|
596
|
+
Base64.decode64 data
|
597
|
+
end
|
598
|
+
end
|
599
|
+
end
|
600
|
+
|
701
601
|
# rubocop:disable Metrics/ParameterLists,Metrics/PerceivedComplexity,Metrics/CyclomaticComplexity
|
702
602
|
def add_app_management
|
603
|
+
add_endpoint_method(:launch_app) do
|
604
|
+
def launch_app
|
605
|
+
execute :launch_app
|
606
|
+
end
|
607
|
+
end
|
608
|
+
|
609
|
+
add_endpoint_method(:close_app) do
|
610
|
+
def close_app
|
611
|
+
execute :close_app
|
612
|
+
end
|
613
|
+
end
|
614
|
+
|
615
|
+
add_endpoint_method(:close_app) do
|
616
|
+
def close_app
|
617
|
+
execute :close_app
|
618
|
+
end
|
619
|
+
end
|
620
|
+
|
621
|
+
add_endpoint_method(:reset) do
|
622
|
+
def reset
|
623
|
+
execute :reset
|
624
|
+
end
|
625
|
+
end
|
626
|
+
|
627
|
+
add_endpoint_method(:app_strings) do
|
628
|
+
def app_strings(language = nil)
|
629
|
+
opts = language ? { language: language } : {}
|
630
|
+
execute :app_strings, {}, opts
|
631
|
+
end
|
632
|
+
end
|
633
|
+
|
634
|
+
add_endpoint_method(:background_app) do
|
635
|
+
def background_app(duration = 0)
|
636
|
+
execute :background_app, {}, seconds: duration
|
637
|
+
end
|
638
|
+
end
|
639
|
+
|
703
640
|
add_endpoint_method(:install_app) do
|
704
641
|
def install_app(path,
|
705
642
|
replace: nil,
|
@@ -774,17 +711,17 @@ module Appium
|
|
774
711
|
|
775
712
|
case response
|
776
713
|
when 0
|
777
|
-
Appium::Core::Device::AppState::NOT_INSTALLED
|
714
|
+
::Appium::Core::Device::AppState::NOT_INSTALLED
|
778
715
|
when 1
|
779
|
-
Appium::Core::Device::AppState::NOT_RUNNING
|
716
|
+
::Appium::Core::Device::AppState::NOT_RUNNING
|
780
717
|
when 2
|
781
|
-
Appium::Core::Device::AppState::RUNNING_IN_BACKGROUND_SUSPENDED
|
718
|
+
::Appium::Core::Device::AppState::RUNNING_IN_BACKGROUND_SUSPENDED
|
782
719
|
when 3
|
783
|
-
Appium::Core::Device::AppState::RUNNING_IN_BACKGROUND
|
720
|
+
::Appium::Core::Device::AppState::RUNNING_IN_BACKGROUND
|
784
721
|
when 4
|
785
|
-
Appium::Core::Device::AppState::RUNNING_IN_FOREGROUND
|
722
|
+
::Appium::Core::Device::AppState::RUNNING_IN_FOREGROUND
|
786
723
|
else
|
787
|
-
Appium::Logger.debug("Unexpected status in app_state: #{response}")
|
724
|
+
::Appium::Logger.debug("Unexpected status in app_state: #{response}")
|
788
725
|
response
|
789
726
|
end
|
790
727
|
end
|
@@ -890,6 +827,25 @@ module Appium
|
|
890
827
|
set_context nil
|
891
828
|
end
|
892
829
|
end
|
830
|
+
|
831
|
+
add_endpoint_method(:current_context) do
|
832
|
+
def current_context
|
833
|
+
execute :current_context
|
834
|
+
end
|
835
|
+
end
|
836
|
+
|
837
|
+
add_endpoint_method(:available_contexts) do
|
838
|
+
def available_contexts
|
839
|
+
# return empty array instead of nil on failure
|
840
|
+
execute(:available_contexts, {}) || []
|
841
|
+
end
|
842
|
+
end
|
843
|
+
|
844
|
+
add_endpoint_method(:set_context) do
|
845
|
+
def set_context(context = null)
|
846
|
+
execute :set_context, {}, name: context
|
847
|
+
end
|
848
|
+
end
|
893
849
|
end
|
894
850
|
|
895
851
|
def add_screen_recording
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Appium
|
2
2
|
module Core
|
3
|
-
VERSION = '1.3.
|
4
|
-
DATE = '2018-04-
|
3
|
+
VERSION = '1.3.8'.freeze unless defined? ::Appium::Core::VERSION
|
4
|
+
DATE = '2018-04-12'.freeze unless defined? ::Appium::Core::DATE
|
5
5
|
end
|
6
6
|
end
|
data/release_notes.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
#### v1.3.8 2018-04-13
|
2
|
+
|
3
|
+
- [f5e1c39](https://github.com/appium/ruby_lib_core/commit/f5e1c39ed07c191c89a491c407d0fc368459367c) Release 1.3.8
|
4
|
+
- [53c61d4](https://github.com/appium/ruby_lib_core/commit/53c61d46b25e25ba488bb3e065ddec5ee2e6f83c) get ride of auto method generation to enhance ide support (#72)
|
5
|
+
- [f175c44](https://github.com/appium/ruby_lib_core/commit/f175c4494d2f5edf56402116c016044bfb1603d0) append a comment
|
6
|
+
|
7
|
+
|
1
8
|
#### v1.3.7 2018-04-02
|
2
9
|
|
3
10
|
- [e658b98](https://github.com/appium/ruby_lib_core/commit/e658b98c82275b431370cf9d3f8db313f5609bed) Release 1.3.7
|
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.8
|
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-04-
|
11
|
+
date: 2018-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: selenium-webdriver
|