appium_lib_core 5.0.0.beta1 → 5.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd462f64262abe99f03dd5a421f2a2dd9c8064f1d44eff47bc1872a834793d27
4
- data.tar.gz: 1a1ca492c3551d8c992e9f2b740460e67239887400602351423062e49912b73f
3
+ metadata.gz: 53abadd3b91fdcaac0c23f62bbc83b0e21ea08a50da28394a504d6839d36d2e7
4
+ data.tar.gz: 9bc2cda2b1fa8be1d602cd7ab9943594f9b4a1fce0ea5a4527491563c3687fd2
5
5
  SHA512:
6
- metadata.gz: d9e4977dfb93ce734c59af5053a6331bfc2038bd3a03757a31fd7e48c3cdcc810204fb6f3027a1120afe91eda31ad61aa504fa25fdf2a2a21d36638c27982f8e
7
- data.tar.gz: 3e23c561984a3ad4bf4214aad79fc730f8673d0bc29c81d26ff5143c0dbeb38d6eacc9278ba0caa11e4dfc51f82267f79b97efe6937ad8315c837e64876df162
6
+ metadata.gz: 313ae53035edd0273b8d122325c77d031a186c5a9f60b57956ad0f204165cc8ca60420ce2a910dc28d9e0b5000fa9131262fbe4a2b796e4e4d7bd09d9e40e941
7
+ data.tar.gz: deb1d0d9c9aba7cc7a9b6040dbdbcf76896d5a0ce786a8ac419b436a11a90e1960893e2f6683a78efee7d3a8044d5eb19414d527123778cebd088a437b6a4215
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency 'minitest', '~> 5.0'
32
32
  spec.add_development_dependency 'minitest-reporters', '~> 1.1'
33
33
  spec.add_development_dependency 'webmock', '~> 3.12.1'
34
- spec.add_development_dependency 'rubocop', '1.11.0'
34
+ spec.add_development_dependency 'rubocop', '1.12.0'
35
35
  spec.add_development_dependency 'appium_thor', '~> 1.0'
36
36
  spec.add_development_dependency 'pry'
37
37
  spec.add_development_dependency 'pry-byebug'
@@ -17,11 +17,8 @@ require 'selenium-webdriver'
17
17
  require_relative 'appium_lib_core/version'
18
18
  require_relative 'appium_lib_core/common'
19
19
  require_relative 'appium_lib_core/driver'
20
-
21
20
  require_relative 'appium_lib_core/device'
22
-
23
- # Call patch after requiring other files
24
- require_relative 'appium_lib_core/patch'
21
+ require_relative 'appium_lib_core/element'
25
22
 
26
23
  module Appium
27
24
  # convert all keys (including nested) to symbols
@@ -34,9 +34,7 @@ require_relative 'device/orientation'
34
34
  # The following files have selenium-webdriver related stuff.
35
35
  require_relative 'base/driver'
36
36
  require_relative 'base/bridge'
37
- require_relative 'base/bridge/w3c'
38
37
  require_relative 'base/capabilities'
39
38
  require_relative 'base/http_default'
40
39
  require_relative 'base/search_context'
41
- require_relative 'base/command'
42
40
  require_relative 'base/platform'
@@ -16,11 +16,36 @@ module Appium
16
16
  module Core
17
17
  class Base
18
18
  class Bridge < ::Selenium::WebDriver::Remote::Bridge
19
- # TODO: Move W3C module to here
19
+ include Device::DeviceLock
20
+ include Device::Keyboard
21
+ include Device::ImeActions
22
+ include Device::Setting
23
+ include Device::Context
24
+ include Device::Value
25
+ include Device::FileManagement
26
+ include Device::KeyEvent
27
+ include Device::ImageComparison
28
+ include Device::AppManagement
29
+ include Device::AppState
30
+ include Device::ScreenRecord::Command
31
+ include Device::Device
32
+ include Device::TouchActions
33
+ include Device::ExecuteDriver
34
+ include Device::Orientation
20
35
 
21
36
  # Prefix for extra capability defined by W3C
22
37
  APPIUM_PREFIX = 'appium:'
23
38
 
39
+ # Returns 'unknown' if no specific browser name
40
+ def browser
41
+ @browser ||= begin
42
+ name = @capabilities.browser_name
43
+ name ? name.tr(' ', '_').downcase.to_sym : 'unknown'
44
+ rescue KeyError
45
+ 'unknown'
46
+ end
47
+ end
48
+
24
49
  # Override
25
50
  # Creates session handling both OSS and W3C dialects.
26
51
  #
@@ -99,6 +124,241 @@ module Appium
99
124
  def json_create(value)
100
125
  ::Selenium::WebDriver::Remote::Capabilities.json_create(value)
101
126
  end
127
+
128
+ public
129
+
130
+ def commands(command)
131
+ ::Appium::Core::Commands::COMMANDS[command]
132
+ end
133
+
134
+ # Returns all available sessions on the Appium server instance
135
+ def sessions
136
+ execute :get_all_sessions
137
+ end
138
+
139
+ def status
140
+ execute :status
141
+ end
142
+
143
+ # Perform touch actions for W3C module.
144
+ # Generate +touch+ pointer action here and users can use this via +driver.action+
145
+ # - https://seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/W3CActionBuilder.html
146
+ # - https://seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/PointerActions.html
147
+ # - https://seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/KeyActions.html
148
+ #
149
+ # 'mouse' action is by default in the Ruby client. Appium server force the +mouse+ action to +touch+ once in
150
+ # the server side. So we don't consider the case.
151
+ #
152
+ # @example
153
+ #
154
+ # element = @driver.find_element(:id, "some id")
155
+ # @driver.action.click(element).perform # The 'click' is a part of 'PointerActions'
156
+ #
157
+ def action(async = false)
158
+ # Used for default duration of each touch actions
159
+ # Override from 250 milliseconds to 50 milliseconds
160
+ action_builder = super
161
+ action_builder.default_move_duration = 0.05
162
+ action_builder
163
+ end
164
+
165
+ # Port from MJSONWP
166
+ def get_timeouts
167
+ execute :get_timeouts
168
+ end
169
+
170
+ # Port from MJSONWP
171
+ def session_capabilities
172
+ ::Selenium::WebDriver::Remote::Capabilities.json_create execute(:get_capabilities)
173
+ end
174
+
175
+ # Port from MJSONWP
176
+ def send_keys_to_active_element(key)
177
+ text = ::Selenium::WebDriver::Keys.encode(key).join('')
178
+ execute :send_keys_to_active_element, {}, { value: text.split(//) }
179
+ end
180
+
181
+ # For Appium
182
+ # override
183
+ def page_source
184
+ # For W3C
185
+ # execute_script('var source = document.documentElement.outerHTML;' \
186
+ # 'if (!source) { source = new XMLSerializer().serializeToString(document); }' \
187
+ # 'return source;')
188
+ execute :get_page_source
189
+ end
190
+
191
+ # For Appium
192
+ # override
193
+ def element_displayed?(element)
194
+ # For W3C
195
+ # https://github.com/SeleniumHQ/selenium/commit/b618499adcc3a9f667590652c5757c0caa703289
196
+ # execute_atom :isDisplayed, element
197
+ execute :is_element_displayed, id: element.ref
198
+ end
199
+
200
+ # For Appium
201
+ # override
202
+ def element_attribute(element, name)
203
+ # For W3C in Selenium Client
204
+ # execute_atom :getAttribute, element, name
205
+ execute :get_element_attribute, id: element.ref, name: name
206
+ end
207
+
208
+ # For Appium
209
+ # override
210
+ def active_element
211
+ ::Appium::Core::Element.new self, element_id_from(execute(:get_active_element))
212
+ end
213
+ alias switch_to_active_element active_element
214
+
215
+ # For Appium
216
+ # override
217
+ def find_element_by(how, what, parent = nil)
218
+ how, what = convert_locators(how, what)
219
+
220
+ id = if parent
221
+ execute :find_child_element, { id: parent }, { using: how, value: what }
222
+ else
223
+ execute :find_element, {}, { using: how, value: what }
224
+ end
225
+ ::Appium::Core::Element.new self, element_id_from(id)
226
+ end
227
+
228
+ # For Appium
229
+ # override
230
+ def find_elements_by(how, what, parent = nil)
231
+ how, what = convert_locators(how, what)
232
+
233
+ ids = if parent
234
+ execute :find_child_elements, { id: parent }, { using: how, value: what }
235
+ else
236
+ execute :find_elements, {}, { using: how, value: what }
237
+ end
238
+
239
+ ids.map { |id| ::Appium::Core::Element.new self, element_id_from(id) }
240
+ end
241
+
242
+ # For Appium
243
+ # @param [Hash] id The id which can get as a response from server
244
+ # @return [::Appium::Core::Element]
245
+ def convert_to_element(id)
246
+ ::Appium::Core::Element.new self, element_id_from(id)
247
+ end
248
+
249
+ # For Appium
250
+ # override
251
+ # called in 'extend DriverExtensions::HasNetworkConnection'
252
+ def network_connection
253
+ execute :get_network_connection
254
+ end
255
+
256
+ # For Appium
257
+ # override
258
+ # called in 'extend DriverExtensions::HasNetworkConnection'
259
+ def network_connection=(type)
260
+ execute :set_network_connection, {}, { parameters: { type: type } }
261
+ end
262
+
263
+ # For Appium
264
+ # No implementation for W3C webdriver module
265
+ # called in 'extend DriverExtensions::HasLocation'
266
+ def location
267
+ obj = execute(:get_location) || {}
268
+ ::Selenium::WebDriver::Location.new obj['latitude'], obj['longitude'], obj['altitude']
269
+ end
270
+
271
+ # For Appium
272
+ # No implementation for W3C webdriver module
273
+ def set_location(lat, lon, alt = 0.0, speed: nil)
274
+ loc = { latitude: lat, longitude: lon, altitude: alt }
275
+ loc[:speed] = speed unless speed.nil?
276
+ execute :set_location, {}, { location: loc }
277
+ end
278
+
279
+ #
280
+ # logs
281
+ #
282
+ # For Appium
283
+ # No implementation for W3C webdriver module
284
+ def available_log_types
285
+ types = execute :get_available_log_types
286
+ Array(types).map(&:to_sym)
287
+ end
288
+
289
+ # For Appium
290
+ # No implementation for W3C webdriver module
291
+ def log(type)
292
+ data = execute :get_log, {}, { type: type.to_s }
293
+
294
+ Array(data).map do |l|
295
+ begin
296
+ ::Selenium::WebDriver::LogEntry.new l.fetch('level', 'UNKNOWN'), l.fetch('timestamp'), l.fetch('message')
297
+ rescue KeyError
298
+ next
299
+ end
300
+ end
301
+ end
302
+
303
+ # For Appium
304
+ def log_event(vendor, event)
305
+ execute :post_log_event, {}, { vendor: vendor, event: event }
306
+ end
307
+
308
+ # For Appium
309
+ def log_events(type = nil)
310
+ args = {}
311
+ args['type'] = type unless type.nil?
312
+
313
+ execute :get_log_events, {}, args
314
+ end
315
+
316
+ def take_viewport_screenshot
317
+ execute_script('mobile: viewportScreenshot')
318
+ end
319
+
320
+ def take_element_screenshot(element)
321
+ execute :take_element_screenshot, id: element.ref
322
+ end
323
+
324
+ private
325
+
326
+ def unwrap_script_result(arg)
327
+ case arg
328
+ when Array
329
+ arg.map { |e| unwrap_script_result(e) }
330
+ when Hash
331
+ element_id = element_id_from(arg)
332
+ return ::Appium::Core::Element.new(self, element_id) if element_id
333
+
334
+ arg.each { |k, v| arg[k] = unwrap_script_result(v) }
335
+ else
336
+ arg
337
+ end
338
+ end
339
+
340
+ def element_id_from(id)
341
+ id['ELEMENT'] || id['element-6066-11e4-a52e-4f735466cecf']
342
+ end
343
+
344
+ # Don't convert locators for Appium Client
345
+ # TODO: Only for Appium. Ideally, we'd like to keep the selenium-webdriver
346
+ def convert_locators(how, what)
347
+ # case how
348
+ # when 'class name'
349
+ # how = 'css selector'
350
+ # what = ".#{escape_css(what)}"
351
+ # when 'id'
352
+ # how = 'css selector'
353
+ # what = "##{escape_css(what)}"
354
+ # when 'name'
355
+ # how = 'css selector'
356
+ # what = "*[name='#{escape_css(what)}']"
357
+ # when 'tag name'
358
+ # how = 'css selector'
359
+ # end
360
+ [how, what]
361
+ end
102
362
  end # class Bridge
103
363
  end # class Base
104
364
  end # module Core
@@ -36,6 +36,8 @@ module Appium
36
36
  include ::Appium::Core::Base::HasLocation
37
37
  include ::Appium::Core::Base::HasNetworkConnection
38
38
 
39
+ private
40
+
39
41
  # Private API.
40
42
  # Do not use this for general use. Used by flutter driver to get bridge for creating a new element
41
43
  attr_reader :bridge
@@ -48,9 +50,8 @@ module Appium
48
50
  # 2. Sniffs response.
49
51
  # 3. Based on the response, understands which dialect we should use.
50
52
  #
51
- # @return [Bridge::W3C]
53
+ # @return [::Appium::Core::Base::Bridge]
52
54
  #
53
- # TODO: Fixme
54
55
  def create_bridge(**opts)
55
56
  opts[:url] ||= service_url(opts)
56
57
  caps = opts.delete(:capabilities)
@@ -73,17 +74,13 @@ module Appium
73
74
  bridge_opts = { http_client: opts.delete(:http_client), url: opts.delete(:url) }
74
75
  raise ArgumentError, "Unable to create a driver with parameters: #{opts}" unless opts.empty?
75
76
 
76
- bridge = ::Appium::Core::Base::Bridge::W3C.new(**bridge_opts)
77
+ bridge = ::Appium::Core::Base::Bridge.new(**bridge_opts)
77
78
 
78
79
  bridge.create_session(capabilities)
79
80
  bridge
80
81
  end
81
82
 
82
- # Get the dialect value
83
- # @return [:oss|:w3c]
84
- def dialect
85
- @bridge.dialect
86
- end
83
+ public
87
84
 
88
85
  # Update +server_url+ and HTTP clients following this arguments, protocol, host, port and path.
89
86
  # After this method, +@bridge.http+ will be a new instance following them instead of +server_url+ which is
@@ -1074,7 +1071,7 @@ module Appium
1074
1071
  #
1075
1072
  # @param [String] img_path A path to a partial image you'd like to find
1076
1073
  #
1077
- # @return [::Selenium::WebDriver::Element]
1074
+ # @return [::Appium::Core::Element]
1078
1075
  #
1079
1076
  # @example
1080
1077
  #
@@ -1144,14 +1141,14 @@ module Appium
1144
1141
  @bridge.execute_driver(script: script, type: type, timeout_ms: timeout_ms)
1145
1142
  end
1146
1143
 
1147
- # Convert vanilla element response to ::Selenium::WebDriver::Element
1144
+ # Convert vanilla element response to ::Appium::Core::Element
1148
1145
  #
1149
1146
  # @param [Hash] id The id which can get as a response from server
1150
- # @return [::Selenium::WebDriver::Element]
1147
+ # @return [::Appium::Core::Element]
1151
1148
  #
1152
1149
  # @example
1153
1150
  # response = {"element-6066-11e4-a52e-4f735466cecf"=>"xxxx", "ELEMENT"=>"xxxx"}
1154
- # ele = @driver.convert_to_element(response) #=> ::Selenium::WebDriver::Element
1151
+ # ele = @driver.convert_to_element(response) #=> ::Appium::Core::Element
1155
1152
  # ele.rect #=> Can get the rect of the element
1156
1153
  #
1157
1154
  def convert_to_element(id)
@@ -12,6 +12,262 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- require_relative 'base/command'
16
- require_relative 'command/common'
17
- require_relative 'command/w3c'
15
+ module Appium
16
+ module Core
17
+ # ref: https://github.com/appium/appium-base-driver/blob/master/lib/mjsonwp/routes.js
18
+ module Commands
19
+ # Some commands differ for each driver.
20
+ COMMAND = {
21
+ ###
22
+ # W3C
23
+ ###
24
+ status: [:get, 'status'],
25
+
26
+ #
27
+ # session handling
28
+ #
29
+
30
+ new_session: [:post, 'session'],
31
+ delete_session: [:delete, 'session/:session_id'],
32
+
33
+ #
34
+ # basic driver
35
+ #
36
+
37
+ get: [:post, 'session/:session_id/url'],
38
+ get_current_url: [:get, 'session/:session_id/url'],
39
+ back: [:post, 'session/:session_id/back'],
40
+ forward: [:post, 'session/:session_id/forward'],
41
+ refresh: [:post, 'session/:session_id/refresh'],
42
+ get_title: [:get, 'session/:session_id/title'],
43
+
44
+ #
45
+ # window and Frame handling
46
+ #
47
+
48
+ get_window_handle: [:get, 'session/:session_id/window'],
49
+ new_window: [:post, 'session/:session_id/window/new'],
50
+ close_window: [:delete, 'session/:session_id/window'],
51
+ switch_to_window: [:post, 'session/:session_id/window'],
52
+ get_window_handles: [:get, 'session/:session_id/window/handles'],
53
+ fullscreen_window: [:post, 'session/:session_id/window/fullscreen'],
54
+ minimize_window: [:post, 'session/:session_id/window/minimize'],
55
+ maximize_window: [:post, 'session/:session_id/window/maximize'],
56
+ set_window_size: [:post, 'session/:session_id/window/size'],
57
+ get_window_size: [:get, 'session/:session_id/window/size'],
58
+ set_window_position: [:post, 'session/:session_id/window/position'],
59
+ get_window_position: [:get, 'session/:session_id/window/position'],
60
+ set_window_rect: [:post, 'session/:session_id/window/rect'],
61
+ get_window_rect: [:get, 'session/:session_id/window/rect'],
62
+ switch_to_frame: [:post, 'session/:session_id/frame'],
63
+ switch_to_parent_frame: [:post, 'session/:session_id/frame/parent'],
64
+
65
+ #
66
+ # element
67
+ #
68
+
69
+ find_element: [:post, 'session/:session_id/element'],
70
+ find_elements: [:post, 'session/:session_id/elements'],
71
+ find_child_element: [:post, 'session/:session_id/element/:id/element'],
72
+ find_child_elements: [:post, 'session/:session_id/element/:id/elements'],
73
+ get_active_element: [:get, 'session/:session_id/element/active'],
74
+ is_element_selected: [:get, 'session/:session_id/element/:id/selected'],
75
+ get_element_attribute: [:get, 'session/:session_id/element/:id/attribute/:name'],
76
+ get_element_property: [:get, 'session/:session_id/element/:id/property/:name'],
77
+ get_element_css_value: [:get, 'session/:session_id/element/:id/css/:property_name'],
78
+ get_element_text: [:get, 'session/:session_id/element/:id/text'],
79
+ get_element_tag_name: [:get, 'session/:session_id/element/:id/name'],
80
+ get_element_rect: [:get, 'session/:session_id/element/:id/rect'],
81
+ is_element_enabled: [:get, 'session/:session_id/element/:id/enabled'],
82
+
83
+ #
84
+ # document handling
85
+ #
86
+
87
+ get_page_source: [:get, 'session/:session_id/source'],
88
+ execute_script: [:post, 'session/:session_id/execute/sync'],
89
+ execute_async_script: [:post, 'session/:session_id/execute/async'],
90
+
91
+ #
92
+ # cookies
93
+ #
94
+
95
+ get_all_cookies: [:get, 'session/:session_id/cookie'],
96
+ get_cookie: [:get, 'session/:session_id/cookie/:name'],
97
+ add_cookie: [:post, 'session/:session_id/cookie'],
98
+ delete_cookie: [:delete, 'session/:session_id/cookie/:name'],
99
+ delete_all_cookies: [:delete, 'session/:session_id/cookie'],
100
+
101
+ #
102
+ # timeouts
103
+ #
104
+
105
+ set_timeout: [:post, 'session/:session_id/timeouts'],
106
+
107
+ #
108
+ # actions
109
+ #
110
+
111
+ actions: [:post, 'session/:session_id/actions'],
112
+ release_actions: [:delete, 'session/:session_id/actions'],
113
+ print_page: [:post, 'session/:session_id/print'],
114
+
115
+ #
116
+ # Element Operations
117
+ #
118
+
119
+ element_click: [:post, 'session/:session_id/element/:id/click'],
120
+ element_tap: [:post, 'session/:session_id/element/:id/tap'],
121
+ element_clear: [:post, 'session/:session_id/element/:id/clear'],
122
+ element_send_keys: [:post, 'session/:session_id/element/:id/value'],
123
+
124
+ #
125
+ # alerts
126
+ #
127
+
128
+ dismiss_alert: [:post, 'session/:session_id/alert/dismiss'],
129
+ accept_alert: [:post, 'session/:session_id/alert/accept'],
130
+ get_alert_text: [:get, 'session/:session_id/alert/text'],
131
+ send_alert_text: [:post, 'session/:session_id/alert/text'],
132
+
133
+ #
134
+ # screenshot
135
+ #
136
+
137
+ take_screenshot: [:get, 'session/:session_id/screenshot'],
138
+ take_element_screenshot: [:get, 'session/:session_id/element/:id/screenshot'],
139
+
140
+ #
141
+ # server extensions
142
+ #
143
+
144
+ upload_file: [:post, 'session/:session_id/se/file'],
145
+
146
+ ###
147
+ # Used by Appium, but no in W3C
148
+ ###
149
+
150
+ # ::Appium::Core::Base::Commands::OSS has the following commands and Appium also use them.
151
+ # Delegated to ::Appium::Core::Base::Commands::OSS commands
152
+ is_element_displayed: [:get, 'session/:session_id/element/:id/displayed'], # hint: https://w3c.github.io/webdriver/#element-displayedness
153
+
154
+ get_timeouts: [:get, 'session/:session_id/timeouts'], # https://w3c.github.io/webdriver/#get-timeouts
155
+
156
+ # Add OSS commands to W3C commands. We can remove them if we would like to remove them from W3C module.
157
+ ### Session capability
158
+ get_capabilities: [:get, 'session/:session_id'],
159
+
160
+ ### rotatable
161
+ get_screen_orientation: [:get, 'session/:session_id/orientation'],
162
+ set_screen_orientation: [:post, 'session/:session_id/orientation'],
163
+
164
+ get_location: [:get, 'session/:session_id/location'],
165
+ set_location: [:post, 'session/:session_id/location'],
166
+
167
+ ### For IME
168
+ ime_get_available_engines: [:get, 'session/:session_id/ime/available_engines'],
169
+ ime_get_active_engine: [:get, 'session/:session_id/ime/active_engine'],
170
+ ime_is_activated: [:get, 'session/:session_id/ime/activated'],
171
+ ime_deactivate: [:post, 'session/:session_id/ime/deactivate'],
172
+ ime_activate_engine: [:post, 'session/:session_id/ime/activate'],
173
+
174
+ send_keys_to_active_element: [:post, 'session/:session_id/keys'],
175
+
176
+ ### Logs
177
+ get_available_log_types: [:get, 'session/:session_id/log/types'],
178
+ get_log: [:post, 'session/:session_id/log'],
179
+
180
+ ###
181
+ # Appium own
182
+ ###
183
+
184
+ # common
185
+ get_all_sessions: [:get, 'sessions'],
186
+ available_contexts: [:get, 'session/:session_id/contexts'],
187
+ set_context: [:post, 'session/:session_id/context'],
188
+ current_context: [:get, 'session/:session_id/context'],
189
+
190
+ touch_actions: [:post, 'session/:session_id/touch/perform'],
191
+ multi_touch: [:post, 'session/:session_id/touch/multi/perform'],
192
+
193
+ set_immediate_value: [:post, 'session/:session_id/appium/element/:id/value'],
194
+ replace_value: [:post, 'session/:session_id/appium/element/:id/replace_value'],
195
+
196
+ launch_app: [:post, 'session/:session_id/appium/app/launch'],
197
+ close_app: [:post, 'session/:session_id/appium/app/close'],
198
+ reset: [:post, 'session/:session_id/appium/app/reset'],
199
+ background_app: [:post, 'session/:session_id/appium/app/background'],
200
+ app_strings: [:post, 'session/:session_id/appium/app/strings'],
201
+
202
+ device_locked?: [:post, 'session/:session_id/appium/device/is_locked'],
203
+ unlock: [:post, 'session/:session_id/appium/device/unlock'],
204
+ lock: [:post, 'session/:session_id/appium/device/lock'],
205
+ device_time: [:get, 'session/:session_id/appium/device/system_time'],
206
+ install_app: [:post, 'session/:session_id/appium/device/install_app'],
207
+ remove_app: [:post, 'session/:session_id/appium/device/remove_app'],
208
+ app_installed?: [:post, 'session/:session_id/appium/device/app_installed'],
209
+ activate_app: [:post, 'session/:session_id/appium/device/activate_app'],
210
+ terminate_app: [:post, 'session/:session_id/appium/device/terminate_app'],
211
+ app_state: [:post, 'session/:session_id/appium/device/app_state'],
212
+ shake: [:post, 'session/:session_id/appium/device/shake'],
213
+ hide_keyboard: [:post, 'session/:session_id/appium/device/hide_keyboard'],
214
+ press_keycode: [:post, 'session/:session_id/appium/device/press_keycode'],
215
+ long_press_keycode: [:post, 'session/:session_id/appium/device/long_press_keycode'],
216
+ # keyevent is only for Selendroid
217
+ keyevent: [:post, 'session/:session_id/appium/device/keyevent'],
218
+ push_file: [:post, 'session/:session_id/appium/device/push_file'],
219
+ pull_file: [:post, 'session/:session_id/appium/device/pull_file'],
220
+ pull_folder: [:post, 'session/:session_id/appium/device/pull_folder'],
221
+ get_clipboard: [:post, 'session/:session_id/appium/device/get_clipboard'],
222
+ set_clipboard: [:post, 'session/:session_id/appium/device/set_clipboard'],
223
+ finger_print: [:post, 'session/:session_id/appium/device/finger_print'],
224
+ get_settings: [:get, 'session/:session_id/appium/settings'],
225
+ update_settings: [:post, 'session/:session_id/appium/settings'],
226
+ stop_recording_screen: [:post, 'session/:session_id/appium/stop_recording_screen'],
227
+ start_recording_screen: [:post, 'session/:session_id/appium/start_recording_screen'],
228
+ compare_images: [:post, 'session/:session_id/appium/compare_images'],
229
+ is_keyboard_shown: [:get, 'session/:session_id/appium/device/is_keyboard_shown'],
230
+ execute_driver: [:post, 'session/:session_id/appium/execute_driver'],
231
+ post_log_event: [:post, 'session/:session_id/appium/log_event'],
232
+ get_log_events: [:post, 'session/:session_id/appium/events']
233
+ }.freeze
234
+
235
+ COMMAND_ANDROID = {
236
+ open_notifications: [:post, 'session/:session_id/appium/device/open_notifications'],
237
+ toggle_airplane_mode: [:post, 'session/:session_id/appium/device/toggle_airplane_mode'],
238
+ start_activity: [:post, 'session/:session_id/appium/device/start_activity'],
239
+ current_activity: [:get, 'session/:session_id/appium/device/current_activity'],
240
+ current_package: [:get, 'session/:session_id/appium/device/current_package'],
241
+ get_system_bars: [:get, 'session/:session_id/appium/device/system_bars'],
242
+ get_display_density: [:get, 'session/:session_id/appium/device/display_density'],
243
+ toggle_wifi: [:post, 'session/:session_id/appium/device/toggle_wifi'],
244
+ toggle_data: [:post, 'session/:session_id/appium/device/toggle_data'],
245
+ toggle_location_services: [:post, 'session/:session_id/appium/device/toggle_location_services'],
246
+ end_coverage: [:post, 'session/:session_id/appium/app/end_test_coverage'],
247
+ get_performance_data_types: [:post, 'session/:session_id/appium/performanceData/types'],
248
+ get_performance_data: [:post, 'session/:session_id/appium/getPerformanceData'],
249
+ get_network_connection: [:get, 'session/:session_id/network_connection'], # defined also in OSS
250
+ set_network_connection: [:post, 'session/:session_id/network_connection'], # defined also in OSS
251
+
252
+ # only emulator
253
+ send_sms: [:post, 'session/:session_id/appium/device/send_sms'],
254
+ gsm_call: [:post, 'session/:session_id/appium/device/gsm_call'],
255
+ gsm_signal: [:post, 'session/:session_id/appium/device/gsm_signal'],
256
+ gsm_voice: [:post, 'session/:session_id/appium/device/gsm_voice'],
257
+ set_network_speed: [:post, 'session/:session_id/appium/device/network_speed'],
258
+ set_power_capacity: [:post, 'session/:session_id/appium/device/power_capacity'],
259
+ set_power_ac: [:post, 'session/:session_id/appium/device/power_ac'],
260
+
261
+ # For chromium: https://chromium.googlesource.com/chromium/src/+/master/chrome/test/chromedriver/server/http_handler.cc
262
+ chrome_send_command: [:post, 'session/:session_id/goog/cdp/execute']
263
+ }.freeze
264
+
265
+ COMMAND_IOS = {
266
+ touch_id: [:post, 'session/:session_id/appium/simulator/touch_id'],
267
+ toggle_touch_id_enrollment: [:post, 'session/:session_id/appium/simulator/toggle_touch_id_enrollment']
268
+ }.freeze
269
+
270
+ COMMANDS = {}.merge(COMMAND).merge(COMMAND_ANDROID).merge(COMMAND_IOS).freeze
271
+ end # module Commands
272
+ end # module Core
273
+ end # module Appium