appium_lib_core 11.1.1 → 12.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -1
- data/Gemfile +3 -3
- data/README.md +4 -4
- data/Rakefile +1 -5
- data/appium_lib_core.gemspec +0 -1
- data/lib/appium_lib_core/android/device/emulator.rb +4 -12
- data/lib/appium_lib_core/android/device/screen.rb +1 -3
- data/lib/appium_lib_core/android/device.rb +0 -4
- data/lib/appium_lib_core/common/base/bidi_bridge.rb +4 -0
- data/lib/appium_lib_core/common/base/bridge.rb +8 -2
- data/lib/appium_lib_core/common/base/driver.rb +10 -4
- data/lib/appium_lib_core/common/base/has_location.rb +1 -3
- data/lib/appium_lib_core/common/base/rotable.rb +1 -3
- data/lib/appium_lib_core/common/base/search_context.rb +0 -2
- data/lib/appium_lib_core/common/device/image_comparison.rb +3 -12
- data/lib/appium_lib_core/common/wait.rb +4 -0
- data/lib/appium_lib_core/common.rb +0 -1
- data/lib/appium_lib_core/driver.rb +21 -12
- data/lib/appium_lib_core/element.rb +8 -3
- data/lib/appium_lib_core/ios/xcuitest/device.rb +0 -5
- data/lib/appium_lib_core/mac2/device.rb +0 -5
- data/lib/appium_lib_core/version.rb +2 -2
- data/lib/appium_lib_core/windows/device.rb +0 -5
- data/lib/appium_lib_core.rb +2 -2
- data/rbs_collection.lock.yaml +63 -31
- data/sig/gems/forwardable.rbs +17 -0
- data/sig/gems/selenium/atoms.rbs +0 -1
- data/sig/gems/selenium/bidi/browsing_context.rbs +1 -1
- data/sig/gems/selenium/bridge.rbs +3 -0
- data/sig/gems/selenium/chromium/features.rbs +1 -1
- data/sig/gems/selenium/common/element.rbs +2 -0
- data/sig/gems/selenium/driver.rbs +10 -0
- data/sig/gems/selenium/fedcm.rbs +12 -0
- data/sig/gems/selenium/firefox/profile.rbs +0 -2
- data/sig/gems/selenium/log_entry.rbs +12 -0
- data/sig/gems/selenium/remote/capabilities.rbs +6 -0
- data/sig/interfaces/bridge.rbs +4 -0
- data/sig/lib/appium_lib_core/android/device/auth_finger_print.rbs +1 -1
- data/sig/lib/appium_lib_core/android/device/clipboard.rbs +1 -1
- data/sig/lib/appium_lib_core/android/device/emulator.rbs +2 -2
- data/sig/lib/appium_lib_core/android/device/performance.rbs +1 -1
- data/sig/lib/appium_lib_core/android/device/screen.rbs +2 -0
- data/sig/lib/appium_lib_core/android/device.rbs +20 -2
- data/sig/lib/appium_lib_core/android/uiautomator2/device/battery.rbs +2 -0
- data/sig/lib/appium_lib_core/android/uiautomator2/device.rbs +15 -0
- data/sig/lib/appium_lib_core/android.rbs +4 -0
- data/sig/lib/appium_lib_core/android_espresso.rbs +4 -0
- data/sig/lib/appium_lib_core/android_uiautomator2.rbs +4 -0
- data/sig/lib/appium_lib_core/common/base/bidi_bridge.rbs +4 -0
- data/sig/lib/appium_lib_core/common/base/bridge.rbs +3 -1
- data/sig/lib/appium_lib_core/common/base/capabilities.rbs +3 -0
- data/sig/lib/appium_lib_core/common/base/rotable.rbs +3 -0
- data/sig/lib/appium_lib_core/common/base/search_context.rbs +1 -1
- data/sig/lib/appium_lib_core/common/base.rbs +4 -0
- data/sig/lib/appium_lib_core/common/device/app_state.rbs +2 -2
- data/sig/lib/appium_lib_core/common/device/device.rbs +1 -1
- data/sig/lib/appium_lib_core/common/device/device_lock.rbs +2 -2
- data/sig/lib/appium_lib_core/common/device/keyboard.rbs +2 -2
- data/sig/lib/appium_lib_core/common/device/keyevent.rbs +1 -1
- data/sig/lib/appium_lib_core/common/device/screen_record.rbs +7 -3
- data/sig/lib/appium_lib_core/common.rbs +4 -0
- data/sig/lib/appium_lib_core/driver.rbs +19 -10
- data/sig/lib/appium_lib_core/element.rbs +5 -2
- data/sig/lib/appium_lib_core/ios/{clipboard.rbs → device/clipboard.rbs} +0 -4
- data/sig/lib/appium_lib_core/ios/xcuitest/device/battery.rbs +3 -1
- data/sig/lib/appium_lib_core/ios/xcuitest/device/performance.rbs +2 -0
- data/sig/lib/appium_lib_core/ios_xcuitest.rbs +4 -0
- data/sig/lib/appium_lib_core/mac2.rbs +4 -0
- data/sig/lib/appium_lib_core/windows.rbs +4 -0
- data/sig/lib/appium_lib_core.rbs +1 -1
- metadata +15 -27
- data/lib/appium_lib_core/common/ws/websocket.rb +0 -165
- data/sig/gems/faye.rbs +0 -10
- data/sig/lib/appium_lib_core/android/device/network.rbs +0 -13
- 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
|
-
|
|
6
|
+
include _Bridge
|
|
7
7
|
|
|
8
|
-
def hide_keyboard: (?untyped? close_key
|
|
8
|
+
def hide_keyboard: (?untyped? close_key) -> untyped
|
|
9
9
|
|
|
10
10
|
def is_keyboard_shown: () -> untyped
|
|
11
11
|
end
|
|
@@ -7,12 +7,16 @@ module Appium
|
|
|
7
7
|
|
|
8
8
|
attr_reader upload_option: untyped
|
|
9
9
|
|
|
10
|
-
METHOD: ::Array[
|
|
10
|
+
METHOD: ::Array[::String]
|
|
11
11
|
|
|
12
|
-
|
|
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
|
-
|
|
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
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
module Appium
|
|
2
|
-
|
|
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,
|
|
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:
|
|
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,
|
|
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,
|
|
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
|
|
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
|
-
|
|
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?: (
|
|
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
|
|
@@ -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: () ->
|
|
11
|
+
def battery_info: () -> ::Hash[::Symbol, ::Symbol]
|
|
10
12
|
end
|
|
11
13
|
end
|
|
12
14
|
end
|
data/sig/lib/appium_lib_core.rbs
CHANGED
metadata
CHANGED
|
@@ -1,35 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: appium_lib_core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 12.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-
|
|
11
|
+
date: 2025-12-28 00:00:00.000000000 Z
|
|
12
12
|
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
13
|
- !ruby/object:Gem::Dependency
|
|
34
14
|
name: selenium-webdriver
|
|
35
15
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -113,7 +93,6 @@ files:
|
|
|
113
93
|
- lib/appium_lib_core/common/logger.rb
|
|
114
94
|
- lib/appium_lib_core/common/wait.rb
|
|
115
95
|
- lib/appium_lib_core/common/wait/timer.rb
|
|
116
|
-
- lib/appium_lib_core/common/ws/websocket.rb
|
|
117
96
|
- lib/appium_lib_core/device.rb
|
|
118
97
|
- lib/appium_lib_core/driver.rb
|
|
119
98
|
- lib/appium_lib_core/element.rb
|
|
@@ -138,7 +117,7 @@ files:
|
|
|
138
117
|
- rbs_collection.lock.yaml
|
|
139
118
|
- rbs_collection.yaml
|
|
140
119
|
- sig/gems/em.rbs
|
|
141
|
-
- sig/gems/
|
|
120
|
+
- sig/gems/forwardable.rbs
|
|
142
121
|
- sig/gems/selenium/abstract_event_listener.rbs
|
|
143
122
|
- sig/gems/selenium/atoms.rbs
|
|
144
123
|
- sig/gems/selenium/bidi/browsing_context.rbs
|
|
@@ -154,6 +133,7 @@ files:
|
|
|
154
133
|
- sig/gems/selenium/edge/features.rbs
|
|
155
134
|
- sig/gems/selenium/error.rbs
|
|
156
135
|
- sig/gems/selenium/event_firing_bridge.rbs
|
|
136
|
+
- sig/gems/selenium/fedcm.rbs
|
|
157
137
|
- sig/gems/selenium/firefox/driver.rbs
|
|
158
138
|
- sig/gems/selenium/firefox/extension.rbs
|
|
159
139
|
- sig/gems/selenium/firefox/features.rbs
|
|
@@ -171,6 +151,7 @@ files:
|
|
|
171
151
|
- sig/gems/selenium/interfaces/driver.rbs
|
|
172
152
|
- sig/gems/selenium/interfaces/features.rbs
|
|
173
153
|
- sig/gems/selenium/local_driver.rbs
|
|
154
|
+
- sig/gems/selenium/log_entry.rbs
|
|
174
155
|
- sig/gems/selenium/platform.rbs
|
|
175
156
|
- sig/gems/selenium/profile_helper.rbs
|
|
176
157
|
- sig/gems/selenium/remote/bridge/commands.rbs
|
|
@@ -183,17 +164,22 @@ files:
|
|
|
183
164
|
- sig/gems/selenium/uploads_files.rbs
|
|
184
165
|
- sig/interfaces/bridge.rbs
|
|
185
166
|
- sig/lib/appium_lib_core.rbs
|
|
167
|
+
- sig/lib/appium_lib_core/android.rbs
|
|
186
168
|
- sig/lib/appium_lib_core/android/device.rbs
|
|
187
169
|
- sig/lib/appium_lib_core/android/device/auth_finger_print.rbs
|
|
188
170
|
- sig/lib/appium_lib_core/android/device/clipboard.rbs
|
|
189
171
|
- sig/lib/appium_lib_core/android/device/emulator.rbs
|
|
190
|
-
- sig/lib/appium_lib_core/android/device/network.rbs
|
|
191
172
|
- sig/lib/appium_lib_core/android/device/performance.rbs
|
|
192
173
|
- sig/lib/appium_lib_core/android/device/screen.rbs
|
|
193
174
|
- sig/lib/appium_lib_core/android/espresso/bridge.rbs
|
|
194
175
|
- sig/lib/appium_lib_core/android/uiautomator1/bridge.rbs
|
|
195
176
|
- sig/lib/appium_lib_core/android/uiautomator2/bridge.rbs
|
|
177
|
+
- sig/lib/appium_lib_core/android/uiautomator2/device.rbs
|
|
196
178
|
- sig/lib/appium_lib_core/android/uiautomator2/device/battery.rbs
|
|
179
|
+
- sig/lib/appium_lib_core/android_espresso.rbs
|
|
180
|
+
- sig/lib/appium_lib_core/android_uiautomator2.rbs
|
|
181
|
+
- sig/lib/appium_lib_core/common.rbs
|
|
182
|
+
- sig/lib/appium_lib_core/common/base.rbs
|
|
197
183
|
- sig/lib/appium_lib_core/common/base/bidi_bridge.rbs
|
|
198
184
|
- sig/lib/appium_lib_core/common/base/bridge.rbs
|
|
199
185
|
- sig/lib/appium_lib_core/common/base/capabilities.rbs
|
|
@@ -229,22 +215,24 @@ files:
|
|
|
229
215
|
- sig/lib/appium_lib_core/common/logger.rbs
|
|
230
216
|
- sig/lib/appium_lib_core/common/wait.rbs
|
|
231
217
|
- sig/lib/appium_lib_core/common/wait/timer.rbs
|
|
232
|
-
- sig/lib/appium_lib_core/common/ws/websocket.rbs
|
|
233
218
|
- sig/lib/appium_lib_core/device.rbs
|
|
234
219
|
- sig/lib/appium_lib_core/driver.rbs
|
|
235
220
|
- sig/lib/appium_lib_core/element.rbs
|
|
236
|
-
- sig/lib/appium_lib_core/ios/clipboard.rbs
|
|
237
221
|
- sig/lib/appium_lib_core/ios/device.rbs
|
|
222
|
+
- sig/lib/appium_lib_core/ios/device/clipboard.rbs
|
|
238
223
|
- sig/lib/appium_lib_core/ios/xcuitest/bridge.rbs
|
|
239
224
|
- sig/lib/appium_lib_core/ios/xcuitest/device.rbs
|
|
240
225
|
- sig/lib/appium_lib_core/ios/xcuitest/device/battery.rbs
|
|
241
226
|
- sig/lib/appium_lib_core/ios/xcuitest/device/performance.rbs
|
|
242
227
|
- sig/lib/appium_lib_core/ios/xcuitest/device/screen.rbs
|
|
228
|
+
- sig/lib/appium_lib_core/ios_xcuitest.rbs
|
|
229
|
+
- sig/lib/appium_lib_core/mac2.rbs
|
|
243
230
|
- sig/lib/appium_lib_core/mac2/bridge.rbs
|
|
244
231
|
- sig/lib/appium_lib_core/mac2/device.rbs
|
|
245
232
|
- sig/lib/appium_lib_core/mac2/device/screen.rbs
|
|
246
233
|
- sig/lib/appium_lib_core/support/event_firing_bridge.rbs
|
|
247
234
|
- sig/lib/appium_lib_core/version.rbs
|
|
235
|
+
- sig/lib/appium_lib_core/windows.rbs
|
|
248
236
|
- sig/lib/appium_lib_core/windows/bridge.rbs
|
|
249
237
|
- sig/lib/appium_lib_core/windows/device.rbs
|
|
250
238
|
- sig/lib/appium_lib_core/windows/device/screen.rbs
|
|
@@ -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,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
|