appium_lib_core 5.0.0 → 6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +140 -0
  3. data/README.md +55 -10
  4. data/appium_lib_core.gemspec +5 -5
  5. data/lib/appium_lib_core/common/base/bridge.rb +54 -40
  6. data/lib/appium_lib_core/common/base/capabilities.rb +8 -16
  7. data/lib/appium_lib_core/common/base/driver.rb +68 -40
  8. data/lib/appium_lib_core/common/base/has_location.rb +10 -10
  9. data/lib/appium_lib_core/common/base/http_default.rb +1 -1
  10. data/lib/appium_lib_core/common/base/rotable.rb +11 -3
  11. data/lib/appium_lib_core/common/base/search_context.rb +1 -2
  12. data/lib/appium_lib_core/common/command.rb +4 -2
  13. data/lib/appium_lib_core/common/device/app_management.rb +8 -14
  14. data/lib/appium_lib_core/common/device/value.rb +1 -3
  15. data/lib/appium_lib_core/common/error.rb +0 -4
  16. data/lib/appium_lib_core/driver.rb +170 -62
  17. data/lib/appium_lib_core/support/event_firing_bridge.rb +57 -0
  18. data/lib/appium_lib_core/version.rb +2 -2
  19. data/lib/appium_lib_core/{ios/uiautomation/bridge.rb → windows/device/app_management.rb} +20 -12
  20. data/lib/appium_lib_core/windows/device.rb +2 -0
  21. data/lib/appium_lib_core.rb +19 -5
  22. metadata +21 -34
  23. data/.github/ISSUE_TEMPLATE/issue-report.md +0 -29
  24. data/.github/contributing.md +0 -26
  25. data/.github/dependabot.yml +0 -8
  26. data/.github/issue_template.md +0 -20
  27. data/.github/workflows/unittest.yml +0 -67
  28. data/.gitignore +0 -18
  29. data/.rubocop.yml +0 -146
  30. data/azure-pipelines.yml +0 -15
  31. data/ci-jobs/functional/android_setup.yml +0 -3
  32. data/ci-jobs/functional/ios_setup.yml +0 -7
  33. data/ci-jobs/functional/publish_test_result.yml +0 -18
  34. data/ci-jobs/functional/run_appium.yml +0 -25
  35. data/ci-jobs/functional/start-emulator.sh +0 -26
  36. data/ci-jobs/functional_test.yml +0 -298
  37. data/docs/mobile_command.md +0 -34
  38. data/lib/appium_lib_core/ios/uiautomation/device.rb +0 -44
  39. data/lib/appium_lib_core/ios/uiautomation/patch.rb +0 -34
  40. data/lib/appium_lib_core/ios.rb +0 -20
  41. data/release_notes.md +0 -932
  42. data/script/commands.rb +0 -166
data/script/commands.rb DELETED
@@ -1,166 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- require 'net/http'
16
- require './lib/appium_lib_core'
17
-
18
- module Script
19
- class CommandsChecker
20
- attr_reader :spec_commands,
21
- :implemented_w3c_commands, :implemented_core_commands,
22
- :webdriver_w3c_commands
23
-
24
- # Set commands implemented in this core library.
25
- #
26
- # - implemented_w3c_commands: All commands include ::Selenium::WebDriver::Remote::Bridge::COMMANDS
27
- # - implemented_core_commands: All commands except for selenium-webdriver's commands
28
- #
29
- def initialize
30
- @spec_commands = nil
31
-
32
- @implemented_core_commands = convert_driver_commands Appium::Core::Commands::COMMANDS
33
- end
34
-
35
- # Get the bellow url's file.
36
- # https://raw.githubusercontent.com/appium/appium-base-driver/master/lib/mjsonwp/routes.js?raw=1
37
- #
38
- # @param [String] to_path: A file path to routes.js
39
- # @return [String] The file path in which has saved `routes.js`.
40
- #
41
- def get_mjsonwp_routes(to_path = './mjsonwp_routes.js')
42
- uri = URI 'https://raw.githubusercontent.com/appium/appium-base-driver/master/lib/protocol/routes.js?raw=1'
43
- result = Net::HTTP.get uri
44
-
45
- File.delete to_path if File.exist? to_path
46
- File.write to_path, result
47
- to_path
48
- end
49
-
50
- # @private
51
- HTTP_METHOD_MATCH = /GET:|POST:|DELETE:|PUT:|PATCH:/.freeze
52
- # @private
53
- WD_HUB_PREFIX_MATCH = "'/wd/hub/"
54
-
55
- # Read routes.js and set the values in @spec_commands
56
- #
57
- # @param [String] path: A file path to routes.js
58
- # @return [Hash] @spec_commands
59
- #
60
- def get_all_command_path(path = './mjsonwp_routes.js')
61
- raise "No file in #{path}" unless File.exist? path
62
-
63
- current_command = ''
64
- @spec_commands = File.read(path).lines.each_with_object({}) do |line, memo|
65
- if line =~ /#{WD_HUB_PREFIX_MATCH}.+'/
66
- current_command = gsub_set(line.slice(/#{WD_HUB_PREFIX_MATCH}.+'/))
67
- memo[current_command] = []
68
- elsif line =~ HTTP_METHOD_MATCH
69
- memo[current_command] << line.slice(HTTP_METHOD_MATCH).chop.downcase.to_sym
70
- end
71
- memo
72
- end
73
- end
74
-
75
- # All commands which haven't been implemented in ruby core library yet.
76
- # @return [Hash]
77
- #
78
- def all_diff_commands_w3c
79
- result = compare_commands(@spec_commands, @implemented_w3c_commands)
80
- white_list.each { |v| result.delete v }
81
- mjsonwp_spec.each { |v| result.delete v }
82
- result
83
- end
84
-
85
- # Commands, only this core library, which haven't been implemented in ruby core library yet.
86
- # @return [Hash]
87
- #
88
- def diff_except_for_webdriver
89
- result = compare_commands(@spec_commands, @implemented_core_commands)
90
- white_list.each { |v| result.delete v }
91
- result
92
- end
93
-
94
- def compare_commands(command1, with_command2)
95
- return {} if command1.nil?
96
- return command1 if with_command2.nil?
97
-
98
- result = {}
99
- command1.each_key do |key|
100
- if with_command2.key? key
101
- diff = command1[key] - with_command2[key]
102
- result[key] = diff unless diff.empty?
103
- else
104
- result[key] = command1[key]
105
- end
106
- end
107
- result
108
- end
109
-
110
- private
111
-
112
- # rubocop:disable Lint/PercentStringArray
113
- def white_list
114
- %w(
115
- '/wd/hub/session'
116
- '/wd/hub/sessions'
117
- ).map { |v| gsub_set(v) }
118
- end
119
-
120
- # https://raw.githubusercontent.com/appium/appium-base-driver/master/lib/mjsonwp/routes.js
121
- def mjsonwp_spec
122
- %w(
123
- '/wd/hub/session/:sessionId/alert_text'
124
- '/wd/hub/session/:sessionId/accept_alert'
125
- '/wd/hub/session/:sessionId/dismiss_alert'
126
- ).map { |v| gsub_set(v) }
127
- end
128
-
129
- def w3c_spec
130
- %w(
131
- '/wd/hub/session/:sessionId/alert/text'
132
- '/wd/hub/session/:sessionId/alert/accept'
133
- '/wd/hub/session/:sessionId/alert/dismiss'
134
- '/wd/hub/session/:sessionId/element/:elementId/rect'
135
- ).map { |v| gsub_set(v) }
136
- end
137
- # rubocop:enable Lint/PercentStringArray
138
-
139
- def gsub_set(line)
140
- return nil if line.gsub(/(\A#{WD_HUB_PREFIX_MATCH}|'\z)/, '').nil?
141
-
142
- line.gsub(/(\A#{WD_HUB_PREFIX_MATCH}|'\z)/, '')
143
- .sub(':sessionId', ':session_id')
144
- .sub('element/:elementId', 'element/:id')
145
- .sub(':windowhandle', ':window_handle')
146
- .sub('equals/:otherId', 'equals/:other')
147
- .sub('css/:propertyName', 'css/:property_name')
148
- .sub('element/:id/pageIndex', 'element/:id/page_index')
149
- end
150
-
151
- def convert_driver_commands(from)
152
- from.each_with_object({}) do |command, memo|
153
- method = command[1][0]
154
- key = command[1][1]
155
-
156
- if memo[key]
157
- memo[key] << method
158
- else
159
- memo[key] = [method]
160
- end
161
-
162
- memo
163
- end
164
- end
165
- end
166
- end