appium_lib_core 10.0.0 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/Gemfile +1 -1
  4. data/lib/appium_lib_core/android/device/auth_finger_print.rb +1 -4
  5. data/lib/appium_lib_core/android/device/clipboard.rb +2 -2
  6. data/lib/appium_lib_core/android/device/emulator.rb +7 -8
  7. data/lib/appium_lib_core/android/device/performance.rb +3 -7
  8. data/lib/appium_lib_core/android/device/screen.rb +1 -3
  9. data/lib/appium_lib_core/android/device.rb +12 -184
  10. data/lib/appium_lib_core/common/base/bridge.rb +0 -14
  11. data/lib/appium_lib_core/common/base/driver.rb +6 -34
  12. data/lib/appium_lib_core/common/command.rb +1 -45
  13. data/lib/appium_lib_core/common/device/app_management.rb +1 -1
  14. data/lib/appium_lib_core/common/device/app_state.rb +2 -2
  15. data/lib/appium_lib_core/common/device/device.rb +3 -2
  16. data/lib/appium_lib_core/common/device/device_lock.rb +3 -3
  17. data/lib/appium_lib_core/common/device/keyboard.rb +4 -5
  18. data/lib/appium_lib_core/common/device/keyevent.rb +3 -3
  19. data/lib/appium_lib_core/common/log.rb +4 -4
  20. data/lib/appium_lib_core/common/ws/websocket.rb +1 -1
  21. data/lib/appium_lib_core/ios/device/clipboard.rb +2 -2
  22. data/lib/appium_lib_core/ios/device.rb +2 -2
  23. data/lib/appium_lib_core/ios/xcuitest/device.rb +4 -13
  24. data/lib/appium_lib_core/version.rb +2 -2
  25. data/sig/lib/appium_lib_core/common/base/driver.rbs +1 -3
  26. metadata +3 -6
  27. data/lib/appium_lib_core/android/device/network.rb +0 -71
  28. data/lib/appium_lib_core/common/base/has_network_connection.rb +0 -56
  29. data/sig/lib/appium_lib_core/common/base/has_network_connection.rbs +0 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 12d386d3e8769c8292b096b65b8de708fcecea995775f50e3dbc1a7025b97c42
4
- data.tar.gz: '096f64ed445ce70b10f49873e627cdcfdbf5431a718615a68089333a18b4ad13'
3
+ metadata.gz: '096a1bfdfebe6fe9d6e889ed22981092379ec2431c0559420936f73d7735e37b'
4
+ data.tar.gz: b56f5eb3c67bb2846821d78da6f46b728d4fb878307cdb70a8480d054e102dbf
5
5
  SHA512:
6
- metadata.gz: 784554dc3954ff170b3f79c50cda1a23bcaaeaf55a349d4a2a0ecb12db5b6f7c908f4e882de6e9a5b2afd42c9d87a2815c414e16181f680f92b91f3f7bedef18
7
- data.tar.gz: 9e71aa8a9a7093a607c4d2aa17b72b1f16c5eabe0b5fcc1e8ed34c4c16d18ddc80a411d748c5cbde82d38756eb540c8c355ccb4339c62864733b50e521e43d00
6
+ metadata.gz: e969dea1a82fad771660c1f60a7dbff44a6c12678f5bba7f268396f3e8d7c1b086c8d285e7d4a32195aab9b5971e49764d86767758b465016d4e8d9ec687cf16
7
+ data.tar.gz: 7c5d0a6173832ed2e6e6a6147084a6150cbf7e1c2347120a0b6798756bf63deb970e08e223c7f003fb1ede3478aa14e87c5e5b4d623eb33e51003e72298d2edd
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  Read `release_notes.md` for commit level details.
4
4
 
5
+ ## [11.0.0] - 2025-03-21
6
+ ### Enhancements
7
+ - Remove deprecated marked commands
8
+ - `get_network_connection` / `set_network_connection`, `toggle_wifi`, `toggle_data`, `toggle_airplane_mode`
9
+ - Please use `mobile: setConnectivity` / `mobile: getConnectivity` instead
10
+ - `start_activity`
11
+ - Please use `mobile: startActivity` instead
12
+ - Use mobile command for existing methods (the backend method call has changed. Old appium such as Appium v1 or before may have an issue as no matched command)
13
+ - `toggle_location_services`, `get_performance_data`, `get_performance_data_types`, `finger_print`, `open_notifications`, `current_activity`, `current_package`, `get_system_bars`, `system_bars`, `toggle_location_services`, `hide_keyboard`, `background_app`, `set_clipboard`, `get_clipboard`, `send_sms`, `gsm_call`, `gsm_signal`, `gsm_voice`, `set_network_speed`, `set_power_capacity`, `set_power_ac`, `get_display_density`, `lock`, `unlock`, `locked?`, `hide_keyboard`, `press_keycode`, `long_press_keycode`, `app_strings`, `app_state`, `shake`, `device_time`
14
+
5
15
  ## [10.0.0] - 2025-02-16
6
16
 
7
17
  ### Enhancements
data/Gemfile CHANGED
@@ -8,7 +8,7 @@ gem 'minitest', '~> 5.0'
8
8
  gem 'minitest-reporters', '~> 1.1'
9
9
  gem 'parallel_tests'
10
10
  gem 'rake', '~> 13.0'
11
- gem 'rubocop', '1.71.2'
11
+ gem 'rubocop', '1.74.0'
12
12
  gem 'simplecov'
13
13
  gem 'steep', '~> 1.9.3'
14
14
  gem 'webmock', '~> 3.25.0'
@@ -20,14 +20,11 @@ module Appium
20
20
  def self.add_methods
21
21
  ::Appium::Core::Device.add_endpoint_method(:finger_print) do
22
22
  def finger_print(finger_id)
23
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: fingerprint' extension instead"
24
-
25
23
  unless (1..10).cover? finger_id.to_i
26
24
  raise ::Appium::Core::Error::ArgumentError,
27
25
  "finger_id should be integer between 1 to 10. Not #{finger_id}"
28
26
  end
29
-
30
- execute(:finger_print, {}, { fingerprintId: finger_id.to_i })
27
+ execute_script 'mobile:fingerprint', { fingerprintId: finger_id.to_i }
31
28
  end
32
29
  end
33
30
  end # def self.emulator_commands
@@ -29,7 +29,7 @@ module Appium
29
29
 
30
30
  params = { contentType: content_type }
31
31
 
32
- data = execute(:get_clipboard, {}, params)
32
+ data = execute_script 'mobile:getClipboard', params
33
33
  Base64.decode64 data
34
34
  end
35
35
  end
@@ -47,7 +47,7 @@ module Appium
47
47
  }
48
48
  params[:label] = label unless label.nil?
49
49
 
50
- execute(:set_clipboard, {}, params)
50
+ execute_script 'mobile:setClipboard', params
51
51
  end
52
52
  end
53
53
  end
@@ -115,7 +115,7 @@ module Appium
115
115
  def self.add_methods
116
116
  ::Appium::Core::Device.add_endpoint_method(:send_sms) do
117
117
  def send_sms(phone_number:, message:)
118
- execute(:send_sms, {}, { phoneNumber: phone_number, message: message })
118
+ execute_script 'mobile:sendSms', { phoneNumber: phone_number, message: message }
119
119
  end
120
120
  end
121
121
 
@@ -125,7 +125,7 @@ module Appium
125
125
  raise ::Appium::Core::Error::ArgumentError, "action: should be member of #{GSM_CALL_ACTIONS}. Not #{action}."
126
126
  end
127
127
 
128
- execute(:gsm_call, {}, { phoneNumber: phone_number, action: action })
128
+ execute_script 'mobile:gsmCall', { phoneNumber: phone_number, action: action }
129
129
  end
130
130
  end
131
131
 
@@ -136,8 +136,7 @@ module Appium
136
136
  "#{signal_strength} should be member of #{GSM_SIGNALS.keys} "
137
137
  end
138
138
 
139
- execute(:gsm_signal, {}, { signalStrength: GSM_SIGNALS[signal_strength],
140
- signalStrengh: GSM_SIGNALS[signal_strength] })
139
+ execute_script 'mobile:gsmSignal', { strength: GSM_SIGNALS[signal_strength] }
141
140
  end
142
141
  end
143
142
 
@@ -147,7 +146,7 @@ module Appium
147
146
  raise ::Appium::Core::Error::ArgumentError, "The state should be member of #{GSM_VOICE_STATES}. Not #{state}."
148
147
  end
149
148
 
150
- execute(:gsm_voice, {}, { state: state })
149
+ execute_script 'mobile:gsmVoice', { state: state }
151
150
  end
152
151
  end
153
152
 
@@ -158,7 +157,7 @@ module Appium
158
157
  "The netspeed should be member of #{NET_SPEED}. Not #{netspeed}."
159
158
  end
160
159
 
161
- execute(:set_network_speed, {}, { netspeed: netspeed })
160
+ execute_script 'mobile:networkSpeed', { speed: netspeed }
162
161
  end
163
162
  end
164
163
 
@@ -168,7 +167,7 @@ module Appium
168
167
  ::Appium::Logger.warn "The percent should be between 0 and 100. Not #{percent}."
169
168
  end
170
169
 
171
- execute(:set_power_capacity, {}, { percent: percent })
170
+ execute_script 'mobile:powerCapacity', { percent: percent }
172
171
  end
173
172
  end
174
173
 
@@ -178,7 +177,7 @@ module Appium
178
177
  raise ::Appium::Core::Error::ArgumentError, "The state should be member of #{POWER_AC_STATE}. Not #{state}."
179
178
  end
180
179
 
181
- execute(:set_power_ac, {}, { state: state })
180
+ execute_script 'mobile:powerAc', { state: state }
182
181
  end
183
182
  end
184
183
  end # def self.emulator_commands
@@ -20,17 +20,13 @@ module Appium
20
20
  def self.add_methods
21
21
  ::Appium::Core::Device.add_endpoint_method(:get_performance_data_types) do
22
22
  def get_performance_data_types
23
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getPerformanceDataTypes' extension instead"
24
- execute :get_performance_data_types
23
+ execute_script 'mobile:getPerformanceDataTypes', {}
25
24
  end
26
25
  end
27
26
 
28
27
  ::Appium::Core::Device.add_endpoint_method(:get_performance_data) do
29
- def get_performance_data(package_name:, data_type:, data_read_timeout: 1000)
30
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getPerformanceData' extension instead"
31
-
32
- execute(:get_performance_data, {},
33
- packageName: package_name, dataType: data_type, dataReadTimeout: data_read_timeout)
28
+ def get_performance_data(package_name:, data_type:)
29
+ execute_script 'mobile:getPerformanceData', { packageName: package_name, dataType: data_type }
34
30
  end
35
31
  end
36
32
  end
@@ -20,9 +20,7 @@ module Appium
20
20
  def self.add_methods
21
21
  ::Appium::Core::Device.add_endpoint_method(:get_display_density) do
22
22
  def get_display_density
23
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getDisplayDensity' extension instead"
24
-
25
- execute :get_display_density
23
+ execute_script 'mobile:getDisplayDensity', {}
26
24
  end
27
25
  end
28
26
 
@@ -14,7 +14,6 @@
14
14
 
15
15
  require_relative 'device/emulator'
16
16
  require_relative 'device/clipboard'
17
- require_relative 'device/network'
18
17
  require_relative 'device/performance'
19
18
  require_relative 'device/screen'
20
19
  require_relative 'device/auth_finger_print'
@@ -27,7 +26,6 @@ module Appium
27
26
 
28
27
  # rubocop:disable Layout/LineLength
29
28
 
30
- # @deprecated Use 'mobile: openNotifications' extension instead.
31
29
  # @!method open_notifications
32
30
  # Open Android notifications
33
31
  #
@@ -36,7 +34,6 @@ module Appium
36
34
  # @driver.open_notifications
37
35
  #
38
36
 
39
- # @deprecated Use 'mobile: getCurrentActivity' extension instead.
40
37
  # @!method current_activity
41
38
  # Get current activity name
42
39
  # @return [String] An activity name
@@ -46,7 +43,6 @@ module Appium
46
43
  # @driver.current_activity # '.ApiDemos'
47
44
  #
48
45
 
49
- # @deprecated Use 'mobile: getCurrentPackage' extension instead.
50
46
  # @!method current_package
51
47
  # Get current package name
52
48
  # @return [String] A package name
@@ -56,7 +52,6 @@ module Appium
56
52
  # @driver.current_package # 'com.example.android.apis'
57
53
  #
58
54
 
59
- # @deprecated Use 'mobile: getSystemBars' extension instead.
60
55
  # @!method get_system_bars
61
56
  # Get system bar's information
62
57
  # @return [String]
@@ -67,7 +62,6 @@ module Appium
67
62
  # @driver.system_bars
68
63
  #
69
64
 
70
- # @deprecated Use 'mobile: getDisplayDensity' extension instead.
71
65
  # @!method get_display_density
72
66
  # Get connected device's density.
73
67
  # @return [Integer] The size of density
@@ -77,44 +71,6 @@ module Appium
77
71
  # @driver.get_display_density # 320
78
72
  #
79
73
 
80
- # @deprecated Use 'mobile: getConnectivity' extension instead.
81
- # @!method get_network_connection
82
- # Get the device network connection current status
83
- # See set_network_connection method for return value
84
- # Same as #network_connection_type in selenium-webdriver.
85
- #
86
- # Returns a key of <code>{:airplane_mode: 1, wifi: 2, data: 4, all: 6, none: 0}</code> in #network_connection_type
87
- # Returns a number of the mode in +#get_network_connection+
88
- #
89
- # @example
90
- #
91
- # @driver.network_connection_type #=> :all
92
- # @driver.get_network_connection #=> 6
93
- #
94
-
95
- # @deprecated Use 'mobile: getConnectivity' extension instead.
96
- # @!method toggle_wifi
97
- # Switch the state of the wifi service only for Android
98
- #
99
- # @return [String]
100
- #
101
- # @example
102
- #
103
- # @driver.toggle_wifi
104
- #
105
-
106
- # @deprecated Use 'mobile: getConnectivity' extension instead.
107
- # @!method toggle_data
108
- # Switch the state of data service only for Android, and the device should be rooted
109
- #
110
- # @return [String]
111
- #
112
- # @example
113
- #
114
- # @driver.toggle_data
115
- #
116
-
117
- # @deprecated Use 'mobile: getConnectivity' extension instead.
118
74
  # @!method location
119
75
  # Get the location of the device.
120
76
  #
@@ -124,7 +80,6 @@ module Appium
124
80
  #
125
81
  # driver.location #=> ::Appium::Location.new(10, 10, 10)
126
82
  #
127
-
128
83
  # @!method location=
129
84
  # Set the [::Appium::Location] of the device.
130
85
  #
@@ -149,7 +104,6 @@ module Appium
149
104
  # driver.set_location 10, 10, 0
150
105
  #
151
106
 
152
- # @deprecated Use 'mobile: toggleGps' extension instead.
153
107
  # @!method toggle_location_services
154
108
  # Switch the state of the location service
155
109
  #
@@ -160,80 +114,17 @@ module Appium
160
114
  # @driver.toggle_location_services
161
115
  #
162
116
 
163
- # @deprecated Use 'mobile: getConnectivity' extension instead.
164
- # @!method toggle_airplane_mode
165
- # Toggle flight mode on or off
166
- #
167
- # @example
168
- #
169
- # @driver.toggle_airplane_mode
170
- #
171
-
172
- # @deprecated Use 'mobile: hideKeyboard' extension instead.
173
- # @!method hide_keyboard(close_key = nil, strategy = nil)
117
+ # @!method hide_keyboard(close_key = nil)
174
118
  # Hide the onscreen keyboard
175
119
  # @param [String] close_key The name of the key which closes the keyboard.
176
120
  # Defaults to 'Done' for iOS(except for XCUITest).
177
- # @param [Symbol] strategy The symbol of the strategy which closes the keyboard.
178
- # XCUITest ignore this argument.
179
- # Default for iOS is +:pressKey+. Default for Android is +:tapOutside+.
180
121
  #
181
122
  # @example
182
123
  #
183
124
  # @driver.hide_keyboard # Close a keyboard with the 'Done' button
184
125
  # @driver.hide_keyboard('Finished') # Close a keyboard with the 'Finished' button
185
- # @driver.hide_keyboard(nil, :tapOutside) # Close a keyboard with tapping out side of keyboard
186
- #
187
-
188
- # @deprecated Use 'mobile: startActivity' extension instead.
189
- # @!method start_activity(opts)
190
- # Android only. Start a new activity within the current app or launch a new app and start the target activity.
191
- #
192
- # Read https://developer.android.com/studio/command-line/adb#IntentSpec for each flags.
193
- #
194
- # @param opts [Hash] Options
195
- # @option opts [String] :app_package The package owning the activity [required]
196
- # @option opts [String] :app_activity The target activity [required]
197
- # @option opts [String] :app_wait_package The package to start before the target package [optional]
198
- # @option opts [String] :app_wait_activity The activity to start before the target activity [optional]
199
- # @option opts [String] :intent_action The intent action to give it when start the target activity (+-a+) [optional]
200
- # @option opts [String] :intent_category The intent category to give it when start the target activity (+-c+) [optional]
201
- # @option opts [String] :intent_flags The intent flag to give it when start the target activity (+-f+) [optional]
202
- # @option opts [String] :optional_intent_arguments The optional intent action to give it when start the target activity [optional]
203
- # You can set arbitrary arguments with space as string.
204
- # e.g. +'--ez your_extra_bool bool --ei your_extra_int 1'+
205
- # @option opts [bool] :dont_stop_app_on_reset Do not stop the app when the reset is called in Appium create/delete session [optional]
206
- #
207
- # @example
208
- #
209
- # start_activity app_package: 'io.appium.android.apis',
210
- # app_activity: '.accessibility.AccessibilityNodeProviderActivity'
211
- #
212
-
213
- # @deprecated Use 'mobile: setConnectivity' extension instead.
214
- # @!method set_network_connection(mode)
215
- # Set the device network connection mode
216
- # Same as +#network_connection_type+ in selenium-webdriver.
217
- #
218
- # @param [String] mode Bit mask that represent the network mode
219
- # Or the key matched with <code>{:airplane_mode: 1, wifi: 2, data: 4, all: 6, none: 0}</code>
220
- #
221
- # Value (Alias) | Data | Wifi | Airplane Mode
222
- # -------------------------------------------------
223
- # 1 (Airplane Mode) | 0 | 0 | 1
224
- # 6 (All network on) | 1 | 1 | 0
225
- # 4 (Data only) | 1 | 0 | 0
226
- # 2 (Wifi only) | 0 | 1 | 0
227
- # 0 (None) | 0 | 0 | 0
228
- #
229
- # @example
230
- #
231
- # @driver.set_network_connection 1
232
- # @driver.set_network_connection :airplane_mode
233
- # @driver.network_connection_type = :airplane_mode # As selenium-webdriver
234
126
  #
235
127
 
236
- # @deprecated Use 'mobile: getPerformanceDataTypes' extension instead.
237
128
  # @!method get_performance_data_types
238
129
  # Get the information type of the system state which is supported to read such as
239
130
  # cpu, memory, network, battery via adb commands.
@@ -244,17 +135,15 @@ module Appium
244
135
  # @driver.get_performance_data_types #=> ["cpuinfo", "batteryinfo", "networkinfo", "memoryinfo"]
245
136
  #
246
137
 
247
- # @deprecated Use 'mobile: getPerformanceData' extension instead.
248
- # @!method get_performance_data(package_name:, data_type:, data_read_timeout: 1000)
138
+ # @!method get_performance_data(package_name:, data_type:)
249
139
  # Get the resource usage information of the application.
250
140
  # https://github.com/appium/appium-base-driver/blob/be29aec2318316d12b5c3295e924a5ba8f09b0fb/lib/mjsonwp/routes.js#L303
251
141
  # @param [String] package_name: Package name
252
142
  # @param [String] data_type: Data type get with +get_performance_data_types+
253
- # @param [String] data_read_timeout: Command timeout. Default is 2.
254
143
  #
255
144
  # @example
256
145
  #
257
- # @driver.get_performance_data package_name: package_name, data_type: data_type, data_read_timeout: 2
146
+ # @driver.get_performance_data package_name: package_name, data_type: data_type
258
147
  #
259
148
 
260
149
  # @!method start_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT', file_field_name: nil, form_fields: nil, headers: nil, force_restart: nil, video_size: nil, time_limit: '180', bit_rate: '4000000', bug_report: nil)
@@ -324,7 +213,6 @@ module Appium
324
213
  # @driver.set_clipboard(content: 'happy testing') #=> {"protocol"=>"W3C"}
325
214
  #
326
215
 
327
- # @deprecated Use 'mobile: fingerprint' extension instead.
328
216
  # @!method finger_print(finger_id)
329
217
  # Authenticate users by using their finger print scans on supported emulators.
330
218
  #
@@ -364,110 +252,51 @@ module Appium
364
252
 
365
253
  ::Appium::Core::Device.add_endpoint_method(:open_notifications) do
366
254
  def open_notifications
367
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: openNotifications' extension instead"
368
-
369
- execute :open_notifications
255
+ execute_script 'mobile:openNotifications', {}
370
256
  end
371
257
  end
372
258
 
373
259
  ::Appium::Core::Device.add_endpoint_method(:current_activity) do
374
260
  def current_activity
375
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getCurrentActivity' extension instead"
376
-
377
- execute :current_activity
261
+ execute_script 'mobile:getCurrentActivity', {}
378
262
  end
379
263
  end
380
264
 
381
265
  ::Appium::Core::Device.add_endpoint_method(:current_package) do
382
266
  def current_package
383
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getCurrentPackage' extension instead"
384
-
385
- execute :current_package
267
+ execute_script 'mobile:getCurrentPackage', {}
386
268
  end
387
269
  end
388
270
 
389
271
  ::Appium::Core::Device.add_endpoint_method(:get_system_bars) do
390
272
  def get_system_bars
391
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getSystemBars' extension instead"
392
-
393
- execute :get_system_bars
273
+ execute_script 'mobile:getSystemBars', {}
394
274
  end
395
275
  end
396
276
  # as alias to get_system_bars
397
277
  ::Appium::Core::Device.add_endpoint_method(:system_bars) do
398
278
  def system_bars
399
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getSystemBars' extension instead"
400
-
401
- execute :get_system_bars
279
+ execute_script 'mobile:getSystemBars', {}
402
280
  end
403
281
  end
404
282
 
405
283
  ::Appium::Core::Device.add_endpoint_method(:toggle_location_services) do
406
284
  def toggle_location_services
407
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: toggleGps' extension instead"
408
-
409
- execute :toggle_location_services
410
- end
411
- end
412
-
413
- ::Appium::Core::Device.add_endpoint_method(:start_activity) do
414
- def start_activity(opts)
415
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: startActivity' extension instead"
416
-
417
- raise ::Appium::Core::Error::ArgumentError, 'opts must be a hash' unless opts.is_a? Hash
418
-
419
- option = {}
420
-
421
- app_package = opts[:app_package]
422
- raise ::Appium::Core::Error::ArgumentError, 'app_package is required' unless app_package
423
-
424
- app_activity = opts[:app_activity]
425
- raise ::Appium::Core::Error::ArgumentError, 'app_activity is required' unless app_activity
426
-
427
- option[:appPackage] = app_package
428
- option[:appActivity] = app_activity
429
-
430
- app_wait_package = opts.fetch(:app_wait_package, nil)
431
- app_wait_activity = opts.fetch(:app_wait_activity, nil)
432
- option[:appWaitPackage] = app_wait_package if app_wait_package
433
- option[:appWaitActivity] = app_wait_activity if app_wait_activity
434
-
435
- intent_action = opts.fetch(:intent_action, nil)
436
- intent_category = opts.fetch(:intent_category, nil)
437
- intent_flags = opts.fetch(:intent_flags, nil)
438
- optional_intent_arguments = opts.fetch(:optional_intent_arguments, nil)
439
- dont_stop_app_on_reset = opts.fetch(:dont_stop_app_on_reset, nil)
440
-
441
- option[:intentAction] = intent_action if intent_action
442
- option[:intentCategory] = intent_category if intent_category
443
- option[:intentFlags] = intent_flags if intent_flags
444
- option[:optionalIntentArguments] = optional_intent_arguments if optional_intent_arguments
445
- option[:dontStopAppOnReset] = dont_stop_app_on_reset if dont_stop_app_on_reset
446
-
447
- execute :start_activity, {}, option
285
+ execute_script 'mobile:toggleGps', {}
448
286
  end
449
287
  end
450
288
 
451
289
  # Android, Override included method in bridge
452
290
  ::Appium::Core::Device.add_endpoint_method(:hide_keyboard) do
453
- def hide_keyboard(close_key = nil, strategy = nil)
454
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: hideKeyboard' extension instead"
455
-
456
- option = {}
457
-
458
- option[:key] = close_key if close_key
459
- option[:strategy] = strategy if strategy
460
-
461
- execute :hide_keyboard, {}, option
291
+ def hide_keyboard(_close_key = nil)
292
+ execute_script 'mobile:hideKeyboard', {}
462
293
  end
463
294
  end
464
295
 
465
296
  # Android, Override included method in bridge
466
297
  ::Appium::Core::Device.add_endpoint_method(:background_app) do
467
298
  def background_app(duration = 0)
468
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: backgroundApp' extension instead"
469
-
470
- execute :background_app, {}, seconds: duration
299
+ execute_script 'mobile:backgroundApp', { seconds: duration }
471
300
  end
472
301
  end
473
302
 
@@ -482,7 +311,6 @@ module Appium
482
311
 
483
312
  Screen.add_methods
484
313
  Performance.add_methods
485
- Network.add_methods
486
314
  Clipboard.add_methods
487
315
  Emulator.add_methods
488
316
  Authentication.add_methods
@@ -245,20 +245,6 @@ module Appium
245
245
  ::Appium::Core::Element.new self, element_id_from(id)
246
246
  end
247
247
 
248
- # For Appium
249
- # override
250
- # called in 'extend DriverExtensions::HasNetworkConnection'
251
- def network_connection
252
- execute :get_network_connection
253
- end
254
-
255
- # For Appium
256
- # override
257
- # called in 'extend DriverExtensions::HasNetworkConnection'
258
- def network_connection=(type)
259
- execute :set_network_connection, {}, { parameters: { type: type } }
260
- end
261
-
262
248
  # For Appium
263
249
  # No implementation for W3C webdriver module
264
250
  # called in 'extend DriverExtensions::HasLocation'
@@ -20,7 +20,6 @@ require_relative 'screenshot'
20
20
  require_relative 'rotable'
21
21
  require_relative 'remote_status'
22
22
  require_relative 'has_location'
23
- require_relative 'has_network_connection'
24
23
  require_relative '../wait'
25
24
 
26
25
  module Appium
@@ -35,7 +34,6 @@ module Appium
35
34
  include ::Appium::Core::Base::TakesScreenshot
36
35
  include ::Appium::Core::Base::HasRemoteStatus
37
36
  include ::Appium::Core::Base::HasLocation
38
- include ::Appium::Core::Base::HasNetworkConnection
39
37
 
40
38
  include ::Appium::Core::Waitable
41
39
 
@@ -223,7 +221,6 @@ module Appium
223
221
  )
224
222
  end
225
223
 
226
- # @deprecated Use 'mobile: lock' extension instead.
227
224
  # Lock the device
228
225
  # @return [String]
229
226
  #
@@ -234,11 +231,9 @@ module Appium
234
231
  # # Block other commands during locking the device.
235
232
  #
236
233
  def lock(duration = nil)
237
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: lock' extension instead"
238
234
  @bridge.lock(duration)
239
235
  end
240
236
 
241
- # @deprecated Use 'mobile: isLocked' extension instead.
242
237
  # Check current device status is weather locked or not
243
238
  #
244
239
  # @example
@@ -247,12 +242,10 @@ module Appium
247
242
  # @driver.locked?
248
243
  #
249
244
  def locked?
250
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: isLocked' extension instead"
251
245
  @bridge.device_locked?
252
246
  end
253
247
  alias device_locked? locked?
254
248
 
255
- # @deprecated Use 'mobile: unlock' extension instead.
256
249
  # Unlock the device
257
250
  #
258
251
  # @example
@@ -260,30 +253,22 @@ module Appium
260
253
  # @driver.unlock
261
254
  #
262
255
  def unlock
263
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: unlock' extension instead"
264
256
  @bridge.unlock
265
257
  end
266
258
 
267
- # @deprecated Use 'mobile: hideKeyboard' extension instead.
268
259
  # Hide the onscreen keyboard
269
260
  # @param [String] close_key The name of the key which closes the keyboard.
270
261
  # Defaults to 'Done' for iOS(except for XCUITest).
271
- # @param [Symbol] strategy The symbol of the strategy which closes the keyboard.
272
- # XCUITest ignore this argument.
273
- # Default for iOS is +:pressKey+. Default for Android is +:tapOutside+.
274
262
  #
275
263
  # @example
276
264
  #
277
265
  # @driver.hide_keyboard # Close a keyboard with the 'Done' button
278
266
  # @driver.hide_keyboard('Finished') # Close a keyboard with the 'Finished' button
279
- # @driver.hide_keyboard(nil, :tapOutside) # Close a keyboard with tapping out side of keyboard
280
267
  #
281
- def hide_keyboard(close_key = nil, strategy = nil)
282
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: hideKeyboard' extension instead"
283
- @bridge.hide_keyboard close_key, strategy
268
+ def hide_keyboard(close_key = nil)
269
+ @bridge.hide_keyboard close_key
284
270
  end
285
271
 
286
- # @deprecated Use 'mobile: isKeyboardShown' extension instead.
287
272
  # Get whether keyboard is displayed or not.
288
273
  # @return [Boolean] Return true if keyboard is shown. Return false if keyboard is hidden.
289
274
  #
@@ -292,7 +277,6 @@ module Appium
292
277
  # @driver.keyboard_shown? # true
293
278
  #
294
279
  def keyboard_shown?
295
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: isKeyboardShown' extension instead"
296
280
  @bridge.is_keyboard_shown
297
281
  end
298
282
  alias is_keyboard_shown keyboard_shown?
@@ -542,15 +526,14 @@ module Appium
542
526
  @bridge.pull_folder(path)
543
527
  end
544
528
 
545
- # @deprecated Use 'mobile: pressKey' extension instead.
546
529
  # Press keycode on the device.
547
530
  # http://developer.android.com/reference/android/view/KeyEvent.html
548
531
  # @param [Integer] key The key to press. The values which have +KEYCODE_+ prefix in http://developer.android.com/reference/android/view/KeyEvent.html
549
532
  # e.g.: KEYCODE_HOME is +3+ or +0x00000003+
550
- # @param [[Integer]] metastate The state the metakeys should be in when pressing the key. Default is empty Array.
533
+ # @param [Array<Integer>] metastate The state the metakeys should be in when pressing the key. Default is empty Array.
551
534
  # Metastate have +META_+ prefix in https://developer.android.com/reference/android/view/KeyEvent.html
552
535
  # e.g.: META_SHIFT_ON is +1+ or +0x00000001+
553
- # @param [[Integer]] flags Native Android flag value. Several flags can be combined into a single key event.
536
+ # @param [Array<Integer>] flags Native Android flag value. Several flags can be combined into a single key event.
554
537
  # Default is empty Array. Can set multiple flags as Array.
555
538
  # Flags have +FLAG_+ prefix in http://developer.android.com/reference/android/view/KeyEvent.html
556
539
  # e.g.: FLAG_CANCELED is +32+ or +0x00000020+
@@ -562,19 +545,17 @@ module Appium
562
545
  # @driver.press_keycode 66, metastate: [1], flags: [32]
563
546
  #
564
547
  def press_keycode(key, metastate: [], flags: [])
565
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: pressKey' extension instead"
566
548
  @bridge.press_keycode(key, metastate: metastate, flags: flags)
567
549
  end
568
550
 
569
- # @deprecated Use 'mobile: pressKey' extension instead.
570
551
  # Long press keycode on the device.
571
552
  # http://developer.android.com/reference/android/view/KeyEvent.html
572
553
  # @param [Integer] key The key to long press. The values which have +KEYCODE_+ prefix in http://developer.android.com/reference/android/view/KeyEvent.html
573
554
  # e.g.: KEYCODE_HOME is +3+ or +0x00000003+
574
- # @param [[Integer]] metastate The state the metakeys should be in when pressing the key. Default is empty Array.
555
+ # @param [Array<Integer>] metastate The state the metakeys should be in when pressing the key. Default is empty Array.
575
556
  # Metastate have +META_+ prefix in https://developer.android.com/reference/android/view/KeyEvent.html
576
557
  # e.g.: META_SHIFT_ON is +1+ or +0x00000001+
577
- # @param [[Integer]] flags Native Android flag value. Several flags can be combined into a single key event.
558
+ # @param [Array<Integer>] flags Native Android flag value. Several flags can be combined into a single key event.
578
559
  # Default is empty Array. Can set multiple flags as Array.
579
560
  # Flags have +FLAG_+ prefix in http://developer.android.com/reference/android/view/KeyEvent.html
580
561
  # e.g.: FLAG_CANCELED is +32+ or +0x00000020+
@@ -586,11 +567,9 @@ module Appium
586
567
  # @driver.long_press_keycode 66, metastate: [1], flags: [32, 8192]
587
568
  #
588
569
  def long_press_keycode(key, metastate: [], flags: [])
589
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: pressKey' extension instead"
590
570
  @bridge.long_press_keycode(key, metastate: metastate, flags: flags)
591
571
  end
592
572
 
593
- # @deprecated Use 'mobile: getAppStrings' extension instead.
594
573
  # Return the hash of all localization strings.
595
574
  # @return [Hash]
596
575
  #
@@ -599,11 +578,9 @@ module Appium
599
578
  # @driver.app_strings #=> "TransitionsTitle"=>"Transitions", "WebTitle"=>"Web"
600
579
  #
601
580
  def app_strings(language = nil)
602
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getAppStrings' extension instead"
603
581
  @bridge.app_strings(language)
604
582
  end
605
583
 
606
- # @deprecated Use 'mobile: backgroundApp' extension instead.
607
584
  # Backgrounds the app for a set number of seconds.
608
585
  # This is a blocking application
609
586
  # @param [Integer] duration How many seconds to background the app for.
@@ -732,7 +709,6 @@ module Appium
732
709
  # @driver.query_app_state("io.appium.bundle") #=> :not_running
733
710
  #
734
711
  def app_state(app_id)
735
- # TODO: use mobile command in the background?
736
712
  @bridge.app_state(app_id)
737
713
  end
738
714
  alias query_app_state app_state
@@ -772,7 +748,6 @@ module Appium
772
748
  @bridge.stop_and_save_recording_screen(file_path)
773
749
  end
774
750
 
775
- # @deprecated Use 'mobile: shake' extension instead.
776
751
  # Cause the device to shake
777
752
  #
778
753
  # @example
@@ -780,11 +755,9 @@ module Appium
780
755
  # @driver.shake
781
756
  #
782
757
  def shake
783
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: shake' extension instead"
784
758
  @bridge.shake
785
759
  end
786
760
 
787
- # @deprecated Use 'mobile: getDeviceTime' extension instead.
788
761
  # Get the time on the device
789
762
  #
790
763
  # @param [String] format The set of format specifiers. Read https://momentjs.com/docs/ to get
@@ -798,7 +771,6 @@ module Appium
798
771
  # @driver.device_time "YYYY-MM-DD" #=> "2018-06-12"
799
772
  #
800
773
  def device_time(format = nil)
801
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getDeviceTime' extension instead"
802
774
  @bridge.device_time(format)
803
775
  end
804
776
 
@@ -184,75 +184,31 @@ module Appium
184
184
  set_context: [:post, 'session/:session_id/context'],
185
185
  current_context: [:get, 'session/:session_id/context'],
186
186
 
187
- background_app: [:post, 'session/:session_id/appium/app/background'],
188
- app_strings: [:post, 'session/:session_id/appium/app/strings'],
189
-
190
- device_locked?: [:post, 'session/:session_id/appium/device/is_locked'],
191
- unlock: [:post, 'session/:session_id/appium/device/unlock'],
192
- lock: [:post, 'session/:session_id/appium/device/lock'],
193
187
  device_time: [:get, 'session/:session_id/appium/device/system_time'],
194
188
  install_app: [:post, 'session/:session_id/appium/device/install_app'],
195
189
  remove_app: [:post, 'session/:session_id/appium/device/remove_app'],
196
190
  app_installed?: [:post, 'session/:session_id/appium/device/app_installed'],
197
191
  activate_app: [:post, 'session/:session_id/appium/device/activate_app'],
198
192
  terminate_app: [:post, 'session/:session_id/appium/device/terminate_app'],
199
- app_state: [:post, 'session/:session_id/appium/device/app_state'],
200
- shake: [:post, 'session/:session_id/appium/device/shake'],
201
- hide_keyboard: [:post, 'session/:session_id/appium/device/hide_keyboard'],
202
- press_keycode: [:post, 'session/:session_id/appium/device/press_keycode'],
203
- long_press_keycode: [:post, 'session/:session_id/appium/device/long_press_keycode'],
204
193
  push_file: [:post, 'session/:session_id/appium/device/push_file'],
205
194
  pull_file: [:post, 'session/:session_id/appium/device/pull_file'],
206
195
  pull_folder: [:post, 'session/:session_id/appium/device/pull_folder'],
207
- get_clipboard: [:post, 'session/:session_id/appium/device/get_clipboard'],
208
- set_clipboard: [:post, 'session/:session_id/appium/device/set_clipboard'],
209
- finger_print: [:post, 'session/:session_id/appium/device/finger_print'],
210
196
  get_settings: [:get, 'session/:session_id/appium/settings'],
211
197
  update_settings: [:post, 'session/:session_id/appium/settings'],
212
198
  stop_recording_screen: [:post, 'session/:session_id/appium/stop_recording_screen'],
213
199
  start_recording_screen: [:post, 'session/:session_id/appium/start_recording_screen'],
214
200
  compare_images: [:post, 'session/:session_id/appium/compare_images'],
215
- is_keyboard_shown: [:get, 'session/:session_id/appium/device/is_keyboard_shown'],
216
201
  execute_driver: [:post, 'session/:session_id/appium/execute_driver'],
217
202
  post_log_event: [:post, 'session/:session_id/appium/log_event'],
218
203
  get_log_events: [:post, 'session/:session_id/appium/events']
219
204
  }.freeze
220
205
 
221
206
  COMMAND_ANDROID = {
222
- open_notifications: [:post, 'session/:session_id/appium/device/open_notifications'],
223
- toggle_airplane_mode: [:post, 'session/:session_id/appium/device/toggle_airplane_mode'],
224
- start_activity: [:post, 'session/:session_id/appium/device/start_activity'],
225
- current_activity: [:get, 'session/:session_id/appium/device/current_activity'],
226
- current_package: [:get, 'session/:session_id/appium/device/current_package'],
227
- get_system_bars: [:get, 'session/:session_id/appium/device/system_bars'],
228
- get_display_density: [:get, 'session/:session_id/appium/device/display_density'],
229
- toggle_wifi: [:post, 'session/:session_id/appium/device/toggle_wifi'],
230
- toggle_data: [:post, 'session/:session_id/appium/device/toggle_data'],
231
- toggle_location_services: [:post, 'session/:session_id/appium/device/toggle_location_services'],
232
- get_performance_data_types: [:post, 'session/:session_id/appium/performanceData/types'],
233
- get_performance_data: [:post, 'session/:session_id/appium/getPerformanceData'],
234
- get_network_connection: [:get, 'session/:session_id/network_connection'], # defined also in OSS
235
- set_network_connection: [:post, 'session/:session_id/network_connection'], # defined also in OSS
236
-
237
- # only emulator
238
- send_sms: [:post, 'session/:session_id/appium/device/send_sms'],
239
- gsm_call: [:post, 'session/:session_id/appium/device/gsm_call'],
240
- gsm_signal: [:post, 'session/:session_id/appium/device/gsm_signal'],
241
- gsm_voice: [:post, 'session/:session_id/appium/device/gsm_voice'],
242
- set_network_speed: [:post, 'session/:session_id/appium/device/network_speed'],
243
- set_power_capacity: [:post, 'session/:session_id/appium/device/power_capacity'],
244
- set_power_ac: [:post, 'session/:session_id/appium/device/power_ac'],
245
-
246
207
  # For chromium: https://chromium.googlesource.com/chromium/src/+/master/chrome/test/chromedriver/server/http_handler.cc
247
208
  chrome_send_command: [:post, 'session/:session_id/goog/cdp/execute']
248
209
  }.freeze
249
210
 
250
- COMMAND_IOS = {
251
- touch_id: [:post, 'session/:session_id/appium/simulator/touch_id'],
252
- toggle_touch_id_enrollment: [:post, 'session/:session_id/appium/simulator/toggle_touch_id_enrollment']
253
- }.freeze
254
-
255
- COMMANDS = {}.merge(COMMAND).merge(COMMAND_ANDROID).merge(COMMAND_IOS).freeze
211
+ COMMANDS = {}.merge(COMMAND).merge(COMMAND_ANDROID).freeze
256
212
  end # module Commands
257
213
  end # module Core
258
214
  end # module Appium
@@ -19,7 +19,7 @@ module Appium
19
19
  module AppManagement
20
20
  def app_strings(language = nil)
21
21
  opts = language ? { language: language } : {}
22
- execute :app_strings, {}, opts
22
+ execute_script 'mobile:getAppStrings', opts
23
23
  end
24
24
 
25
25
  def background_app(duration = 0)
@@ -26,8 +26,8 @@ module Appium
26
26
  ].freeze
27
27
 
28
28
  def app_state(app_id)
29
- # required: [['appId'], ['bundleId']]
30
- response = execute :app_state, {}, appId: app_id
29
+ # appId is for android, bundleId is for ios.
30
+ response = execute_script 'mobile:queryAppState', { 'appId': app_id, 'bundleId': app_id }
31
31
 
32
32
  case response
33
33
  when 0, 1, 2, 3, 4
@@ -18,13 +18,14 @@ module Appium
18
18
  module Device
19
19
  module Device
20
20
  def shake
21
- execute :shake
21
+ execute_script 'mobile:shake', {}
22
22
  end
23
23
 
24
24
  def device_time(format = nil)
25
25
  arg = {}
26
26
  arg[:format] = format unless format.nil?
27
- execute :device_time, {}, arg
27
+
28
+ execute_script 'mobile:getDeviceTime', arg
28
29
  end
29
30
  end # module Device
30
31
  end # module Device
@@ -19,15 +19,15 @@ module Appium
19
19
  module DeviceLock
20
20
  def lock(duration = nil)
21
21
  opts = duration ? { seconds: duration } : {}
22
- execute :lock, {}, opts
22
+ execute_script 'mobile:lock', opts
23
23
  end
24
24
 
25
25
  def device_locked?
26
- execute :device_locked?
26
+ execute_script 'mobile:isLocked', {}
27
27
  end
28
28
 
29
29
  def unlock
30
- execute :unlock
30
+ execute_script 'mobile:unlock', {}
31
31
  end
32
32
  end # module DeviceLock
33
33
  end # module Device
@@ -17,17 +17,16 @@ module Appium
17
17
  class Base
18
18
  module Device
19
19
  module Keyboard
20
- def hide_keyboard(close_key = nil, strategy = nil)
20
+ def hide_keyboard(close_key = nil)
21
21
  option = {}
22
22
 
23
- option[:key] = close_key || 'Done' # default to Done key.
24
- option[:strategy] = strategy || :pressKey # default to pressKey
23
+ option[:key] = close_key || 'Done' # default to Done key.
25
24
 
26
- execute :hide_keyboard, {}, option
25
+ execute_script 'mobile:hideKeyboard', option
27
26
  end
28
27
 
29
28
  def is_keyboard_shown # rubocop:disable Naming/PredicateName
30
- execute :is_keyboard_shown
29
+ execute_script 'mobile:isKeyboardShown', {}
31
30
  end
32
31
  end # module Keyboard
33
32
  end # module Device
@@ -32,18 +32,18 @@ module Appium
32
32
  args[:metastate] = metastate.reduce(0) { |acc, meta| acc | meta } unless metastate.empty?
33
33
  args[:flags] = flags.reduce(0) { |acc, flag| acc | flag } unless flags.empty?
34
34
 
35
- execute :press_keycode, {}, args
35
+ execute_script 'mobile:pressKey', args
36
36
  end
37
37
 
38
38
  def long_press_keycode(key, metastate: [], flags: [])
39
39
  raise ::Appium::Core::Error::ArgumentError, 'flags should be Array' unless flags.is_a? Array
40
40
  raise ::Appium::Core::Error::ArgumentError, 'metastates should be Array' unless metastate.is_a? Array
41
41
 
42
- args = { keycode: key }
42
+ args = { keycode: key, isLongPress: true }
43
43
  args[:metastate] = metastate.reduce(0) { |acc, meta| acc | meta } unless metastate.empty?
44
44
  args[:flags] = flags.reduce(0) { |acc, flag| acc | flag } unless flags.empty?
45
45
 
46
- execute :long_press_keycode, {}, args
46
+ execute_script 'mobile:pressKey', args
47
47
  end
48
48
  end # module KeyEvent
49
49
  end # module Device
@@ -19,8 +19,8 @@ module Appium
19
19
  @bridge = bridge
20
20
  end
21
21
 
22
- # @param [String|Hash] type You can get particular type's logs.
23
- # @return [[Selenium::WebDriver::LogEntry]] A list of logs data.
22
+ # @param [String, Hash] type You can get particular type's logs.
23
+ # @return [Array<Selenium::WebDriver::LogEntry>] A list of logs data.
24
24
  #
25
25
  # @example
26
26
  #
@@ -33,7 +33,7 @@ module Appium
33
33
 
34
34
  # Get a list of available log types
35
35
  #
36
- # @return [[Hash]] A list of available log types.
36
+ # @return [Array<Hash>] A list of available log types.
37
37
  # @example
38
38
  #
39
39
  # @driver.logs.available_types # [:syslog, :crashlog, :performance]
@@ -74,7 +74,7 @@ module Appium
74
74
  # @since Appium 1.16.0
75
75
  # Returns events with filtering with 'type'. Defaults to all available events.
76
76
  #
77
- # @param [String] type The type of events to get
77
+ # @param [String, Array<String>] type The type of events to get
78
78
  # @return [Hash]
79
79
  #
80
80
  # @example
@@ -84,7 +84,7 @@ module Appium
84
84
  # Accepts either a String or an Array of byte-sized integers and sends a text or binary message over the connection
85
85
  # to the other peer; binary data must be encoded as an Array.
86
86
  #
87
- # @param [String|Array] message A message to send a text or binary message over the connection
87
+ # @param [String, Array] message A message to send a text or binary message over the connection
88
88
  #
89
89
  # @example
90
90
  # ws = WebSocket.new(url: "ws://#{host}:#{port}/ws/session/#{@session_id}/appium/device/logcat")
@@ -29,7 +29,7 @@ module Appium
29
29
 
30
30
  params = { contentType: content_type }
31
31
 
32
- data = execute(:get_clipboard, {}, params)
32
+ data = execute_script 'mobile:getClipboard', params
33
33
  Base64.decode64 data
34
34
  end
35
35
  end
@@ -46,7 +46,7 @@ module Appium
46
46
  content: Base64.strict_encode64(content)
47
47
  }
48
48
 
49
- execute(:set_clipboard, {}, params)
49
+ execute_script 'mobile:setClipboard', params
50
50
  end
51
51
  end
52
52
  end
@@ -75,13 +75,13 @@ module Appium
75
75
 
76
76
  ::Appium::Core::Device.add_endpoint_method(:touch_id) do
77
77
  def touch_id(match = true)
78
- execute :touch_id, {}, match: match
78
+ execute_script 'mobile:sendBiometricMatch', { 'type': 'touch_id', match: match }
79
79
  end
80
80
  end
81
81
 
82
82
  ::Appium::Core::Device.add_endpoint_method(:toggle_touch_id_enrollment) do
83
83
  def toggle_touch_id_enrollment(enabled = true)
84
- execute :toggle_touch_id_enrollment, {}, enabled: enabled
84
+ execute_script 'mobile:enrollBiometric', { 'isEnabled': enabled }
85
85
  end
86
86
  end
87
87
 
@@ -25,13 +25,9 @@ module Appium
25
25
 
26
26
  # rubocop:disable Layout/LineLength
27
27
 
28
- # @deprecated Use 'mobile: hideKeyboard' extension instead.
29
- # @!method hide_keyboard(close_key = nil, strategy = nil)
28
+ # @!method hide_keyboard(close_key = nil)
30
29
  # Hide the onscreen keyboard
31
30
  # @param [String] close_key The name of the key which closes the keyboard.
32
- # @param [Symbol] strategy The symbol of the strategy which closes the keyboard.
33
- # XCUITest ignore this argument.
34
- # Default for iOS is +:pressKey+. Default for Android is +:tapOutside+.
35
31
  #
36
32
  # @example
37
33
  #
@@ -39,7 +35,6 @@ module Appium
39
35
  # @driver.hide_keyboard('Finished') # Close a keyboard with the 'Finished' button
40
36
  #
41
37
 
42
- # @deprecated Use 'mobile: backgroundApp' extension instead.
43
38
  # @!method background_app(duration = 0)
44
39
  # Backgrounds the app for a set number of seconds.
45
40
  # This is a blocking application.
@@ -183,23 +178,19 @@ module Appium
183
178
  def extended(_mod)
184
179
  # Xcuitest, Override included method in bridge
185
180
  ::Appium::Core::Device.add_endpoint_method(:hide_keyboard) do
186
- def hide_keyboard(close_key = nil, strategy = nil)
181
+ def hide_keyboard(close_key = nil)
187
182
  option = {}
188
183
 
189
184
  option[:key] = close_key if close_key
190
- option[:strategy] = strategy if strategy
191
185
 
192
- execute :hide_keyboard, {}, option
186
+ execute_script 'mobile:hideKeyboard', option
193
187
  end
194
188
  end
195
189
 
196
190
  # Xcuitest, Override included method in bridge
197
191
  ::Appium::Core::Device.add_endpoint_method(:background_app) do
198
192
  def background_app(duration = 0)
199
- # https://github.com/appium/ruby_lib/issues/500, https://github.com/appium/appium/issues/7741
200
- # 'execute :background_app, {}, seconds: { timeout: duration_milli_sec }' works over Appium 1.6.4
201
- duration_milli_sec = duration.nil? ? nil : duration * 1000
202
- execute :background_app, {}, seconds: { timeout: duration_milli_sec }
193
+ execute_script 'mobile:backgroundApp', { seconds: duration }
203
194
  end
204
195
  end
205
196
 
@@ -14,7 +14,7 @@
14
14
 
15
15
  module Appium
16
16
  module Core
17
- VERSION = '10.0.0' unless defined? ::Appium::Core::VERSION
18
- DATE = '2025-02-16' unless defined? ::Appium::Core::DATE
17
+ VERSION = '11.0.0' unless defined? ::Appium::Core::VERSION
18
+ DATE = '2025-03-21' unless defined? ::Appium::Core::DATE
19
19
  end
20
20
  end
@@ -32,8 +32,6 @@ module Appium
32
32
 
33
33
  include Base::HasLocation
34
34
 
35
- include Base::HasNetworkConnection
36
-
37
35
  include Core::Waitable
38
36
 
39
37
  attr_reader bridge: untyped
@@ -62,7 +60,7 @@ module Appium
62
60
 
63
61
  def unlock: () -> untyped
64
62
 
65
- def hide_keyboard: (?untyped? close_key, ?untyped? strategy) -> untyped
63
+ def hide_keyboard: (?untyped? close_key) -> untyped
66
64
 
67
65
  def keyboard_shown?: () -> untyped
68
66
 
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: 10.0.0
4
+ version: 11.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuaki MATSUO
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-02-17 00:00:00.000000000 Z
11
+ date: 2025-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faye-websocket
@@ -61,7 +61,6 @@ files:
61
61
  - lib/appium_lib_core/android/device/auth_finger_print.rb
62
62
  - lib/appium_lib_core/android/device/clipboard.rb
63
63
  - lib/appium_lib_core/android/device/emulator.rb
64
- - lib/appium_lib_core/android/device/network.rb
65
64
  - lib/appium_lib_core/android/device/performance.rb
66
65
  - lib/appium_lib_core/android/device/screen.rb
67
66
  - lib/appium_lib_core/android/espresso/bridge.rb
@@ -79,7 +78,6 @@ files:
79
78
  - lib/appium_lib_core/common/base/driver.rb
80
79
  - lib/appium_lib_core/common/base/driver_settings.rb
81
80
  - lib/appium_lib_core/common/base/has_location.rb
82
- - lib/appium_lib_core/common/base/has_network_connection.rb
83
81
  - lib/appium_lib_core/common/base/http_default.rb
84
82
  - lib/appium_lib_core/common/base/platform.rb
85
83
  - lib/appium_lib_core/common/base/remote_status.rb
@@ -145,7 +143,6 @@ files:
145
143
  - sig/lib/appium_lib_core/common/base/driver.rbs
146
144
  - sig/lib/appium_lib_core/common/base/driver_settings.rbs
147
145
  - sig/lib/appium_lib_core/common/base/has_location.rbs
148
- - sig/lib/appium_lib_core/common/base/has_network_connection.rbs
149
146
  - sig/lib/appium_lib_core/common/base/http_default.rbs
150
147
  - sig/lib/appium_lib_core/common/base/platform.rbs
151
148
  - sig/lib/appium_lib_core/common/base/remote_status.rbs
@@ -177,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
174
  - !ruby/object:Gem::Version
178
175
  version: '0'
179
176
  requirements: []
180
- rubygems_version: 3.5.9
177
+ rubygems_version: 3.4.10
181
178
  signing_key:
182
179
  specification_version: 4
183
180
  summary: Minimal Ruby library for Appium.
@@ -1,71 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- module Appium
16
- module Core
17
- module Android
18
- module Device
19
- module Network
20
- def self.add_methods
21
- ::Appium::Core::Device.add_endpoint_method(:get_network_connection) do
22
- def get_network_connection
23
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getConnectivity' extension instead"
24
-
25
- execute :get_network_connection
26
- end
27
- end
28
-
29
- ::Appium::Core::Device.add_endpoint_method(:toggle_wifi) do
30
- def toggle_wifi
31
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: setConnectivity' extension instead"
32
-
33
- execute :toggle_wifi
34
- end
35
- end
36
-
37
- ::Appium::Core::Device.add_endpoint_method(:toggle_data) do
38
- def toggle_data
39
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: setConnectivity' extension instead"
40
-
41
- execute :toggle_data
42
- end
43
- end
44
-
45
- ::Appium::Core::Device.add_endpoint_method(:set_network_connection) do
46
- def set_network_connection(mode)
47
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: setConnectivity' extension instead"
48
-
49
- # same as ::Selenium::WebDriver::DriverExtensions::HasNetworkConnection
50
- # But this method accept number
51
- connection_type = { airplane_mode: 1, wifi: 2, data: 4, all: 6, none: 0 }
52
- type = connection_type.key?(mode) ? connection_type[mode] : mode.to_i
53
-
54
- execute :set_network_connection, {}, type: type
55
- end
56
- end
57
-
58
- ::Appium::Core::Device.add_endpoint_method(:toggle_airplane_mode) do
59
- def toggle_airplane_mode
60
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: setConnectivity' extension instead"
61
-
62
- execute :toggle_airplane_mode
63
- end
64
- alias_method :toggle_flight_mode, :toggle_airplane_mode
65
- end
66
- end
67
- end # module Network
68
- end # module Device
69
- end # module Android
70
- end # module Core
71
- end # module Appium
@@ -1,56 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- module Appium
16
- module Core
17
- class Base
18
- #
19
- # @api private
20
- #
21
- module HasNetworkConnection
22
- def network_connection_type
23
- connection_value = @bridge.network_connection
24
-
25
- connection_type = values_to_type[connection_value]
26
-
27
- # In case the connection type is not recognized return the
28
- # connection value.
29
- connection_type || connection_value
30
- end
31
-
32
- def network_connection_type=(connection_type)
33
- raise ::Appium::Core::Error::ArgumentError, 'Invalid connection type' unless valid_type? connection_type
34
-
35
- connection_value = type_to_values[connection_type]
36
-
37
- @bridge.network_connection = connection_value
38
- end
39
-
40
- private
41
-
42
- def type_to_values
43
- { airplane_mode: 1, wifi: 2, data: 4, all: 6, none: 0 }
44
- end
45
-
46
- def values_to_type
47
- type_to_values.invert
48
- end
49
-
50
- def valid_type?(type)
51
- type_to_values.keys.include? type
52
- end
53
- end
54
- end
55
- end
56
- end
@@ -1,19 +0,0 @@
1
- module Appium
2
- module Core
3
- class Base
4
- module HasNetworkConnection
5
- def network_connection_type: () -> untyped
6
-
7
- def network_connection_type=: (untyped connection_type) -> untyped
8
-
9
- private
10
-
11
- def type_to_values: () -> Hash[Symbol, Integer]
12
-
13
- def values_to_type: () -> untyped
14
-
15
- def valid_type?: (untyped type) -> untyped
16
- end
17
- end
18
- end
19
- end