appium_lib_core 4.1.0 → 5.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +8 -0
  3. data/.github/workflows/unittest.yml +2 -2
  4. data/CHANGELOG.md +51 -277
  5. data/README.md +2 -1
  6. data/Rakefile +4 -0
  7. data/appium_lib_core.gemspec +4 -4
  8. data/ci-jobs/functional/run_appium.yml +2 -2
  9. data/ci-jobs/functional_test.yml +2 -2
  10. data/docs/mobile_command.md +3 -2
  11. data/lib/appium_lib_core/android/device/auth_finger_print.rb +2 -1
  12. data/lib/appium_lib_core/android/device.rb +4 -4
  13. data/lib/appium_lib_core/common/base/bridge.rb +300 -89
  14. data/lib/appium_lib_core/common/base/capabilities.rb +10 -3
  15. data/lib/appium_lib_core/common/base/device_ime.rb +49 -0
  16. data/lib/appium_lib_core/common/base/driver.rb +150 -112
  17. data/lib/appium_lib_core/common/base/driver_settings.rb +51 -0
  18. data/lib/appium_lib_core/common/base/has_location.rb +80 -0
  19. data/lib/appium_lib_core/common/base/has_network_connection.rb +56 -0
  20. data/lib/appium_lib_core/common/base/http_default.rb +1 -3
  21. data/lib/appium_lib_core/common/base/remote_status.rb +31 -0
  22. data/lib/appium_lib_core/common/base/rotable.rb +54 -0
  23. data/lib/appium_lib_core/common/base/screenshot.rb +5 -4
  24. data/lib/appium_lib_core/common/base/search_context.rb +11 -4
  25. data/lib/appium_lib_core/common/base.rb +1 -3
  26. data/lib/appium_lib_core/common/command.rb +259 -4
  27. data/lib/appium_lib_core/common/device/image_comparison.rb +12 -4
  28. data/lib/appium_lib_core/common/device/keyevent.rb +4 -4
  29. data/lib/appium_lib_core/common/{command/mjsonwp.rb → device/orientation.rb} +14 -11
  30. data/lib/appium_lib_core/common/device/value.rb +4 -4
  31. data/lib/appium_lib_core/common/error.rb +4 -1
  32. data/lib/appium_lib_core/common/log.rb +4 -1
  33. data/lib/appium_lib_core/common/touch_action/touch_actions.rb +4 -1
  34. data/lib/appium_lib_core/device.rb +1 -5
  35. data/lib/appium_lib_core/driver.rb +23 -27
  36. data/lib/appium_lib_core/{patch.rb → element.rb} +57 -9
  37. data/lib/appium_lib_core/ios/uiautomation/patch.rb +1 -1
  38. data/lib/appium_lib_core/{common/base/command.rb → mac2/bridge.rb} +9 -8
  39. data/lib/appium_lib_core/mac2/device/screen.rb +48 -0
  40. data/lib/appium_lib_core/mac2/device.rb +92 -0
  41. data/lib/appium_lib_core/mac2.rb +17 -0
  42. data/lib/appium_lib_core/version.rb +2 -2
  43. data/lib/appium_lib_core.rb +2 -5
  44. data/release_notes.md +82 -0
  45. data/script/commands.rb +3 -37
  46. metadata +30 -30
  47. data/lib/appium_lib_core/common/base/bridge/mjsonwp.rb +0 -81
  48. data/lib/appium_lib_core/common/base/bridge/w3c.rb +0 -252
  49. data/lib/appium_lib_core/common/command/common.rb +0 -110
  50. data/lib/appium_lib_core/common/command/w3c.rb +0 -56
metadata CHANGED
@@ -1,35 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appium_lib_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 5.0.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuaki MATSUO
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-26 00:00:00.000000000 Z
11
+ date: 2021-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '3.14'
20
- - - ">="
17
+ - - '='
21
18
  - !ruby/object:Gem::Version
22
- version: 3.14.1
19
+ version: 4.0.0.rc2
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '3.14'
30
- - - ">="
24
+ - - '='
31
25
  - !ruby/object:Gem::Version
32
- version: 3.14.1
26
+ version: 4.0.0.rc2
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: faye-websocket
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -120,28 +114,28 @@ dependencies:
120
114
  requirements:
121
115
  - - "~>"
122
116
  - !ruby/object:Gem::Version
123
- version: 3.11.0
117
+ version: 3.14.0
124
118
  type: :development
125
119
  prerelease: false
126
120
  version_requirements: !ruby/object:Gem::Requirement
127
121
  requirements:
128
122
  - - "~>"
129
123
  - !ruby/object:Gem::Version
130
- version: 3.11.0
124
+ version: 3.14.0
131
125
  - !ruby/object:Gem::Dependency
132
126
  name: rubocop
133
127
  requirement: !ruby/object:Gem::Requirement
134
128
  requirements:
135
129
  - - '='
136
130
  - !ruby/object:Gem::Version
137
- version: 1.7.0
131
+ version: 1.12.1
138
132
  type: :development
139
133
  prerelease: false
140
134
  version_requirements: !ruby/object:Gem::Requirement
141
135
  requirements:
142
136
  - - '='
143
137
  - !ruby/object:Gem::Version
144
- version: 1.7.0
138
+ version: 1.12.1
145
139
  - !ruby/object:Gem::Dependency
146
140
  name: appium_thor
147
141
  requirement: !ruby/object:Gem::Requirement
@@ -221,6 +215,7 @@ extra_rdoc_files: []
221
215
  files:
222
216
  - ".github/ISSUE_TEMPLATE/issue-report.md"
223
217
  - ".github/contributing.md"
218
+ - ".github/dependabot.yml"
224
219
  - ".github/issue_template.md"
225
220
  - ".github/workflows/unittest.yml"
226
221
  - ".gitignore"
@@ -261,19 +256,19 @@ files:
261
256
  - lib/appium_lib_core/common.rb
262
257
  - lib/appium_lib_core/common/base.rb
263
258
  - lib/appium_lib_core/common/base/bridge.rb
264
- - lib/appium_lib_core/common/base/bridge/mjsonwp.rb
265
- - lib/appium_lib_core/common/base/bridge/w3c.rb
266
259
  - lib/appium_lib_core/common/base/capabilities.rb
267
- - lib/appium_lib_core/common/base/command.rb
260
+ - lib/appium_lib_core/common/base/device_ime.rb
268
261
  - lib/appium_lib_core/common/base/driver.rb
262
+ - lib/appium_lib_core/common/base/driver_settings.rb
263
+ - lib/appium_lib_core/common/base/has_location.rb
264
+ - lib/appium_lib_core/common/base/has_network_connection.rb
269
265
  - lib/appium_lib_core/common/base/http_default.rb
270
266
  - lib/appium_lib_core/common/base/platform.rb
267
+ - lib/appium_lib_core/common/base/remote_status.rb
268
+ - lib/appium_lib_core/common/base/rotable.rb
271
269
  - lib/appium_lib_core/common/base/screenshot.rb
272
270
  - lib/appium_lib_core/common/base/search_context.rb
273
271
  - lib/appium_lib_core/common/command.rb
274
- - lib/appium_lib_core/common/command/common.rb
275
- - lib/appium_lib_core/common/command/mjsonwp.rb
276
- - lib/appium_lib_core/common/command/w3c.rb
277
272
  - lib/appium_lib_core/common/device/app_management.rb
278
273
  - lib/appium_lib_core/common/device/app_state.rb
279
274
  - lib/appium_lib_core/common/device/battery_status.rb
@@ -287,6 +282,7 @@ files:
287
282
  - lib/appium_lib_core/common/device/ime_actions.rb
288
283
  - lib/appium_lib_core/common/device/keyboard.rb
289
284
  - lib/appium_lib_core/common/device/keyevent.rb
285
+ - lib/appium_lib_core/common/device/orientation.rb
290
286
  - lib/appium_lib_core/common/device/screen_record.rb
291
287
  - lib/appium_lib_core/common/device/setting.rb
292
288
  - lib/appium_lib_core/common/device/touch_actions.rb
@@ -301,6 +297,7 @@ files:
301
297
  - lib/appium_lib_core/common/ws/websocket.rb
302
298
  - lib/appium_lib_core/device.rb
303
299
  - lib/appium_lib_core/driver.rb
300
+ - lib/appium_lib_core/element.rb
304
301
  - lib/appium_lib_core/ios.rb
305
302
  - lib/appium_lib_core/ios/device.rb
306
303
  - lib/appium_lib_core/ios/device/clipboard.rb
@@ -313,7 +310,10 @@ files:
313
310
  - lib/appium_lib_core/ios/xcuitest/device/performance.rb
314
311
  - lib/appium_lib_core/ios/xcuitest/device/screen.rb
315
312
  - lib/appium_lib_core/ios_xcuitest.rb
316
- - lib/appium_lib_core/patch.rb
313
+ - lib/appium_lib_core/mac2.rb
314
+ - lib/appium_lib_core/mac2/bridge.rb
315
+ - lib/appium_lib_core/mac2/device.rb
316
+ - lib/appium_lib_core/mac2/device/screen.rb
317
317
  - lib/appium_lib_core/version.rb
318
318
  - lib/appium_lib_core/windows.rb
319
319
  - lib/appium_lib_core/windows/bridge.rb
@@ -325,7 +325,7 @@ homepage: https://github.com/appium/ruby_lib_core/
325
325
  licenses:
326
326
  - Apache-2.0
327
327
  metadata: {}
328
- post_install_message:
328
+ post_install_message:
329
329
  rdoc_options: []
330
330
  require_paths:
331
331
  - lib
@@ -333,15 +333,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
333
333
  requirements:
334
334
  - - ">="
335
335
  - !ruby/object:Gem::Version
336
- version: '2.4'
336
+ version: '2.5'
337
337
  required_rubygems_version: !ruby/object:Gem::Requirement
338
338
  requirements:
339
- - - ">="
339
+ - - ">"
340
340
  - !ruby/object:Gem::Version
341
- version: '0'
341
+ version: 1.3.1
342
342
  requirements: []
343
- rubygems_version: 3.1.2
344
- signing_key:
343
+ rubygems_version: 3.2.15
344
+ signing_key:
345
345
  specification_version: 4
346
346
  summary: Minimal Ruby library for Appium.
347
347
  test_files: []
@@ -1,81 +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
- module Appium
16
- module Core
17
- class Base
18
- class Bridge
19
- class MJSONWP < ::Selenium::WebDriver::Remote::OSS::Bridge
20
- include Device::DeviceLock
21
- include Device::Keyboard
22
- include Device::ImeActions
23
- include Device::Setting
24
- include Device::Context
25
- include Device::Value
26
- include Device::FileManagement
27
- include Device::KeyEvent
28
- include Device::ImageComparison
29
- include Device::AppManagement
30
- include Device::AppState
31
- include Device::ScreenRecord::Command
32
- include Device::Device
33
- include Device::TouchActions
34
- include Device::ExecuteDriver
35
-
36
- def commands(command)
37
- ::Appium::Core::Commands::MJSONWP::COMMANDS[command]
38
- end
39
-
40
- # Returns all available sessions on the Appium server instance
41
- def sessions
42
- execute :get_all_sessions
43
- end
44
-
45
- # For Appium
46
- def log_event(vendor, event)
47
- execute :post_log_event, {}, { vendor: vendor, event: event }
48
- end
49
-
50
- # For Appium
51
- def log_events(type = nil)
52
- args = {}
53
- args['type'] = type unless type.nil?
54
-
55
- execute :get_log_events, {}, args
56
- end
57
-
58
- def take_element_screenshot(element)
59
- execute :take_element_screenshot, id: element.ref
60
- end
61
-
62
- def take_viewport_screenshot
63
- # TODO: this hasn't been supported by Espresso driver
64
- execute_script('mobile: viewportScreenshot')
65
- end
66
-
67
- def send_actions(_data)
68
- raise Error::UnsupportedOperationError, '#send_actions has not been supported in MJSONWP'
69
- end
70
-
71
- # For Appium
72
- # @param [Hash] id The id which can get as a response from server
73
- # @return [::Selenium::WebDriver::Element]
74
- def convert_to_element(id)
75
- ::Selenium::WebDriver::Element.new self, element_id_from(id)
76
- end
77
- end # class MJSONWP
78
- end # class Bridge
79
- end # class Base
80
- end # module Core
81
- end # module Appium
@@ -1,252 +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
- module Appium
16
- module Core
17
- class Base
18
- class Bridge
19
- class W3C < ::Selenium::WebDriver::Remote::W3C::Bridge
20
- include Device::DeviceLock
21
- include Device::Keyboard
22
- include Device::ImeActions
23
- include Device::Setting
24
- include Device::Context
25
- include Device::Value
26
- include Device::FileManagement
27
- include Device::KeyEvent
28
- include Device::ImageComparison
29
- include Device::AppManagement
30
- include Device::AppState
31
- include Device::ScreenRecord::Command
32
- include Device::Device
33
- include Device::TouchActions
34
- include Device::ExecuteDriver
35
-
36
- def commands(command)
37
- ::Appium::Core::Commands::W3C::COMMANDS[command]
38
- end
39
-
40
- # Returns all available sessions on the Appium server instance
41
- def sessions
42
- execute :get_all_sessions
43
- end
44
-
45
- # Perform touch actions for W3C module.
46
- # Generate +touch+ pointer action here and users can use this via +driver.action+
47
- # - https://seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/W3CActionBuilder.html
48
- # - https://seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/PointerActions.html
49
- # - https://seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/KeyActions.html
50
- #
51
- # 'mouse' action is by default in the Ruby client. Appium server force the +mouse+ action to +touch+ once in
52
- # the server side. So we don't consider the case.
53
- #
54
- # @example
55
- #
56
- # element = @driver.find_element(:id, "some id")
57
- # @driver.action.click(element).perform # The 'click' is a part of 'PointerActions'
58
- #
59
- def action(async = false)
60
- # Used for default duration of each touch actions
61
- # Override from 250 milliseconds to 50 milliseconds
62
- action_builder = super
63
- action_builder.default_move_duration = 0.05
64
- action_builder
65
- end
66
-
67
- # Port from MJSONWP
68
- def get_timeouts
69
- execute :get_timeouts
70
- end
71
-
72
- # Port from MJSONWP
73
- def session_capabilities
74
- ::Selenium::WebDriver::Remote::W3C::Capabilities.json_create execute(:get_capabilities)
75
- end
76
-
77
- # Port from MJSONWP
78
- def send_keys_to_active_element(key)
79
- text = ::Selenium::WebDriver::Keys.encode(key).join('')
80
- execute :send_keys_to_active_element, {}, { value: text.split(//) }
81
- end
82
-
83
- # For Appium
84
- # override
85
- def page_source
86
- # For W3C
87
- # execute_script('var source = document.documentElement.outerHTML;' \
88
- # 'if (!source) { source = new XMLSerializer().serializeToString(document); }' \
89
- # 'return source;')
90
- execute :get_page_source
91
- end
92
-
93
- # For Appium
94
- # override
95
- def element_displayed?(element)
96
- # For W3C
97
- # https://github.com/SeleniumHQ/selenium/commit/b618499adcc3a9f667590652c5757c0caa703289
98
- # execute_atom :isDisplayed, element
99
- execute :is_element_displayed, id: element.ref
100
- end
101
-
102
- # For Appium
103
- # override
104
- def element_attribute(element, name)
105
- # For W3C in Selenium Client
106
- # execute_atom :getAttribute, element, name
107
- execute :get_element_attribute, id: element.ref, name: name
108
- end
109
-
110
- # For Appium
111
- # override
112
- def find_element_by(how, what, parent = nil)
113
- how, what = convert_locators(how, what)
114
-
115
- id = if parent
116
- execute :find_child_element, { id: parent }, { using: how, value: what }
117
- else
118
- execute :find_element, {}, { using: how, value: what }
119
- end
120
- ::Selenium::WebDriver::Element.new self, element_id_from(id)
121
- end
122
-
123
- # For Appium
124
- # override
125
- def find_elements_by(how, what, parent = nil)
126
- how, what = convert_locators(how, what)
127
-
128
- ids = if parent
129
- execute :find_child_elements, { id: parent }, { using: how, value: what }
130
- else
131
- execute :find_elements, {}, { using: how, value: what }
132
- end
133
-
134
- ids.map { |id| ::Selenium::WebDriver::Element.new self, element_id_from(id) }
135
- end
136
-
137
- # For Appium
138
- # @param [Hash] id The id which can get as a response from server
139
- # @return [::Selenium::WebDriver::Element]
140
- def convert_to_element(id)
141
- ::Selenium::WebDriver::Element.new self, element_id_from(id)
142
- end
143
-
144
- # For Appium
145
- # override
146
- # called in 'extend DriverExtensions::HasNetworkConnection'
147
- def network_connection
148
- execute :get_network_connection
149
- end
150
-
151
- # For Appium
152
- # override
153
- # called in 'extend DriverExtensions::HasNetworkConnection'
154
- def network_connection=(type)
155
- execute :set_network_connection, {}, { parameters: { type: type } }
156
- end
157
-
158
- # For Appium
159
- # No implementation for W3C webdriver module
160
- # called in 'extend DriverExtensions::HasLocation'
161
- def location
162
- obj = execute(:get_location) || {}
163
- ::Selenium::WebDriver::Location.new obj['latitude'], obj['longitude'], obj['altitude']
164
- end
165
-
166
- # For Appium
167
- # No implementation for W3C webdriver module
168
- # called in +extend DriverExtensions::HasLocation+
169
- # It has below code as well. We should consider the same context in Selenium 4 as backward compatibility.
170
- #
171
- # def location=(loc)
172
- # # note: Location = Struct.new(:latitude, :longitude, :altitude)
173
- # raise TypeError, "expected #{Location}, got #{loc.inspect}:#{loc.class}" unless loc.is_a?(Location)
174
- #
175
- # @bridge.set_location loc.latitude, loc.longitude, loc.altitude
176
- # end
177
- #
178
- def set_location(lat, lon, alt = 0.0)
179
- loc = { latitude: lat, longitude: lon, altitude: alt }
180
- execute :set_location, {}, { location: loc }
181
- end
182
-
183
- #
184
- # logs
185
- #
186
- # For Appium
187
- # No implementation for W3C webdriver module
188
- def available_log_types
189
- types = execute :get_available_log_types
190
- Array(types).map(&:to_sym)
191
- end
192
-
193
- # For Appium
194
- # No implementation for W3C webdriver module
195
- def log(type)
196
- data = execute :get_log, {}, { type: type.to_s }
197
-
198
- Array(data).map do |l|
199
- begin
200
- ::Selenium::WebDriver::LogEntry.new l.fetch('level', 'UNKNOWN'), l.fetch('timestamp'), l.fetch('message')
201
- rescue KeyError
202
- next
203
- end
204
- end
205
- end
206
-
207
- # For Appium
208
- def log_event(vendor, event)
209
- execute :post_log_event, {}, { vendor: vendor, event: event }
210
- end
211
-
212
- # For Appium
213
- def log_events(type = nil)
214
- args = {}
215
- args['type'] = type unless type.nil?
216
-
217
- execute :get_log_events, {}, args
218
- end
219
-
220
- def take_viewport_screenshot
221
- execute_script('mobile: viewportScreenshot')
222
- end
223
-
224
- def take_element_screenshot(element)
225
- execute :take_element_screenshot, id: element.ref
226
- end
227
-
228
- private
229
-
230
- # Don't convert locators for Appium Client
231
- # TODO: Only for Appium. Ideally, we'd like to keep the selenium-webdriver
232
- def convert_locators(how, what)
233
- # case how
234
- # when 'class name'
235
- # how = 'css selector'
236
- # what = ".#{escape_css(what)}"
237
- # when 'id'
238
- # how = 'css selector'
239
- # what = "##{escape_css(what)}"
240
- # when 'name'
241
- # how = 'css selector'
242
- # what = "*[name='#{escape_css(what)}']"
243
- # when 'tag name'
244
- # how = 'css selector'
245
- # end
246
- [how, what]
247
- end
248
- end # class W3C
249
- end # class Bridge
250
- end # class Base
251
- end # module Core
252
- end # module Appium
@@ -1,110 +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
- 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
- # common
22
- get_all_sessions: [:get, 'sessions'],
23
- available_contexts: [:get, 'session/:session_id/contexts'],
24
- set_context: [:post, 'session/:session_id/context'],
25
- current_context: [:get, 'session/:session_id/context'],
26
-
27
- touch_actions: [:post, 'session/:session_id/touch/perform'],
28
- multi_touch: [:post, 'session/:session_id/touch/multi/perform'],
29
-
30
- set_immediate_value: [:post, 'session/:session_id/appium/element/:id/value'],
31
- replace_value: [:post, 'session/:session_id/appium/element/:id/replace_value'],
32
-
33
- launch_app: [:post, 'session/:session_id/appium/app/launch'],
34
- close_app: [:post, 'session/:session_id/appium/app/close'],
35
- reset: [:post, 'session/:session_id/appium/app/reset'],
36
- background_app: [:post, 'session/:session_id/appium/app/background'],
37
- app_strings: [:post, 'session/:session_id/appium/app/strings'],
38
-
39
- device_locked?: [:post, 'session/:session_id/appium/device/is_locked'],
40
- unlock: [:post, 'session/:session_id/appium/device/unlock'],
41
- lock: [:post, 'session/:session_id/appium/device/lock'],
42
- device_time: [:get, 'session/:session_id/appium/device/system_time'],
43
- install_app: [:post, 'session/:session_id/appium/device/install_app'],
44
- remove_app: [:post, 'session/:session_id/appium/device/remove_app'],
45
- app_installed?: [:post, 'session/:session_id/appium/device/app_installed'],
46
- activate_app: [:post, 'session/:session_id/appium/device/activate_app'],
47
- terminate_app: [:post, 'session/:session_id/appium/device/terminate_app'],
48
- app_state: [:post, 'session/:session_id/appium/device/app_state'],
49
- shake: [:post, 'session/:session_id/appium/device/shake'],
50
- hide_keyboard: [:post, 'session/:session_id/appium/device/hide_keyboard'],
51
- press_keycode: [:post, 'session/:session_id/appium/device/press_keycode'],
52
- long_press_keycode: [:post, 'session/:session_id/appium/device/long_press_keycode'],
53
- # keyevent is only for Selendroid
54
- keyevent: [:post, 'session/:session_id/appium/device/keyevent'],
55
- push_file: [:post, 'session/:session_id/appium/device/push_file'],
56
- pull_file: [:post, 'session/:session_id/appium/device/pull_file'],
57
- pull_folder: [:post, 'session/:session_id/appium/device/pull_folder'],
58
- get_clipboard: [:post, 'session/:session_id/appium/device/get_clipboard'],
59
- set_clipboard: [:post, 'session/:session_id/appium/device/set_clipboard'],
60
- finger_print: [:post, 'session/:session_id/appium/device/finger_print'],
61
- get_settings: [:get, 'session/:session_id/appium/settings'],
62
- update_settings: [:post, 'session/:session_id/appium/settings'],
63
- stop_recording_screen: [:post, 'session/:session_id/appium/stop_recording_screen'],
64
- start_recording_screen: [:post, 'session/:session_id/appium/start_recording_screen'],
65
- compare_images: [:post, 'session/:session_id/appium/compare_images'],
66
- is_keyboard_shown: [:get, 'session/:session_id/appium/device/is_keyboard_shown'],
67
- execute_driver: [:post, 'session/:session_id/appium/execute_driver'],
68
- post_log_event: [:post, 'session/:session_id/appium/log_event'],
69
- get_log_events: [:post, 'session/:session_id/appium/events']
70
- }.freeze
71
-
72
- COMMAND_ANDROID = {
73
- open_notifications: [:post, 'session/:session_id/appium/device/open_notifications'],
74
- toggle_airplane_mode: [:post, 'session/:session_id/appium/device/toggle_airplane_mode'],
75
- start_activity: [:post, 'session/:session_id/appium/device/start_activity'],
76
- current_activity: [:get, 'session/:session_id/appium/device/current_activity'],
77
- current_package: [:get, 'session/:session_id/appium/device/current_package'],
78
- get_system_bars: [:get, 'session/:session_id/appium/device/system_bars'],
79
- get_display_density: [:get, 'session/:session_id/appium/device/display_density'],
80
- toggle_wifi: [:post, 'session/:session_id/appium/device/toggle_wifi'],
81
- toggle_data: [:post, 'session/:session_id/appium/device/toggle_data'],
82
- toggle_location_services: [:post, 'session/:session_id/appium/device/toggle_location_services'],
83
- end_coverage: [:post, 'session/:session_id/appium/app/end_test_coverage'],
84
- get_performance_data_types: [:post, 'session/:session_id/appium/performanceData/types'],
85
- get_performance_data: [:post, 'session/:session_id/appium/getPerformanceData'],
86
- get_network_connection: [:get, 'session/:session_id/network_connection'], # defined also in OSS
87
- set_network_connection: [:post, 'session/:session_id/network_connection'], # defined also in OSS
88
-
89
- # only emulator
90
- send_sms: [:post, 'session/:session_id/appium/device/send_sms'],
91
- gsm_call: [:post, 'session/:session_id/appium/device/gsm_call'],
92
- gsm_signal: [:post, 'session/:session_id/appium/device/gsm_signal'],
93
- gsm_voice: [:post, 'session/:session_id/appium/device/gsm_voice'],
94
- set_network_speed: [:post, 'session/:session_id/appium/device/network_speed'],
95
- set_power_capacity: [:post, 'session/:session_id/appium/device/power_capacity'],
96
- set_power_ac: [:post, 'session/:session_id/appium/device/power_ac'],
97
-
98
- # For chromium: https://chromium.googlesource.com/chromium/src/+/master/chrome/test/chromedriver/server/http_handler.cc
99
- chrome_send_command: [:post, 'session/:session_id/goog/cdp/execute']
100
- }.freeze
101
-
102
- COMMAND_IOS = {
103
- touch_id: [:post, 'session/:session_id/appium/simulator/touch_id'],
104
- toggle_touch_id_enrollment: [:post, 'session/:session_id/appium/simulator/toggle_touch_id_enrollment']
105
- }.freeze
106
-
107
- COMMANDS = {}.merge(COMMAND).merge(COMMAND_ANDROID).merge(COMMAND_IOS).freeze
108
- end # module Commands
109
- end # module Core
110
- end # module Appium
@@ -1,56 +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
- module Appium
16
- module Core
17
- module Commands
18
- module W3C
19
- COMMANDS = ::Appium::Core::Commands::COMMANDS.merge(::Appium::Core::Base::Commands::W3C).merge(
20
- {
21
- # ::Appium::Core::Base::Commands::OSS has the following commands and Appium also use them.
22
- # Delegated to ::Appium::Core::Base::Commands::OSS commands
23
- status: [:get, 'status'], # https://w3c.github.io/webdriver/#dfn-status
24
- is_element_displayed: [:get, 'session/:session_id/element/:id/displayed'], # hint: https://w3c.github.io/webdriver/#element-displayedness
25
-
26
- get_timeouts: [:get, 'session/:session_id/timeouts'], # https://w3c.github.io/webdriver/#get-timeouts
27
-
28
- # Add OSS commands to W3C commands. We can remove them if we would like to remove them from W3C module.
29
- ### Session capability
30
- get_capabilities: [:get, 'session/:session_id'],
31
-
32
- ### rotatable
33
- get_screen_orientation: [:get, 'session/:session_id/orientation'],
34
- set_screen_orientation: [:post, 'session/:session_id/orientation'],
35
-
36
- get_location: [:get, 'session/:session_id/location'],
37
- set_location: [:post, 'session/:session_id/location'],
38
-
39
- ### For IME
40
- ime_get_available_engines: [:get, 'session/:session_id/ime/available_engines'],
41
- ime_get_active_engine: [:get, 'session/:session_id/ime/active_engine'],
42
- ime_is_activated: [:get, 'session/:session_id/ime/activated'],
43
- ime_deactivate: [:post, 'session/:session_id/ime/deactivate'],
44
- ime_activate_engine: [:post, 'session/:session_id/ime/activate'],
45
-
46
- send_keys_to_active_element: [:post, 'session/:session_id/keys'],
47
-
48
- ### Logs
49
- get_available_log_types: [:get, 'session/:session_id/log/types'],
50
- get_log: [:post, 'session/:session_id/log']
51
- }
52
- ).freeze
53
- end # module W3C
54
- end # module Commands
55
- end # module Core
56
- end # module Appium