appium_lib_core 11.1.1 → 11.2.1

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 (76) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -1
  3. data/Gemfile +3 -3
  4. data/README.md +4 -4
  5. data/Rakefile +1 -5
  6. data/appium_lib_core.gemspec +0 -1
  7. data/lib/appium_lib_core/android/device/emulator.rb +4 -12
  8. data/lib/appium_lib_core/android/device/screen.rb +1 -3
  9. data/lib/appium_lib_core/android/device.rb +0 -4
  10. data/lib/appium_lib_core/common/base/bidi_bridge.rb +4 -0
  11. data/lib/appium_lib_core/common/base/bridge.rb +8 -2
  12. data/lib/appium_lib_core/common/base/driver.rb +10 -4
  13. data/lib/appium_lib_core/common/base/has_location.rb +1 -3
  14. data/lib/appium_lib_core/common/base/rotable.rb +1 -3
  15. data/lib/appium_lib_core/common/base/search_context.rb +0 -2
  16. data/lib/appium_lib_core/common/device/image_comparison.rb +3 -12
  17. data/lib/appium_lib_core/common/wait.rb +4 -0
  18. data/lib/appium_lib_core/common.rb +0 -1
  19. data/lib/appium_lib_core/driver.rb +21 -12
  20. data/lib/appium_lib_core/element.rb +8 -3
  21. data/lib/appium_lib_core/ios/xcuitest/device.rb +0 -5
  22. data/lib/appium_lib_core/mac2/device.rb +0 -5
  23. data/lib/appium_lib_core/version.rb +2 -2
  24. data/lib/appium_lib_core/windows/device.rb +0 -5
  25. data/lib/appium_lib_core.rb +2 -2
  26. data/rbs_collection.lock.yaml +63 -31
  27. data/sig/gems/forwardable.rbs +17 -0
  28. data/sig/gems/selenium/atoms.rbs +0 -1
  29. data/sig/gems/selenium/bidi/browsing_context.rbs +1 -1
  30. data/sig/gems/selenium/bridge.rbs +3 -0
  31. data/sig/gems/selenium/chromium/features.rbs +1 -1
  32. data/sig/gems/selenium/common/element.rbs +2 -0
  33. data/sig/gems/selenium/driver.rbs +10 -0
  34. data/sig/gems/selenium/fedcm.rbs +12 -0
  35. data/sig/gems/selenium/firefox/profile.rbs +0 -2
  36. data/sig/gems/selenium/log_entry.rbs +12 -0
  37. data/sig/gems/selenium/remote/capabilities.rbs +6 -0
  38. data/sig/interfaces/bridge.rbs +4 -0
  39. data/sig/lib/appium_lib_core/android/device/auth_finger_print.rbs +1 -1
  40. data/sig/lib/appium_lib_core/android/device/clipboard.rbs +1 -1
  41. data/sig/lib/appium_lib_core/android/device/emulator.rbs +2 -2
  42. data/sig/lib/appium_lib_core/android/device/performance.rbs +1 -1
  43. data/sig/lib/appium_lib_core/android/device/screen.rbs +2 -0
  44. data/sig/lib/appium_lib_core/android/device.rbs +20 -2
  45. data/sig/lib/appium_lib_core/android/uiautomator2/device/battery.rbs +2 -0
  46. data/sig/lib/appium_lib_core/android/uiautomator2/device.rbs +15 -0
  47. data/sig/lib/appium_lib_core/android.rbs +4 -0
  48. data/sig/lib/appium_lib_core/android_espresso.rbs +4 -0
  49. data/sig/lib/appium_lib_core/android_uiautomator2.rbs +4 -0
  50. data/sig/lib/appium_lib_core/common/base/bidi_bridge.rbs +4 -0
  51. data/sig/lib/appium_lib_core/common/base/bridge.rbs +3 -1
  52. data/sig/lib/appium_lib_core/common/base/capabilities.rbs +3 -0
  53. data/sig/lib/appium_lib_core/common/base/rotable.rbs +3 -0
  54. data/sig/lib/appium_lib_core/common/base/search_context.rbs +1 -1
  55. data/sig/lib/appium_lib_core/common/base.rbs +4 -0
  56. data/sig/lib/appium_lib_core/common/device/app_state.rbs +2 -2
  57. data/sig/lib/appium_lib_core/common/device/device.rbs +1 -1
  58. data/sig/lib/appium_lib_core/common/device/device_lock.rbs +2 -2
  59. data/sig/lib/appium_lib_core/common/device/keyboard.rbs +2 -2
  60. data/sig/lib/appium_lib_core/common/device/keyevent.rbs +1 -1
  61. data/sig/lib/appium_lib_core/common/device/screen_record.rbs +7 -3
  62. data/sig/lib/appium_lib_core/common.rbs +4 -0
  63. data/sig/lib/appium_lib_core/driver.rbs +19 -10
  64. data/sig/lib/appium_lib_core/element.rbs +5 -2
  65. data/sig/lib/appium_lib_core/ios/{clipboard.rbs → device/clipboard.rbs} +0 -4
  66. data/sig/lib/appium_lib_core/ios/xcuitest/device/battery.rbs +3 -1
  67. data/sig/lib/appium_lib_core/ios/xcuitest/device/performance.rbs +2 -0
  68. data/sig/lib/appium_lib_core/ios_xcuitest.rbs +4 -0
  69. data/sig/lib/appium_lib_core/mac2.rbs +4 -0
  70. data/sig/lib/appium_lib_core/windows.rbs +4 -0
  71. data/sig/lib/appium_lib_core.rbs +1 -1
  72. metadata +16 -31
  73. data/lib/appium_lib_core/common/ws/websocket.rb +0 -165
  74. data/sig/gems/faye.rbs +0 -10
  75. data/sig/lib/appium_lib_core/android/device/network.rbs +0 -13
  76. data/sig/lib/appium_lib_core/common/ws/websocket.rbs +0 -103
@@ -3,9 +3,9 @@ module Appium
3
3
  class Base
4
4
  module Device
5
5
  module Keyboard
6
- def execute: (Symbol command, ?Hash[untyped, untyped], ?Hash[untyped, untyped]) -> untyped
6
+ include _Bridge
7
7
 
8
- def hide_keyboard: (?untyped? close_key, ?untyped? strategy) -> untyped
8
+ def hide_keyboard: (?untyped? close_key) -> untyped
9
9
 
10
10
  def is_keyboard_shown: () -> untyped
11
11
  end
@@ -3,7 +3,7 @@ module Appium
3
3
  class Base
4
4
  module Device
5
5
  module KeyEvent
6
- def execute: (Symbol command, ?Hash[untyped, untyped], ?Hash[untyped, untyped]) -> untyped
6
+ include _Bridge
7
7
 
8
8
  def keyevent: (untyped key, ?untyped? metastate) -> untyped
9
9
 
@@ -7,12 +7,16 @@ module Appium
7
7
 
8
8
  attr_reader upload_option: untyped
9
9
 
10
- METHOD: ::Array["POST" | "PUT"]
10
+ METHOD: ::Array[::String]
11
11
 
12
- def initialize: (?remote_path: untyped?, ?user: untyped?, ?pass: untyped?, ?method: ::String, ?file_field_name: untyped?, ?form_fields: untyped?, ?headers: untyped?, ?force_restart: untyped?) -> void
12
+ type upload_method = "POST" | "PUT" | "post" | "put"
13
+
14
+ def initialize: (?remote_path: untyped?, ?user: untyped?, ?pass: untyped?, ?method: upload_method, ?file_field_name: untyped?, ?form_fields: untyped?, ?headers: untyped?, ?force_restart: untyped?) -> void
13
15
 
14
16
  module Command
15
- def stop_recording_screen: (?remote_path: untyped?, ?user: untyped?, ?pass: untyped?, ?method: ::String, ?file_field_name: untyped?, ?form_fields: untyped?, ?headers: untyped?) -> untyped
17
+ include _Bridge
18
+
19
+ def stop_recording_screen: (?remote_path: untyped?, ?user: untyped?, ?pass: untyped?, ?method: upload_method, ?file_field_name: untyped?, ?form_fields: untyped?, ?headers: untyped?) -> untyped
16
20
 
17
21
  def stop_and_save_recording_screen: (untyped file_path) -> untyped
18
22
  end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file only contains require statements and does not define any classes or modules.
4
+ # No type signatures needed.
@@ -1,5 +1,14 @@
1
1
  module Appium
2
- Location: Class
2
+ # Struct for device location
3
+ class Location
4
+ attr_accessor latitude: Float | Integer | String
5
+
6
+ attr_accessor longitude: Float | Integer | String
7
+
8
+ attr_accessor altitude: Float | Integer | String
9
+
10
+ def initialize: (Float | Integer | String latitude, Float | Integer | String longitude, Float | Integer | String altitude) -> void
11
+ end
3
12
 
4
13
  module Core
5
14
  module Android
@@ -41,7 +50,7 @@ module Appium
41
50
 
42
51
  attr_reader enable_idempotency_header: bool
43
52
 
44
- def initialize: (Hash[Symbol, String] appium_lib_opts) -> void
53
+ def initialize: (Hash[Symbol, untyped] appium_lib_opts) -> void
45
54
 
46
55
  private
47
56
 
@@ -79,7 +88,7 @@ module Appium
79
88
 
80
89
  @custom_url: String
81
90
 
82
- @caps: Hash[Symbol | String, Symbol | String | Integer]
91
+ @caps: Core::Base::Capabilities
83
92
 
84
93
  @http_client: Core::Base::Http::Default
85
94
 
@@ -172,25 +181,25 @@ module Appium
172
181
 
173
182
  extend Core::Device
174
183
 
175
- def get_caps: (Hash[Symbol, Symbol | String | Hash[Symbol, String | Numeric] | Numeric]? opts)
176
- -> Core::Base::Capabilities
184
+ def get_caps: (Hash[Symbol, untyped]? opts) -> Core::Base::Capabilities
177
185
 
178
- def get_appium_lib_opts: (Hash[Symbol, Symbol | String | Hash[Symbol, String | Numeric] | Numeric]? opts)
179
- -> (Symbol | String | Hash[Symbol, String | Numeric] | Numeric)
186
+ def get_appium_lib_opts: (Hash[Symbol, untyped]? opts) -> Hash[Symbol, untyped]
180
187
 
181
188
  def get_app: () -> String?
182
189
 
183
190
  def set_app_path: () -> String?
184
191
 
185
192
  def set_appium_lib_specific_values: (
186
- Hash[Symbol, String] appium_lib_opts
193
+ Hash[Symbol, String | Numeric] appium_lib_opts
187
194
  ) -> bool
188
195
 
189
- def set_appium_device: () -> Symbol
196
+ def set_appium_device: () -> Symbol?
190
197
 
191
198
  def set_automation_name: () -> Symbol?
192
199
 
193
- def convert_downcase: (Symbol value) -> Symbol
200
+ def get_cap: (String | Symbol name) -> untyped
201
+
202
+ def convert_downcase: (String | Symbol value) -> Symbol
194
203
  end
195
204
  end
196
205
  end
@@ -1,13 +1,16 @@
1
1
  module Appium
2
2
  module Core
3
+ # Element class inheriting from Selenium::WebDriver::Element
3
4
  class Element < ::Selenium::WebDriver::Element
4
5
  include ::Appium::Core::Base::TakesScreenshot
5
6
 
6
- attr_reader id: untyped
7
+ def initialize: (untyped bridge, untyped id) -> void
8
+
9
+ attr_reader id: Array[untyped]
7
10
 
8
11
  def method_missing: (untyped method_name, *untyped args) { (?) -> untyped } -> (nil | untyped)
9
12
 
10
- def respond_to_missing?: (*untyped) -> true
13
+ def respond_to_missing?: (untyped _method_name, bool _include_private) -> true
11
14
 
12
15
  # Alias for type
13
16
  alias type send_keys
@@ -5,11 +5,7 @@ module Appium
5
5
  module Clipboard
6
6
  include _Bridge
7
7
 
8
- def execute: (Symbol command, ?Hash[untyped, untyped], ?Hash[untyped, untyped]) -> untyped
9
-
10
8
  def self.add_methods: () -> untyped
11
-
12
- def self.touch_id: -> untyped
13
9
  end
14
10
  end
15
11
  end
@@ -4,9 +4,11 @@ module Appium
4
4
  module Xcuitest
5
5
  module Device
6
6
  module Battery
7
+ include _Bridge
8
+
7
9
  def self.add_methods: () -> (Symbol | Hash[Symbol, Proc])?
8
10
 
9
- def battery_info: () -> (Symbol | Hash[Symbol, Proc])?
11
+ def battery_info: () -> ::Hash[::Symbol, ::Symbol]
10
12
  end
11
13
  end
12
14
  end
@@ -4,6 +4,8 @@ module Appium
4
4
  module Xcuitest
5
5
  module Device
6
6
  module Performance
7
+ include _Bridge
8
+
7
9
  def self.add_methods: () -> untyped
8
10
  end
9
11
  end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file only contains require statements and does not define any classes or modules.
4
+ # No type signatures needed.
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file only contains require statements and does not define any classes or modules.
4
+ # No type signatures needed.
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file only contains require statements and does not define any classes or modules.
4
+ # No type signatures needed.
@@ -3,6 +3,6 @@ module Appium
3
3
  -> Hash[Symbol, untyped]
4
4
 
5
5
  module Core
6
- def self.for: (*untyped args) -> Driver
6
+ def self.for: (Hash[Symbol, untyped] opts) -> Driver
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,35 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appium_lib_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.1.1
4
+ version: 11.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuaki MATSUO
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-08-08 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: faye-websocket
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0.11'
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '0.13'
23
- type: :runtime
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: '0.11'
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '0.13'
33
12
  - !ruby/object:Gem::Dependency
34
13
  name: selenium-webdriver
35
14
  requirement: !ruby/object:Gem::Requirement
@@ -113,7 +92,6 @@ files:
113
92
  - lib/appium_lib_core/common/logger.rb
114
93
  - lib/appium_lib_core/common/wait.rb
115
94
  - lib/appium_lib_core/common/wait/timer.rb
116
- - lib/appium_lib_core/common/ws/websocket.rb
117
95
  - lib/appium_lib_core/device.rb
118
96
  - lib/appium_lib_core/driver.rb
119
97
  - lib/appium_lib_core/element.rb
@@ -138,7 +116,7 @@ files:
138
116
  - rbs_collection.lock.yaml
139
117
  - rbs_collection.yaml
140
118
  - sig/gems/em.rbs
141
- - sig/gems/faye.rbs
119
+ - sig/gems/forwardable.rbs
142
120
  - sig/gems/selenium/abstract_event_listener.rbs
143
121
  - sig/gems/selenium/atoms.rbs
144
122
  - sig/gems/selenium/bidi/browsing_context.rbs
@@ -154,6 +132,7 @@ files:
154
132
  - sig/gems/selenium/edge/features.rbs
155
133
  - sig/gems/selenium/error.rbs
156
134
  - sig/gems/selenium/event_firing_bridge.rbs
135
+ - sig/gems/selenium/fedcm.rbs
157
136
  - sig/gems/selenium/firefox/driver.rbs
158
137
  - sig/gems/selenium/firefox/extension.rbs
159
138
  - sig/gems/selenium/firefox/features.rbs
@@ -171,6 +150,7 @@ files:
171
150
  - sig/gems/selenium/interfaces/driver.rbs
172
151
  - sig/gems/selenium/interfaces/features.rbs
173
152
  - sig/gems/selenium/local_driver.rbs
153
+ - sig/gems/selenium/log_entry.rbs
174
154
  - sig/gems/selenium/platform.rbs
175
155
  - sig/gems/selenium/profile_helper.rbs
176
156
  - sig/gems/selenium/remote/bridge/commands.rbs
@@ -183,17 +163,22 @@ files:
183
163
  - sig/gems/selenium/uploads_files.rbs
184
164
  - sig/interfaces/bridge.rbs
185
165
  - sig/lib/appium_lib_core.rbs
166
+ - sig/lib/appium_lib_core/android.rbs
186
167
  - sig/lib/appium_lib_core/android/device.rbs
187
168
  - sig/lib/appium_lib_core/android/device/auth_finger_print.rbs
188
169
  - sig/lib/appium_lib_core/android/device/clipboard.rbs
189
170
  - sig/lib/appium_lib_core/android/device/emulator.rbs
190
- - sig/lib/appium_lib_core/android/device/network.rbs
191
171
  - sig/lib/appium_lib_core/android/device/performance.rbs
192
172
  - sig/lib/appium_lib_core/android/device/screen.rbs
193
173
  - sig/lib/appium_lib_core/android/espresso/bridge.rbs
194
174
  - sig/lib/appium_lib_core/android/uiautomator1/bridge.rbs
195
175
  - sig/lib/appium_lib_core/android/uiautomator2/bridge.rbs
176
+ - sig/lib/appium_lib_core/android/uiautomator2/device.rbs
196
177
  - sig/lib/appium_lib_core/android/uiautomator2/device/battery.rbs
178
+ - sig/lib/appium_lib_core/android_espresso.rbs
179
+ - sig/lib/appium_lib_core/android_uiautomator2.rbs
180
+ - sig/lib/appium_lib_core/common.rbs
181
+ - sig/lib/appium_lib_core/common/base.rbs
197
182
  - sig/lib/appium_lib_core/common/base/bidi_bridge.rbs
198
183
  - sig/lib/appium_lib_core/common/base/bridge.rbs
199
184
  - sig/lib/appium_lib_core/common/base/capabilities.rbs
@@ -229,22 +214,24 @@ files:
229
214
  - sig/lib/appium_lib_core/common/logger.rbs
230
215
  - sig/lib/appium_lib_core/common/wait.rbs
231
216
  - sig/lib/appium_lib_core/common/wait/timer.rbs
232
- - sig/lib/appium_lib_core/common/ws/websocket.rbs
233
217
  - sig/lib/appium_lib_core/device.rbs
234
218
  - sig/lib/appium_lib_core/driver.rbs
235
219
  - sig/lib/appium_lib_core/element.rbs
236
- - sig/lib/appium_lib_core/ios/clipboard.rbs
237
220
  - sig/lib/appium_lib_core/ios/device.rbs
221
+ - sig/lib/appium_lib_core/ios/device/clipboard.rbs
238
222
  - sig/lib/appium_lib_core/ios/xcuitest/bridge.rbs
239
223
  - sig/lib/appium_lib_core/ios/xcuitest/device.rbs
240
224
  - sig/lib/appium_lib_core/ios/xcuitest/device/battery.rbs
241
225
  - sig/lib/appium_lib_core/ios/xcuitest/device/performance.rbs
242
226
  - sig/lib/appium_lib_core/ios/xcuitest/device/screen.rbs
227
+ - sig/lib/appium_lib_core/ios_xcuitest.rbs
228
+ - sig/lib/appium_lib_core/mac2.rbs
243
229
  - sig/lib/appium_lib_core/mac2/bridge.rbs
244
230
  - sig/lib/appium_lib_core/mac2/device.rbs
245
231
  - sig/lib/appium_lib_core/mac2/device/screen.rbs
246
232
  - sig/lib/appium_lib_core/support/event_firing_bridge.rbs
247
233
  - sig/lib/appium_lib_core/version.rbs
234
+ - sig/lib/appium_lib_core/windows.rbs
248
235
  - sig/lib/appium_lib_core/windows/bridge.rbs
249
236
  - sig/lib/appium_lib_core/windows/device.rbs
250
237
  - sig/lib/appium_lib_core/windows/device/screen.rbs
@@ -253,7 +240,6 @@ licenses:
253
240
  - Apache-2.0
254
241
  metadata:
255
242
  rubygems_mfa_required: 'true'
256
- post_install_message:
257
243
  rdoc_options: []
258
244
  require_paths:
259
245
  - lib
@@ -268,8 +254,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
268
254
  - !ruby/object:Gem::Version
269
255
  version: '0'
270
256
  requirements: []
271
- rubygems_version: 3.5.9
272
- signing_key:
257
+ rubygems_version: 4.0.3
273
258
  specification_version: 4
274
259
  summary: Minimal Ruby library for Appium.
275
260
  test_files: []
@@ -1,165 +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
- require 'faye/websocket'
16
- require 'eventmachine'
17
-
18
- module Appium
19
- module Core
20
- class WebSocket
21
- attr_reader :client, :endpoint
22
-
23
- # A websocket client based on Faye::WebSocket::Client .
24
- # Uses eventmachine to wait response from the peer. The eventmachine works on a thread. The thread will exit
25
- # with close method.
26
- #
27
- # @param [String] url URL to establish web socket connection. If the URL has no port, the client use:
28
- # +ws+: 80, +wss+: 443 ports.
29
- # @param [Array] protocols An array of strings representing acceptable subprotocols for use over the socket.
30
- # The driver will negotiate one of these to use via the Sec-WebSocket-Protocol header
31
- # if supported by the other peer. Default is nil.
32
- # The protocols is equal to https://github.com/faye/faye-websocket-ruby/ 's one for client.
33
- # @param [Hash] options Initialize options for Faye client. Read https://github.com/faye/faye-websocket-ruby#initialization-options
34
- # for more details. Default is +{}+.
35
- #
36
- # @example
37
- # ws = WebSocket.new(url: "ws://#{host}:#{port}/ws/session/#{@session_id}/appium/device/logcat")
38
- # ws.client #=> #<Faye::WebSocket::Client:.....> # An instance of Faye::WebSocket::Client
39
- # ws.message 'some message' #=> nil. Send a message to the peer.
40
- # ws.close #=> Kill the thread which run a eventmachine.
41
- #
42
- def initialize(url:, protocols: nil, options: {})
43
- @endpoint = url
44
-
45
- @ws_thread = Thread.new do
46
- EM.run do
47
- @client ||= ::Faye::WebSocket::Client.new(url, protocols, options)
48
-
49
- @client.on :open do |_open|
50
- handle_open
51
- end
52
-
53
- @client.on :message do |message|
54
- handle_message_data(message.data)
55
- end
56
-
57
- @client.on :error do |_error|
58
- handle_error
59
- end
60
-
61
- @client.on :close do |close|
62
- handle_close(close.code, close.reason)
63
- end
64
- end
65
- end
66
- end
67
-
68
- # Client
69
-
70
- #
71
- # Sends a ping frame with an optional message and fires the callback when a matching pong is received.
72
- #
73
- # @param [String] message A message to send ping.
74
- # @param [Block] callback
75
- #
76
- # @example
77
- # ws = WebSocket.new(url: "ws://#{host}:#{port}/ws/session/#{@session_id}/appium/device/logcat")
78
- # ws.ping 'message'
79
- #
80
- def ping(message, &callback)
81
- @client.ping message, &callback
82
- end
83
-
84
- # Accepts either a String or an Array of byte-sized integers and sends a text or binary message over the connection
85
- # to the other peer; binary data must be encoded as an Array.
86
- #
87
- # @param [String, Array] message A message to send a text or binary message over the connection
88
- #
89
- # @example
90
- # ws = WebSocket.new(url: "ws://#{host}:#{port}/ws/session/#{@session_id}/appium/device/logcat")
91
- # ws.send 'happy testing'
92
- #
93
- def send(message)
94
- @client.send message
95
- end
96
-
97
- # Closes the connection, sending the given status code and reason text, both of which are optional.
98
- #
99
- # @param [Integer] code A status code to send to the peer with close signal. Default is nil.
100
- # @param [String] reason A reason to send to the peer with close signal. Default is 'close from ruby_lib_core'.
101
- #
102
- # @example
103
- # ws = WebSocket.new(url: "ws://#{host}:#{port}/ws/session/#{@session_id}/appium/device/logcat")
104
- # ws.close reason: 'a something special reason'
105
- #
106
- def close(code: nil, reason: 'close from ruby_lib_core')
107
- if @client.nil?
108
- ::Appium::Logger.warn 'Websocket was closed'
109
- else
110
- @client.close code, reason
111
- end
112
- @ws_thread.exit
113
- end
114
-
115
- # Response from server
116
-
117
- #
118
- # Fires when the socket connection is established. Event has no attributes.
119
- #
120
- # Default is just put a debug message.
121
- #
122
- def handle_open
123
- ::Appium::Logger.debug %W(#{self.class} :open)
124
- end
125
-
126
- # Standard out by default
127
- # In general, users should customise only message_data
128
-
129
- #
130
- # Fires when the socket receives a message. The message gas one +data+ attribute and this method can handle the data.
131
- # The data is either a String (for text frames) or an Array of byte-sized integers (for binary frames).
132
- #
133
- # Default is just put a debug message and puts the result on standard out.
134
- # In general, users should override this handler to handle messages from the peer.
135
- #
136
- def handle_message_data(data)
137
- ::Appium::Logger.debug %W(#{self.class} :message #{data})
138
- $stdout << "#{data}\n"
139
- end
140
-
141
- #
142
- # Fires when there is a protocol error due to bad data sent by the other peer.
143
- # This event is purely informational, you do not need to implement error recovery.
144
- #
145
- # Default is just put a error message.
146
- #
147
- def handle_error
148
- ::Appium::Logger.error %W(#{self.class} :error)
149
- end
150
-
151
- #
152
- # Fires when either the client or the server closes the connection. The method gets +code+ and +reason+ attributes.
153
- # They expose the status code and message sent by the peer that closed the connection.
154
- #
155
- # Default is just put a error message.
156
- # The methods also clear +client+ instance and stop the eventmachine which is called in initialising this class.
157
- #
158
- def handle_close(code, reason)
159
- ::Appium::Logger.debug %W(#{self.class} :close #{code} #{reason})
160
- @client = nil
161
- EM.stop
162
- end
163
- end # module WebSocket
164
- end # module Core
165
- end # module Appium
data/sig/gems/faye.rbs DELETED
@@ -1,10 +0,0 @@
1
- module Faye
2
- module WebSocket
3
- class Client
4
- def initialize: (String, String, Hash[Symbol, untyped]) -> void
5
- def close: () -> void
6
- def send: (String) -> void
7
- def on: (String, Proc) -> void
8
- end
9
- end
10
- end
@@ -1,13 +0,0 @@
1
- module Appium
2
- module Core
3
- module Android
4
- module Device
5
- module Network
6
- def execute: (Symbol command, ?Hash[untyped, untyped], ?Hash[untyped, untyped]) -> untyped
7
-
8
- def self.add_methods: () -> untyped
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -1,103 +0,0 @@
1
- module Appium
2
- module Core
3
- class WebSocket
4
- @endpoint: untyped
5
-
6
- @ws_thread: untyped
7
-
8
- @client: untyped
9
-
10
- attr_reader client: untyped
11
-
12
- attr_reader endpoint: untyped
13
-
14
- # A websocket client based on Faye::WebSocket::Client .
15
- # Uses eventmachine to wait response from the peer. The eventmachine works on a thread. The thread will exit
16
- # with close method.
17
- #
18
- # @param [String] url URL to establish web socket connection. If the URL has no port, the client use:
19
- # +ws+: 80, +wss+: 443 ports.
20
- # @param [Array] protocols An array of strings representing acceptable subprotocols for use over the socket.
21
- # The driver will negotiate one of these to use via the Sec-WebSocket-Protocol header
22
- # if supported by the other peer. Default is nil.
23
- # The protocols is equal to https://github.com/faye/faye-websocket-ruby/ 's one for client.
24
- # @param [Hash] options Initialize options for Faye client. Read https://github.com/faye/faye-websocket-ruby#initialization-options
25
- # for more details. Default is +{}+.
26
- #
27
- # @example
28
- # ws = WebSocket.new(url: "ws://#{host}:#{port}/ws/session/#{@session_id}/appium/device/logcat")
29
- # ws.client #=> #<Faye::WebSocket::Client:.....> # An instance of Faye::WebSocket::Client
30
- # ws.message 'some message' #=> nil. Send a message to the peer.
31
- # ws.close #=> Kill the thread which run a eventmachine.
32
- #
33
- def initialize: (url: untyped, ?protocols: untyped?, ?options: ::Hash[untyped, untyped]) -> void
34
-
35
- #
36
- # Sends a ping frame with an optional message and fires the callback when a matching pong is received.
37
- #
38
- # @param [String] message A message to send ping.
39
- # @param [Block] callback
40
- #
41
- # @example
42
- # ws = WebSocket.new(url: "ws://#{host}:#{port}/ws/session/#{@session_id}/appium/device/logcat")
43
- # ws.ping 'message'
44
- #
45
- def ping: (untyped message) { (?) -> untyped } -> untyped
46
-
47
- # Accepts either a String or an Array of byte-sized integers and sends a text or binary message over the connection
48
- # to the other peer; binary data must be encoded as an Array.
49
- #
50
- # @param [String|Array] message A message to send a text or binary message over the connection
51
- #
52
- # @example
53
- # ws = WebSocket.new(url: "ws://#{host}:#{port}/ws/session/#{@session_id}/appium/device/logcat")
54
- # ws.send 'happy testing'
55
- #
56
- def send: (untyped message) -> untyped
57
-
58
- # Closes the connection, sending the given status code and reason text, both of which are optional.
59
- #
60
- # @param [Integer] code A status code to send to the peer with close signal. Default is nil.
61
- # @param [String] reason A reason to send to the peer with close signal. Default is 'close from ruby_lib_core'.
62
- #
63
- # @example
64
- # ws = WebSocket.new(url: "ws://#{host}:#{port}/ws/session/#{@session_id}/appium/device/logcat")
65
- # ws.close reason: 'a something special reason'
66
- #
67
- def close: (?code: untyped?, ?reason: ::String) -> untyped
68
-
69
- #
70
- # Fires when the socket connection is established. Event has no attributes.
71
- #
72
- # Default is just put a debug message.
73
- #
74
- def handle_open: () -> untyped
75
-
76
- #
77
- # Fires when the socket receives a message. The message gas one +data+ attribute and this method can handle the data.
78
- # The data is either a String (for text frames) or an Array of byte-sized integers (for binary frames).
79
- #
80
- # Default is just put a debug message and puts the result on standard out.
81
- # In general, users should override this handler to handle messages from the peer.
82
- #
83
- def handle_message_data: (untyped data) -> untyped
84
-
85
- #
86
- # Fires when there is a protocol error due to bad data sent by the other peer.
87
- # This event is purely informational, you do not need to implement error recovery.
88
- #
89
- # Default is just put a error message.
90
- #
91
- def handle_error: () -> untyped
92
-
93
- #
94
- # Fires when either the client or the server closes the connection. The method gets +code+ and +reason+ attributes.
95
- # They expose the status code and message sent by the peer that closed the connection.
96
- #
97
- # Default is just put a error message.
98
- # The methods also clear +client+ instance and stop the eventmachine which is called in initialising this class.
99
- #
100
- def handle_close: (untyped code, untyped reason) -> untyped
101
- end
102
- end
103
- end