appium_lib_core 4.1.0 → 9.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +357 -270
  3. data/README.md +68 -16
  4. data/Rakefile +8 -20
  5. data/Steepfile +11 -0
  6. data/appium_lib_core.gemspec +13 -15
  7. data/bin/console +0 -4
  8. data/lib/appium_lib_core/android/device/auth_finger_print.rb +4 -1
  9. data/lib/appium_lib_core/android/device/clipboard.rb +4 -2
  10. data/lib/appium_lib_core/android/device/emulator.rb +11 -5
  11. data/lib/appium_lib_core/android/device/network.rb +10 -0
  12. data/lib/appium_lib_core/android/device/performance.rb +3 -0
  13. data/lib/appium_lib_core/android/device/screen.rb +5 -1
  14. data/lib/appium_lib_core/android/device.rb +83 -20
  15. data/lib/appium_lib_core/common/base/bridge.rb +238 -95
  16. data/lib/appium_lib_core/common/base/capabilities.rb +21 -8
  17. data/lib/appium_lib_core/common/{command/mjsonwp.rb → base/device_ime.rb} +33 -12
  18. data/lib/appium_lib_core/common/base/driver.rb +260 -334
  19. data/lib/appium_lib_core/common/base/driver_settings.rb +51 -0
  20. data/lib/appium_lib_core/common/base/has_location.rb +80 -0
  21. data/lib/appium_lib_core/common/base/has_network_connection.rb +56 -0
  22. data/lib/appium_lib_core/common/base/http_default.rb +22 -38
  23. data/lib/appium_lib_core/{ios/uiautomation/bridge.rb → common/base/remote_status.rb} +9 -8
  24. data/lib/appium_lib_core/common/base/rotable.rb +62 -0
  25. data/lib/appium_lib_core/common/base/screenshot.rb +10 -10
  26. data/lib/appium_lib_core/common/base/search_context.rb +98 -172
  27. data/lib/appium_lib_core/common/base.rb +1 -5
  28. data/lib/appium_lib_core/common/command.rb +244 -4
  29. data/lib/appium_lib_core/common/device/app_management.rb +2 -26
  30. data/lib/appium_lib_core/common/device/context.rb +1 -5
  31. data/lib/appium_lib_core/common/device/image_comparison.rb +27 -10
  32. data/lib/appium_lib_core/common/device/keyevent.rb +4 -4
  33. data/lib/appium_lib_core/common/device/{touch_actions.rb → orientation.rb} +6 -10
  34. data/lib/appium_lib_core/common/device/screen_record.rb +8 -2
  35. data/lib/appium_lib_core/common/error.rb +5 -5
  36. data/lib/appium_lib_core/common/log.rb +5 -4
  37. data/lib/appium_lib_core/common/wait.rb +38 -6
  38. data/lib/appium_lib_core/device.rb +3 -9
  39. data/lib/appium_lib_core/driver.rb +193 -182
  40. data/lib/appium_lib_core/{patch.rb → element.rb} +64 -26
  41. data/lib/appium_lib_core/ios/device/clipboard.rb +4 -2
  42. data/lib/appium_lib_core/ios/xcuitest/device.rb +2 -0
  43. data/lib/appium_lib_core/{common/base/command.rb → mac2/bridge.rb} +9 -8
  44. data/lib/appium_lib_core/mac2/device/screen.rb +48 -0
  45. data/lib/appium_lib_core/mac2/device.rb +92 -0
  46. data/lib/appium_lib_core/{ios.rb → mac2.rb} +2 -5
  47. data/lib/appium_lib_core/support/event_firing_bridge.rb +57 -0
  48. data/lib/appium_lib_core/version.rb +2 -2
  49. data/lib/appium_lib_core.rb +23 -10
  50. data/rbs_collection.lock.yaml +252 -0
  51. data/rbs_collection.yaml +15 -0
  52. data/sig/gems/selenium/abstract_event_listener.rbs +8 -0
  53. data/sig/gems/selenium/capabilities.rbs +8 -0
  54. data/sig/gems/selenium/common.rbs +10 -0
  55. data/sig/gems/selenium/default.rbs +10 -0
  56. data/sig/gems/selenium/driver.rbs +7 -0
  57. data/sig/gems/selenium/has_session_id.rbs +8 -0
  58. data/sig/gems/selenium/has_web_storage.rbs +8 -0
  59. data/sig/gems/selenium/uploads_files.rbs +8 -0
  60. data/sig/lib/appium_lib_core/common/base/capabilities.rbs +9 -0
  61. data/sig/lib/appium_lib_core/common/base/driver.rbs +167 -0
  62. data/sig/lib/appium_lib_core/common/base/driver_settings.rbs +15 -0
  63. data/sig/lib/appium_lib_core/common/base/has_location.rbs +13 -0
  64. data/sig/lib/appium_lib_core/common/base/has_network_connection.rbs +19 -0
  65. data/sig/lib/appium_lib_core/common/base/http_default.rbs +38 -0
  66. data/sig/lib/appium_lib_core/common/base/platform.rbs +7 -0
  67. data/sig/lib/appium_lib_core/common/base/remote_status.rbs +9 -0
  68. data/sig/lib/appium_lib_core/common/base/rotable.rbs +17 -0
  69. data/sig/lib/appium_lib_core/common/base/screenshot.rbs +19 -0
  70. data/sig/lib/appium_lib_core/common/device/battery_status.rbs +13 -0
  71. data/sig/lib/appium_lib_core/common/wait.rbs +31 -0
  72. data/sig/lib/appium_lib_core/device.rbs +21 -0
  73. data/sig/lib/appium_lib_core/driver.rbs +196 -0
  74. data/sig/lib/appium_lib_core/ios/xcuitest/device/battery.rbs +15 -0
  75. data/sig/lib/appium_lib_core/version.rbs +7 -0
  76. data/sig/lib/appium_lib_core.rbs +8 -0
  77. metadata +88 -111
  78. data/.github/ISSUE_TEMPLATE/issue-report.md +0 -29
  79. data/.github/contributing.md +0 -26
  80. data/.github/issue_template.md +0 -20
  81. data/.github/workflows/unittest.yml +0 -68
  82. data/.gitignore +0 -18
  83. data/.rubocop.yml +0 -58
  84. data/azure-pipelines.yml +0 -15
  85. data/ci-jobs/functional/android_setup.yml +0 -3
  86. data/ci-jobs/functional/ios_setup.yml +0 -7
  87. data/ci-jobs/functional/publish_test_result.yml +0 -18
  88. data/ci-jobs/functional/run_appium.yml +0 -25
  89. data/ci-jobs/functional/start-emulator.sh +0 -26
  90. data/ci-jobs/functional_test.yml +0 -298
  91. data/docs/mobile_command.md +0 -34
  92. data/lib/appium_lib_core/common/base/bridge/mjsonwp.rb +0 -81
  93. data/lib/appium_lib_core/common/base/bridge/w3c.rb +0 -252
  94. data/lib/appium_lib_core/common/command/common.rb +0 -110
  95. data/lib/appium_lib_core/common/command/w3c.rb +0 -56
  96. data/lib/appium_lib_core/common/device/value.rb +0 -52
  97. data/lib/appium_lib_core/common/touch_action/multi_touch.rb +0 -56
  98. data/lib/appium_lib_core/common/touch_action/touch_actions.rb +0 -203
  99. data/lib/appium_lib_core/ios/uiautomation/device.rb +0 -44
  100. data/lib/appium_lib_core/ios/uiautomation/patch.rb +0 -34
  101. data/release_notes.md +0 -816
  102. data/script/commands.rb +0 -200
@@ -27,6 +27,7 @@ module Appium
27
27
 
28
28
  # rubocop:disable Layout/LineLength
29
29
 
30
+ # @deprecated Use 'mobile: openNotifications' extension instead.
30
31
  # @!method open_notifications
31
32
  # Open Android notifications
32
33
  #
@@ -35,6 +36,7 @@ module Appium
35
36
  # @driver.open_notifications
36
37
  #
37
38
 
39
+ # @deprecated Use 'mobile: getCurrentActivity' extension instead.
38
40
  # @!method current_activity
39
41
  # Get current activity name
40
42
  # @return [String] An activity name
@@ -44,6 +46,7 @@ module Appium
44
46
  # @driver.current_activity # '.ApiDemos'
45
47
  #
46
48
 
49
+ # @deprecated Use 'mobile: getCurrentPackage' extension instead.
47
50
  # @!method current_package
48
51
  # Get current package name
49
52
  # @return [String] A package name
@@ -53,6 +56,7 @@ module Appium
53
56
  # @driver.current_package # 'com.example.android.apis'
54
57
  #
55
58
 
59
+ # @deprecated Use 'mobile: getSystemBars' extension instead.
56
60
  # @!method get_system_bars
57
61
  # Get system bar's information
58
62
  # @return [String]
@@ -63,6 +67,7 @@ module Appium
63
67
  # @driver.system_bars
64
68
  #
65
69
 
70
+ # @deprecated Use 'mobile: getDisplayDensity' extension instead.
66
71
  # @!method get_display_density
67
72
  # Get connected device's density.
68
73
  # @return [Integer] The size of density
@@ -72,6 +77,7 @@ module Appium
72
77
  # @driver.get_display_density # 320
73
78
  #
74
79
 
80
+ # @deprecated Use 'mobile: getConnectivity' extension instead.
75
81
  # @!method get_network_connection
76
82
  # Get the device network connection current status
77
83
  # See set_network_connection method for return value
@@ -86,6 +92,7 @@ module Appium
86
92
  # @driver.get_network_connection #=> 6
87
93
  #
88
94
 
95
+ # @deprecated Use 'mobile: getConnectivity' extension instead.
89
96
  # @!method toggle_wifi
90
97
  # Switch the state of the wifi service only for Android
91
98
  #
@@ -96,6 +103,7 @@ module Appium
96
103
  # @driver.toggle_wifi
97
104
  #
98
105
 
106
+ # @deprecated Use 'mobile: getConnectivity' extension instead.
99
107
  # @!method toggle_data
100
108
  # Switch the state of data service only for Android, and the device should be rooted
101
109
  #
@@ -106,6 +114,45 @@ module Appium
106
114
  # @driver.toggle_data
107
115
  #
108
116
 
117
+ # @deprecated Use 'mobile: getConnectivity' extension instead.
118
+ # @!method location
119
+ # Get the location of the device.
120
+ #
121
+ # @return [::Appium::Location]
122
+ #
123
+ # @example
124
+ #
125
+ # driver.location #=> ::Appium::Location.new(10, 10, 10)
126
+ #
127
+
128
+ # @!method location=
129
+ # Set the location of the device.
130
+ #
131
+ # @param [::Appium::Location] location Set the location.
132
+ #
133
+ # @example
134
+ #
135
+ # driver.location = ::Appium::Location.new(10, 10, 10)
136
+ #
137
+
138
+ # @!method set_location
139
+ # Set the location of the device.
140
+ #
141
+ # @param [String, Number] latitude Set the latitude.
142
+ # @param [String, Number] longitude Set the longitude.
143
+ # @param [String, Number] altitude Set the altitude.
144
+ # @param [String, Number] speed Set the speed to apply the location on Android real devices
145
+ # in meters/second @since Appium 1.21.0 and in knots for emulators @since Appium 1.22.0.
146
+ # @param [String, Number] satellites Sets the count of geo satellites being tracked in range 1..12 @since Appium 1.22.0.
147
+ # This number is respected on Emulators.
148
+ # @param [::Appium::Location]
149
+ #
150
+ # @example
151
+ #
152
+ # driver.set_location 10, 10, 0
153
+ #
154
+
155
+ # @deprecated Use 'mobile: toggleGps' extension instead.
109
156
  # @!method toggle_location_services
110
157
  # Switch the state of the location service
111
158
  #
@@ -116,6 +163,7 @@ module Appium
116
163
  # @driver.toggle_location_services
117
164
  #
118
165
 
166
+ # @deprecated Use 'mobile: getConnectivity' extension instead.
119
167
  # @!method toggle_airplane_mode
120
168
  # Toggle flight mode on or off
121
169
  #
@@ -124,6 +172,7 @@ module Appium
124
172
  # @driver.toggle_airplane_mode
125
173
  #
126
174
 
175
+ # @deprecated Use 'mobile: hideKeyboard' extension instead.
127
176
  # @!method hide_keyboard(close_key = nil, strategy = nil)
128
177
  # Hide the onscreen keyboard
129
178
  # @param [String] close_key The name of the key which closes the keyboard.
@@ -139,12 +188,7 @@ module Appium
139
188
  # @driver.hide_keyboard(nil, :tapOutside) # Close a keyboard with tapping out side of keyboard
140
189
  #
141
190
 
142
- # @!method end_coverage(path, intent)
143
- # Android only; Ends the test coverage and writes the results to the given path on device.
144
- # @param [String] path Path on the device to write too.
145
- # @param [String] intent Intent to broadcast when ending coverage.
146
- #
147
-
191
+ # @deprecated Use 'mobile: startActivity' extension instead.
148
192
  # @!method start_activity(opts)
149
193
  # Android only. Start a new activity within the current app or launch a new app and start the target activity.
150
194
  #
@@ -169,6 +213,7 @@ module Appium
169
213
  # app_activity: '.accessibility.AccessibilityNodeProviderActivity'
170
214
  #
171
215
 
216
+ # @deprecated Use 'mobile: setConnectivity' extension instead.
172
217
  # @!method set_network_connection(mode)
173
218
  # Set the device network connection mode
174
219
  # Same as +#network_connection_type+ in selenium-webdriver.
@@ -191,6 +236,7 @@ module Appium
191
236
  # @driver.network_connection_type = :airplane_mode # As selenium-webdriver
192
237
  #
193
238
 
239
+ # @deprecated Use 'mobile: getPerformanceDataTypes' extension instead.
194
240
  # @!method get_performance_data_types
195
241
  # Get the information type of the system state which is supported to read such as
196
242
  # cpu, memory, network, battery via adb commands.
@@ -201,6 +247,7 @@ module Appium
201
247
  # @driver.get_performance_data_types #=> ["cpuinfo", "batteryinfo", "networkinfo", "memoryinfo"]
202
248
  #
203
249
 
250
+ # @deprecated Use 'mobile: getPerformanceData' extension instead.
204
251
  # @!method get_performance_data(package_name:, data_type:, data_read_timeout: 1000)
205
252
  # Get the resource usage information of the application.
206
253
  # https://github.com/appium/appium-base-driver/blob/be29aec2318316d12b5c3295e924a5ba8f09b0fb/lib/mjsonwp/routes.js#L303
@@ -280,6 +327,7 @@ module Appium
280
327
  # @driver.set_clipboard(content: 'happy testing') #=> {"protocol"=>"W3C"}
281
328
  #
282
329
 
330
+ # @deprecated Use 'mobile: fingerprint' extension instead.
283
331
  # @!method finger_print(finger_id)
284
332
  # Authenticate users by using their finger print scans on supported emulators.
285
333
  #
@@ -290,18 +338,22 @@ module Appium
290
338
  # @driver.finger_print 1
291
339
  #
292
340
 
293
- # @!method execute_cdp(cmd, params)
341
+ # @!method execute_cdp(cmd, **params)
294
342
  # Execute Chrome Devtools protocol commands
295
343
  # https://chromedevtools.github.io/devtools-protocol
296
344
  #
297
345
  # @param [String] cmd The name of command
298
- # @param [Hash] params The parameter for the command as hash.
346
+ # @option params The parameter for the command as keyword options.
299
347
  #
300
348
  # @example
301
349
  #
302
- # @driver.execute_cdp 'Page.captureScreenshot', { quality: 50, format: 'jpeg' }
350
+ # @driver.execute_cdp 'Page.captureScreenshot', quality: 50, format: 'jpeg'
303
351
  # @driver.execute_cdp 'Page.getResourceTree'
304
352
  #
353
+ # # for Ruby 2,7 and 3+ compatibility
354
+ # params = {'timezoneId': 'Asia/Tokyo'}
355
+ # driver.execute_cdp 'Emulation.setTimezoneOverride', **params
356
+ #
305
357
 
306
358
  ####
307
359
  ## class << self
@@ -315,51 +367,65 @@ module Appium
315
367
 
316
368
  ::Appium::Core::Device.add_endpoint_method(:open_notifications) do
317
369
  def open_notifications
370
+ ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: openNotifications' extension instead"
371
+
318
372
  execute :open_notifications
319
373
  end
320
374
  end
321
375
 
322
376
  ::Appium::Core::Device.add_endpoint_method(:current_activity) do
323
377
  def current_activity
378
+ ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getCurrentActivity' extension instead"
379
+
324
380
  execute :current_activity
325
381
  end
326
382
  end
327
383
 
328
384
  ::Appium::Core::Device.add_endpoint_method(:current_package) do
329
385
  def current_package
386
+ ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getCurrentPackage' extension instead"
387
+
330
388
  execute :current_package
331
389
  end
332
390
  end
333
391
 
334
392
  ::Appium::Core::Device.add_endpoint_method(:get_system_bars) do
335
393
  def get_system_bars
394
+ ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getSystemBars' extension instead"
395
+
336
396
  execute :get_system_bars
337
397
  end
338
398
  end
339
399
  # as alias to get_system_bars
340
400
  ::Appium::Core::Device.add_endpoint_method(:system_bars) do
341
401
  def system_bars
402
+ ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getSystemBars' extension instead"
403
+
342
404
  execute :get_system_bars
343
405
  end
344
406
  end
345
407
 
346
408
  ::Appium::Core::Device.add_endpoint_method(:toggle_location_services) do
347
409
  def toggle_location_services
410
+ ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: toggleGps' extension instead"
411
+
348
412
  execute :toggle_location_services
349
413
  end
350
414
  end
351
415
 
352
416
  ::Appium::Core::Device.add_endpoint_method(:start_activity) do
353
417
  def start_activity(opts)
354
- raise 'opts must be a hash' unless opts.is_a? Hash
418
+ ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: startActivity' extension instead"
419
+
420
+ raise ::Appium::Core::Error::ArgumentError, 'opts must be a hash' unless opts.is_a? Hash
355
421
 
356
422
  option = {}
357
423
 
358
424
  app_package = opts[:app_package]
359
- raise 'app_package is required' unless app_package
425
+ raise ::Appium::Core::Error::ArgumentError, 'app_package is required' unless app_package
360
426
 
361
427
  app_activity = opts[:app_activity]
362
- raise 'app_activity is required' unless app_activity
428
+ raise ::Appium::Core::Error::ArgumentError, 'app_activity is required' unless app_activity
363
429
 
364
430
  option[:appPackage] = app_package
365
431
  option[:appActivity] = app_activity
@@ -388,6 +454,8 @@ module Appium
388
454
  # Android, Override included method in bridge
389
455
  ::Appium::Core::Device.add_endpoint_method(:hide_keyboard) do
390
456
  def hide_keyboard(close_key = nil, strategy = nil)
457
+ ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: hideKeyboard' extension instead"
458
+
391
459
  option = {}
392
460
 
393
461
  option[:key] = close_key if close_key
@@ -400,14 +468,9 @@ module Appium
400
468
  # Android, Override included method in bridge
401
469
  ::Appium::Core::Device.add_endpoint_method(:background_app) do
402
470
  def background_app(duration = 0)
403
- execute :background_app, {}, seconds: duration
404
- end
405
- end
471
+ ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: backgroundApp' extension instead"
406
472
 
407
- # TODO: TEST ME
408
- ::Appium::Core::Device.add_endpoint_method(:end_coverage) do
409
- def end_coverage(path, intent)
410
- execute :end_coverage, {}, path: path, intent: intent
473
+ execute :background_app, {}, seconds: duration
411
474
  end
412
475
  end
413
476
 
@@ -415,7 +478,7 @@ module Appium
415
478
  # SeleniumWebdriver could already define this method
416
479
  return if method_defined? :execute_cdp
417
480
 
418
- def execute_cdp(cmd, params = {})
481
+ def execute_cdp(cmd, **params)
419
482
  execute :chrome_send_command, {}, { cmd: cmd, params: params }
420
483
  end
421
484
  end