appium_lib_core 4.1.0 → 5.0.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 (56) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +8 -0
  3. data/.github/workflows/codeql-analysis.yml +70 -0
  4. data/.github/workflows/unittest.yml +8 -9
  5. data/.rubocop.yml +89 -1
  6. data/CHANGELOG.md +89 -276
  7. data/README.md +11 -6
  8. data/Rakefile +4 -0
  9. data/appium_lib_core.gemspec +4 -7
  10. data/bin/console +0 -4
  11. data/ci-jobs/functional/run_appium.yml +3 -3
  12. data/ci-jobs/functional_test.yml +3 -3
  13. data/docs/mobile_command.md +2 -2
  14. data/lib/appium_lib_core/android/device/auth_finger_print.rb +2 -1
  15. data/lib/appium_lib_core/android/device.rb +4 -4
  16. data/lib/appium_lib_core/common/base/bridge.rb +297 -90
  17. data/lib/appium_lib_core/common/base/capabilities.rb +10 -3
  18. data/lib/appium_lib_core/common/base/device_ime.rb +49 -0
  19. data/lib/appium_lib_core/common/base/driver.rb +183 -171
  20. data/lib/appium_lib_core/common/base/driver_settings.rb +51 -0
  21. data/lib/appium_lib_core/common/base/has_location.rb +80 -0
  22. data/lib/appium_lib_core/common/base/has_network_connection.rb +56 -0
  23. data/lib/appium_lib_core/common/base/http_default.rb +1 -3
  24. data/lib/appium_lib_core/common/base/remote_status.rb +31 -0
  25. data/lib/appium_lib_core/common/base/rotable.rb +54 -0
  26. data/lib/appium_lib_core/common/base/screenshot.rb +6 -6
  27. data/lib/appium_lib_core/common/base/search_context.rb +19 -4
  28. data/lib/appium_lib_core/common/base.rb +1 -3
  29. data/lib/appium_lib_core/common/command.rb +257 -4
  30. data/lib/appium_lib_core/common/device/image_comparison.rb +12 -4
  31. data/lib/appium_lib_core/common/device/keyevent.rb +4 -4
  32. data/lib/appium_lib_core/common/{command/mjsonwp.rb → device/orientation.rb} +14 -11
  33. data/lib/appium_lib_core/common/device/touch_actions.rb +2 -0
  34. data/lib/appium_lib_core/common/device/value.rb +6 -6
  35. data/lib/appium_lib_core/common/error.rb +4 -1
  36. data/lib/appium_lib_core/common/log.rb +4 -1
  37. data/lib/appium_lib_core/common/touch_action/multi_touch.rb +19 -0
  38. data/lib/appium_lib_core/common/touch_action/touch_actions.rb +16 -2
  39. data/lib/appium_lib_core/common/wait.rb +38 -6
  40. data/lib/appium_lib_core/device.rb +1 -5
  41. data/lib/appium_lib_core/driver.rb +30 -46
  42. data/lib/appium_lib_core/{patch.rb → element.rb} +66 -9
  43. data/lib/appium_lib_core/ios/uiautomation/patch.rb +1 -1
  44. data/lib/appium_lib_core/{common/base/command.rb → mac2/bridge.rb} +9 -8
  45. data/lib/appium_lib_core/mac2/device/screen.rb +48 -0
  46. data/lib/appium_lib_core/mac2/device.rb +92 -0
  47. data/lib/appium_lib_core/mac2.rb +17 -0
  48. data/lib/appium_lib_core/version.rb +2 -2
  49. data/lib/appium_lib_core.rb +2 -5
  50. data/release_notes.md +125 -0
  51. data/script/commands.rb +3 -37
  52. metadata +27 -68
  53. data/lib/appium_lib_core/common/base/bridge/mjsonwp.rb +0 -81
  54. data/lib/appium_lib_core/common/base/bridge/w3c.rb +0 -252
  55. data/lib/appium_lib_core/common/command/common.rb +0 -110
  56. data/lib/appium_lib_core/common/command/w3c.rb +0 -56
@@ -0,0 +1,80 @@
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
56
+ # in meters/second @since Appium 1.21.0 and in knots for emulators @since Appium 1.22.0.
57
+ # @param [String, Number] satellites Sets the count of geo satellites being tracked in range 1..12 @since Appium 1.22.0.
58
+ # This number is respected on Emulators.
59
+ # @param [::Selenium::WebDriver::Location]
60
+ #
61
+ # @example
62
+ #
63
+ # driver.location = ::Selenium::WebDriver::Location.new(10, 10, 10)
64
+ #
65
+ def set_location(latitude, longitude, altitude, speed: nil, satellites: nil)
66
+ if speed.nil? && satellites.nil?
67
+ self.location = ::Selenium::WebDriver::Location.new(Float(latitude), Float(longitude), Float(altitude))
68
+ else
69
+ loc = ::Selenium::WebDriver::Location.new(Float(latitude), Float(longitude), Float(altitude))
70
+
71
+ speed = Float(speed) unless speed.nil?
72
+ satellites = Integer(satellites) unless satellites.nil?
73
+
74
+ @bridge.set_location loc.latitude, loc.longitude, loc.altitude, speed: speed, satellites: satellites
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
80
+ 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 ::Appium::Core::Error::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
@@ -55,8 +55,6 @@ module Appium
55
55
  def update_sending_request_to(scheme:, host:, port:, path:)
56
56
  return @server_url unless validate_url_param(scheme, host, port, path)
57
57
 
58
- ::Appium::Logger.debug("[experimental] This feature, #{__method__}, is an experimental")
59
-
60
58
  # Add / if 'path' does not have it
61
59
  path = path.start_with?('/') ? path : "/#{path}"
62
60
  path = path.end_with?('/') ? path : "#{path}/"
@@ -71,7 +69,7 @@ module Appium
71
69
  return true unless [scheme, host, port, path].include?(nil)
72
70
 
73
71
  message = "Given parameters are scheme: '#{scheme}', host: '#{host}', port: '#{port}', path: '#{path}'"
74
- ::Appium::Logger.warn(message)
72
+ ::Appium::Logger.debug(message)
75
73
  false
76
74
  end
77
75
 
@@ -0,0 +1,31 @@
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
+
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
@@ -0,0 +1,54 @@
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
+
22
+ module Rotatable
23
+ ORIENTATIONS = %i[landscape portrait].freeze
24
+
25
+ #
26
+ # Change the screen orientation
27
+ #
28
+ # @param [:landscape, :portrait] orientation
29
+ #
30
+ #
31
+ def rotation=(orientation)
32
+ unless ORIENTATIONS.include?(orientation)
33
+ raise ::Appium::Core::Error::ArgumentError, "expected #{ORIENTATIONS.inspect}, got #{orientation.inspect}"
34
+ end
35
+
36
+ bridge.screen_orientation = orientation.to_s.upcase
37
+ end
38
+ alias rotate rotation=
39
+
40
+ #
41
+ # Get the current screen orientation
42
+ #
43
+ # @return [:landscape, :portrait] orientation
44
+ #
45
+ # @api public
46
+ #
47
+
48
+ def orientation
49
+ bridge.screen_orientation.to_sym.downcase
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -15,7 +15,7 @@
15
15
  module Appium
16
16
  module Core
17
17
  class Base
18
- module TakeScreenshot
18
+ module TakesScreenshot
19
19
  #
20
20
  # Save a PNG screenshot to the given path
21
21
  #
@@ -63,8 +63,8 @@ module Appium
63
63
  def save_element_screenshot(element, png_path)
64
64
  extension = File.extname(png_path).downcase
65
65
  if extension != '.png'
66
- ::Appium::Logger.warn 'name used for saved screenshot does not match file type. '\
67
- 'It should end with .png extension'
66
+ ::Appium::Logger.warn 'name used for saved screenshot does not match file type. ' \
67
+ 'It should end with .png extension'
68
68
  end
69
69
  File.open(png_path, 'wb') { |f| f << element_screenshot_as(element, :png) }
70
70
  end
@@ -84,9 +84,9 @@ module Appium
84
84
  def element_screenshot_as(element, format)
85
85
  case format
86
86
  when :base64
87
- bridge.take_element_screenshot(element)
87
+ bridge.element_screenshot element.id
88
88
  when :png
89
- bridge.take_element_screenshot(element).unpack('m')[0]
89
+ bridge.element_screenshot(element.id).unpack('m')[0]
90
90
  else
91
91
  raise Core::Error::UnsupportedOperationError, "unsupported format: #{format.inspect}"
92
92
  end
@@ -106,7 +106,7 @@ module Appium
106
106
  ::Appium::Logger.warn 'name used for saved screenshot does not match file type. '\
107
107
  'It should end with .png extension'
108
108
  end
109
- viewport_screenshot_encode64 = bridge.take_viewport_screenshot
109
+ viewport_screenshot_encode64 = bridge.viewport_screenshot
110
110
  File.open(png_path, 'wb') { |f| f << viewport_screenshot_encode64.unpack('m')[0] }
111
111
  end
112
112
  end
@@ -32,6 +32,7 @@ module Appium
32
32
  predicate: '-ios predicate string',
33
33
  class_chain: '-ios class chain',
34
34
  # Windows with windows prefix
35
+ # @deprecated
35
36
  windows_uiautomation: '-windows uiautomation',
36
37
  # Tizen with Tizen prefix
37
38
  tizen_uiautomation: '-tizen uiautomation'
@@ -122,6 +123,7 @@ module Appium
122
123
  # e.tag_name #=> "XCUIElementTypeStaticText"
123
124
  #
124
125
  # # For Windows
126
+ # # @deprecated
125
127
  # @driver.find_elements :windows_uiautomation, '....'
126
128
  #
127
129
  # # For Tizen
@@ -141,6 +143,8 @@ module Appium
141
143
  #
142
144
  # Find all elements matching the given arguments
143
145
  #
146
+ # @return [Array<Selenium::WebDriver::Element>]
147
+ #
144
148
  # @see SearchContext#find_elements
145
149
  #
146
150
  def find_elements(*args)
@@ -156,8 +160,17 @@ module Appium
156
160
  private
157
161
 
158
162
  def _set_by_from_finders(how)
163
+ if how == :windows_uiautomation
164
+ ::Appium::Logger.warn(
165
+ '[DEPRECATION] :windows_uiautomation is deprecated. Please use other locators.'
166
+ )
167
+ end
168
+
159
169
  by = FINDERS[how.to_sym]
160
- raise ArgumentError, "cannot find element by #{how.inspect}. Available finders are #{FINDERS.keys}." unless by
170
+ unless by
171
+ raise ::Appium::Core::Error::ArgumentError,
172
+ "cannot find element by #{how.inspect}. Available finders are #{FINDERS.keys}."
173
+ end
161
174
 
162
175
  by
163
176
  end
@@ -169,16 +182,18 @@ module Appium
169
182
  when 1
170
183
  arg = args.first
171
184
 
172
- raise ArgumentError, "expected #{arg.inspect}:#{arg.class} to respond to #shift" unless arg.respond_to?(:shift)
185
+ unless arg.respond_to?(:shift)
186
+ raise ::Appium::Core::Error::ArgumentError, "expected #{arg.inspect}:#{arg.class} to respond to #shift"
187
+ end
173
188
 
174
189
  # this will be a single-entry hash, so use #shift over #first or #[]
175
190
  arr = arg.dup.shift
176
191
 
177
- raise ArgumentError, "expected #{arr.inspect} to have 2 elements" unless arr.size == 2
192
+ raise ::Appium::Core::Error::ArgumentError, "expected #{arr.inspect} to have 2 elements" unless arr.size == 2
178
193
 
179
194
  arr
180
195
  else
181
- raise ArgumentError, "wrong number of arguments (#{args.size} for 2)"
196
+ raise ::Appium::Core::Error::ArgumentError, "wrong number of arguments (#{args.size} for 2)"
182
197
  end
183
198
  end
184
199
  end # module SearchContext
@@ -29,14 +29,12 @@ require_relative 'device/clipboard_content_type'
29
29
  require_relative 'device/device'
30
30
  require_relative 'device/touch_actions'
31
31
  require_relative 'device/execute_driver'
32
+ require_relative 'device/orientation'
32
33
 
33
34
  # The following files have selenium-webdriver related stuff.
34
35
  require_relative 'base/driver'
35
36
  require_relative 'base/bridge'
36
- require_relative 'base/bridge/mjsonwp'
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'
@@ -12,7 +12,260 @@
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
+ push_file: [:post, 'session/:session_id/appium/device/push_file'],
217
+ pull_file: [:post, 'session/:session_id/appium/device/pull_file'],
218
+ pull_folder: [:post, 'session/:session_id/appium/device/pull_folder'],
219
+ get_clipboard: [:post, 'session/:session_id/appium/device/get_clipboard'],
220
+ set_clipboard: [:post, 'session/:session_id/appium/device/set_clipboard'],
221
+ finger_print: [:post, 'session/:session_id/appium/device/finger_print'],
222
+ get_settings: [:get, 'session/:session_id/appium/settings'],
223
+ update_settings: [:post, 'session/:session_id/appium/settings'],
224
+ stop_recording_screen: [:post, 'session/:session_id/appium/stop_recording_screen'],
225
+ start_recording_screen: [:post, 'session/:session_id/appium/start_recording_screen'],
226
+ compare_images: [:post, 'session/:session_id/appium/compare_images'],
227
+ is_keyboard_shown: [:get, 'session/:session_id/appium/device/is_keyboard_shown'],
228
+ execute_driver: [:post, 'session/:session_id/appium/execute_driver'],
229
+ post_log_event: [:post, 'session/:session_id/appium/log_event'],
230
+ get_log_events: [:post, 'session/:session_id/appium/events']
231
+ }.freeze
232
+
233
+ COMMAND_ANDROID = {
234
+ open_notifications: [:post, 'session/:session_id/appium/device/open_notifications'],
235
+ toggle_airplane_mode: [:post, 'session/:session_id/appium/device/toggle_airplane_mode'],
236
+ start_activity: [:post, 'session/:session_id/appium/device/start_activity'],
237
+ current_activity: [:get, 'session/:session_id/appium/device/current_activity'],
238
+ current_package: [:get, 'session/:session_id/appium/device/current_package'],
239
+ get_system_bars: [:get, 'session/:session_id/appium/device/system_bars'],
240
+ get_display_density: [:get, 'session/:session_id/appium/device/display_density'],
241
+ toggle_wifi: [:post, 'session/:session_id/appium/device/toggle_wifi'],
242
+ toggle_data: [:post, 'session/:session_id/appium/device/toggle_data'],
243
+ toggle_location_services: [:post, 'session/:session_id/appium/device/toggle_location_services'],
244
+ end_coverage: [:post, 'session/:session_id/appium/app/end_test_coverage'],
245
+ get_performance_data_types: [:post, 'session/:session_id/appium/performanceData/types'],
246
+ get_performance_data: [:post, 'session/:session_id/appium/getPerformanceData'],
247
+ get_network_connection: [:get, 'session/:session_id/network_connection'], # defined also in OSS
248
+ set_network_connection: [:post, 'session/:session_id/network_connection'], # defined also in OSS
249
+
250
+ # only emulator
251
+ send_sms: [:post, 'session/:session_id/appium/device/send_sms'],
252
+ gsm_call: [:post, 'session/:session_id/appium/device/gsm_call'],
253
+ gsm_signal: [:post, 'session/:session_id/appium/device/gsm_signal'],
254
+ gsm_voice: [:post, 'session/:session_id/appium/device/gsm_voice'],
255
+ set_network_speed: [:post, 'session/:session_id/appium/device/network_speed'],
256
+ set_power_capacity: [:post, 'session/:session_id/appium/device/power_capacity'],
257
+ set_power_ac: [:post, 'session/:session_id/appium/device/power_ac'],
258
+
259
+ # For chromium: https://chromium.googlesource.com/chromium/src/+/master/chrome/test/chromedriver/server/http_handler.cc
260
+ chrome_send_command: [:post, 'session/:session_id/goog/cdp/execute']
261
+ }.freeze
262
+
263
+ COMMAND_IOS = {
264
+ touch_id: [:post, 'session/:session_id/appium/simulator/touch_id'],
265
+ toggle_touch_id_enrollment: [:post, 'session/:session_id/appium/simulator/toggle_touch_id_enrollment']
266
+ }.freeze
267
+
268
+ COMMANDS = {}.merge(COMMAND).merge(COMMAND_ANDROID).merge(COMMAND_IOS).freeze
269
+ end # module Commands
270
+ end # module Core
271
+ end # module Appium