appium_lib_core 4.3.1 → 5.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,10 +19,10 @@ module Appium
19
19
  # @private
20
20
  # @param [Hash] opts_caps Capabilities for Appium server. All capability keys are converted to lowerCamelCase when
21
21
  # this client sends capabilities to Appium server as JSON format.
22
- # @return [::Selenium::WebDriver::Remote::W3C::Capabilities] Return instance of Appium::Core::Base::Capabilities
23
- # inherited ::Selenium::WebDriver::Remote::W3C::Capabilities
22
+ # @return [::Selenium::WebDriver::Remote::Capabilities] Return instance of Appium::Core::Base::Capabilities
23
+ # inherited ::Selenium::WebDriver::Remote::Capabilities
24
24
  def self.create_capabilities(opts_caps = {})
25
- ::Selenium::WebDriver::Remote::W3C::Capabilities.new(opts_caps)
25
+ ::Selenium::WebDriver::Remote::Capabilities.new(opts_caps)
26
26
  end
27
27
  end
28
28
  end
@@ -16,6 +16,9 @@ require 'base64'
16
16
  require_relative 'search_context'
17
17
  require_relative 'screenshot'
18
18
  require_relative 'rotable'
19
+ require_relative 'remote_status'
20
+ require_relative 'has_location'
21
+ require_relative 'has_network_connection'
19
22
 
20
23
  module Appium
21
24
  module Core
@@ -29,33 +32,56 @@ module Appium
29
32
  include ::Appium::Core::Base::Rotatable
30
33
  include ::Appium::Core::Base::SearchContext
31
34
  include ::Appium::Core::Base::TakesScreenshot
35
+ include ::Appium::Core::Base::HasRemoteStatus
36
+ include ::Appium::Core::Base::HasLocation
37
+ include ::Appium::Core::Base::HasNetworkConnection
38
+
39
+ private
32
40
 
33
41
  # Private API.
34
42
  # Do not use this for general use. Used by flutter driver to get bridge for creating a new element
35
43
  attr_reader :bridge
36
44
 
37
- def initialize(opts = {})
38
- listener = opts.delete(:listener)
39
- @bridge = ::Appium::Core::Base::Bridge.handshake(**opts)
40
- if @bridge.dialect == :oss # MJSONWP
41
- extend ::Selenium::WebDriver::DriverExtensions::HasTouchScreen
42
- extend ::Selenium::WebDriver::DriverExtensions::HasLocation
43
- extend ::Selenium::WebDriver::DriverExtensions::HasNetworkConnection
44
- elsif @bridge.dialect == :w3c
45
- # TODO: Only for Appium. Ideally, we'd like to remove the below like selenium-webdriver
46
- extend ::Selenium::WebDriver::DriverExtensions::HasTouchScreen
47
- extend ::Selenium::WebDriver::DriverExtensions::HasLocation
48
- extend ::Selenium::WebDriver::DriverExtensions::HasNetworkConnection
45
+ # Almost same as self.handshake in ::Selenium::WebDriver::Remote::Bridge
46
+ #
47
+ # Implements protocol handshake which:
48
+ #
49
+ # 1. Creates session with driver.
50
+ # 2. Sniffs response.
51
+ # 3. Based on the response, understands which dialect we should use.
52
+ #
53
+ # @return [::Appium::Core::Base::Bridge]
54
+ #
55
+ def create_bridge(**opts)
56
+ opts[:url] ||= service_url(opts)
57
+ caps = opts.delete(:capabilities)
58
+ # NOTE: This is deprecated
59
+ cap_array = caps.is_a?(Hash) ? [caps] : Array(caps)
60
+
61
+ desired_capabilities = opts.delete(:desired_capabilities)
62
+ if desired_capabilities
63
+ if desired_capabilities.is_a?(Hash)
64
+ desired_capabilities = ::Selenium::WebDriver::Remote::Capabilities(desired_capabilities)
65
+ end
66
+ cap_array << desired_capabilities
49
67
  end
50
- super(@bridge, listener: listener)
51
- end
52
68
 
53
- # Get the dialect value
54
- # @return [:oss|:w3c]
55
- def dialect
56
- @bridge.dialect
69
+ options = opts.delete(:options)
70
+ cap_array << options if options
71
+
72
+ capabilities = generate_capabilities(cap_array)
73
+
74
+ bridge_opts = { http_client: opts.delete(:http_client), url: opts.delete(:url) }
75
+ raise ArgumentError, "Unable to create a driver with parameters: #{opts}" unless opts.empty?
76
+
77
+ bridge = ::Appium::Core::Base::Bridge.new(**bridge_opts)
78
+
79
+ bridge.create_session(capabilities)
80
+ bridge
57
81
  end
58
82
 
83
+ public
84
+
59
85
  # Update +server_url+ and HTTP clients following this arguments, protocol, host, port and path.
60
86
  # After this method, +@bridge.http+ will be a new instance following them instead of +server_url+ which is
61
87
  # set before creating session.
@@ -69,7 +95,7 @@ module Appium
69
95
  #
70
96
  def update_sending_request_to(protocol:, host:, port:, path:)
71
97
  unless @bridge.http&.class&.method_defined? :update_sending_request_to
72
- ::Appium::Logger.fatal "#{@bridge.http&.class} has no 'update_sending_request_to'. " \
98
+ ::Appium::Logger.warn "#{@bridge.http&.class} has no 'update_sending_request_to'. " \
73
99
  'It keeps current connection target.'
74
100
  return
75
101
  end
@@ -168,10 +194,24 @@ module Appium
168
194
  @bridge = bridge
169
195
  end
170
196
 
197
+ # Get appium Settings for current test session.
198
+ #
199
+ # @example
200
+ #
201
+ # @driver.settings.get
202
+ #
171
203
  def get
172
204
  @bridge.get_settings
173
205
  end
174
206
 
207
+ # Update Appium Settings for current test session
208
+ #
209
+ # @param [Hash] settings Settings to update, keys are settings, values to value to set each setting to
210
+ #
211
+ # @example
212
+ #
213
+ # @driver.settings.update({'allowInvisibleElements': true})
214
+ #
175
215
  def update(settings)
176
216
  @bridge.update_settings(settings)
177
217
  end
@@ -208,8 +248,8 @@ module Appium
208
248
  #
209
249
  # @example
210
250
  #
211
- # @driver.update_settings('allowInvisibleElements': true)
212
- # @driver.settings.update('allowInvisibleElements': true)
251
+ # @driver.update_settings({ 'allowInvisibleElements': true })
252
+ # @driver.settings.update({ 'allowInvisibleElements': true })
213
253
  # @driver.settings = { 'allowInvisibleElements': true }
214
254
  #
215
255
  def settings=(value)
@@ -891,13 +931,13 @@ module Appium
891
931
  # Retrieve the capabilities of the specified session.
892
932
  # It's almost same as +@driver.capabilities+ but you can get more details.
893
933
  #
894
- # @return [Selenium::WebDriver::Remote::Capabilities, Selenium::WebDriver::Remote::W3C::Capabilities]
934
+ # @return [Selenium::WebDriver::Remote::Capabilities, Selenium::WebDriver::Remote::Capabilities]
895
935
  #
896
936
  # @example
897
937
  # @driver.session_capabilities
898
938
  #
899
939
  # #=> uiautomator2
900
- # # <Selenium::WebDriver::Remote::W3C::Capabilities:0x007fa38dae1360
940
+ # # <Selenium::WebDriver::Remote::Capabilities:0x007fa38dae1360
901
941
  # # @capabilities=
902
942
  # # {:proxy=>nil,
903
943
  # # :browser_name=>nil,
@@ -947,7 +987,7 @@ module Appium
947
987
  # # "viewportRect"=>{"left"=>0, "top"=>63, "width"=>1080, "height"=>1731}}>
948
988
  # #
949
989
  # #=> XCUITest
950
- # # <Selenium::WebDriver::Remote::W3C::Capabilities:0x007fb15dc01370
990
+ # # <Selenium::WebDriver::Remote::Capabilities:0x007fb15dc01370
951
991
  # # @capabilities=
952
992
  # # {:proxy=>nil,
953
993
  # # :browser_name=>"UICatalog",
@@ -1004,11 +1044,14 @@ module Appium
1004
1044
  visualize: visualize)
1005
1045
  end
1006
1046
 
1007
- def find_image_occurrence(full_image:, partial_image:, visualize: false, threshold: nil)
1047
+ def find_image_occurrence(full_image:, partial_image:, visualize: false, threshold: nil,
1048
+ multiple: nil, match_neighbour_threshold: nil)
1008
1049
  @bridge.find_image_occurrence(full_image: full_image,
1009
1050
  partial_image: partial_image,
1010
1051
  visualize: visualize,
1011
- threshold: threshold)
1052
+ threshold: threshold,
1053
+ multiple: multiple,
1054
+ match_neighbour_threshold: match_neighbour_threshold)
1012
1055
  end
1013
1056
 
1014
1057
  def get_images_similarity(first_image:, second_image:, visualize: false)
@@ -1028,7 +1071,7 @@ module Appium
1028
1071
  #
1029
1072
  # @param [String] img_path A path to a partial image you'd like to find
1030
1073
  #
1031
- # @return [::Selenium::WebDriver::Element]
1074
+ # @return [::Appium::Core::Element]
1032
1075
  #
1033
1076
  # @example
1034
1077
  #
@@ -1098,14 +1141,14 @@ module Appium
1098
1141
  @bridge.execute_driver(script: script, type: type, timeout_ms: timeout_ms)
1099
1142
  end
1100
1143
 
1101
- # Convert vanilla element response to ::Selenium::WebDriver::Element
1144
+ # Convert vanilla element response to ::Appium::Core::Element
1102
1145
  #
1103
1146
  # @param [Hash] id The id which can get as a response from server
1104
- # @return [::Selenium::WebDriver::Element]
1147
+ # @return [::Appium::Core::Element]
1105
1148
  #
1106
1149
  # @example
1107
1150
  # response = {"element-6066-11e4-a52e-4f735466cecf"=>"xxxx", "ELEMENT"=>"xxxx"}
1108
- # ele = @driver.convert_to_element(response) #=> ::Selenium::WebDriver::Element
1151
+ # ele = @driver.convert_to_element(response) #=> ::Appium::Core::Element
1109
1152
  # ele.rect #=> Can get the rect of the element
1110
1153
  #
1111
1154
  def convert_to_element(id)
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Appium
16
+ module Core
17
+ class Base
18
+ #
19
+ # @api private
20
+ #
21
+ module HasLocation
22
+ # Get the location of the device.
23
+ #
24
+ # @return [::Selenium::WebDriver::Location]
25
+ #
26
+ # @example
27
+ #
28
+ # driver.location #=> ::Selenium::WebDriver::Location.new(10, 10, 10)
29
+ #
30
+ def location
31
+ @bridge.location
32
+ end
33
+
34
+ # Set the location of the device.
35
+ #
36
+ # @param [::Selenium::WebDriver::Location] location Set the location.
37
+ #
38
+ # @example
39
+ #
40
+ # driver.location = ::Selenium::WebDriver::Location.new(10, 10, 10)
41
+ #
42
+ def location=(location)
43
+ unless location.is_a?(::Selenium::WebDriver::Location)
44
+ raise TypeError, "expected #{::Selenium::WebDriver::Location}, got #{location.inspect}:#{location.class}"
45
+ end
46
+
47
+ @bridge.set_location location.latitude, location.longitude, location.altitude
48
+ end
49
+
50
+ # Set the location of the device.
51
+ #
52
+ # @param [String, Number] latitude Set the latitude.
53
+ # @param [String, Number] longitude Set the longitude.
54
+ # @param [String, Number] altitude Set the altitude.
55
+ # @param [String, Number] speed Set the speed to apply the location on Android real devices @since Appium 1.21.0.
56
+ # @param [::Selenium::WebDriver::Location]
57
+ #
58
+ # @example
59
+ #
60
+ # driver.location = ::Selenium::WebDriver::Location.new(10, 10, 10)
61
+ #
62
+ def set_location(latitude, longitude, altitude, speed: nil)
63
+ if speed.nil?
64
+ self.location = ::Selenium::WebDriver::Location.new(Float(latitude), Float(longitude), Float(altitude))
65
+ else
66
+ loc = ::Selenium::WebDriver::Location.new(Float(latitude), Float(longitude), Float(altitude))
67
+ @bridge.set_location loc.latitude, loc.longitude, loc.altitude, speed: Float(speed)
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Appium
16
+ module Core
17
+ class Base
18
+ #
19
+ # @api private
20
+ #
21
+ module HasNetworkConnection
22
+ def network_connection_type
23
+ connection_value = @bridge.network_connection
24
+
25
+ connection_type = values_to_type[connection_value]
26
+
27
+ # In case the connection type is not recognized return the
28
+ # connection value.
29
+ connection_type || connection_value
30
+ end
31
+
32
+ def network_connection_type=(connection_type)
33
+ raise ArgumentError, 'Invalid connection type' unless valid_type? connection_type
34
+
35
+ connection_value = type_to_values[connection_type]
36
+
37
+ @bridge.network_connection = connection_value
38
+ end
39
+
40
+ private
41
+
42
+ def type_to_values
43
+ { airplane_mode: 1, wifi: 2, data: 4, all: 6, none: 0 }
44
+ end
45
+
46
+ def values_to_type
47
+ type_to_values.invert
48
+ end
49
+
50
+ def valid_type?(type)
51
+ type_to_values.keys.include? type
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -15,10 +15,17 @@
15
15
  module Appium
16
16
  module Core
17
17
  class Base
18
- module Commands
19
- OSS = ::Selenium::WebDriver::Remote::OSS::Bridge::COMMANDS.freeze
20
- W3C = ::Selenium::WebDriver::Remote::W3C::Bridge::COMMANDS.freeze
21
- end # module Commands
22
- end # module Base
23
- end # module Core
24
- end # module Appium
18
+ #
19
+ # @api private
20
+ #
21
+
22
+ module HasRemoteStatus
23
+ # Selenium binding has this ability only in Remote Binding,
24
+ # so this library has this method by own for safe.
25
+ def remote_status
26
+ bridge.status
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -12,7 +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/mjsonwp'
18
- 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