appium_lib_core 4.1.0 → 5.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +172 -274
- data/README.md +13 -8
- data/Rakefile +4 -0
- data/appium_lib_core.gemspec +5 -8
- data/bin/console +0 -4
- data/lib/appium_lib_core/android/device/auth_finger_print.rb +2 -1
- data/lib/appium_lib_core/android/device.rb +4 -4
- data/lib/appium_lib_core/common/base/bridge.rb +291 -92
- data/lib/appium_lib_core/common/base/capabilities.rb +8 -9
- data/lib/appium_lib_core/common/base/device_ime.rb +49 -0
- data/lib/appium_lib_core/common/base/driver.rb +225 -187
- data/lib/appium_lib_core/common/base/driver_settings.rb +51 -0
- data/lib/appium_lib_core/common/base/has_location.rb +80 -0
- data/lib/appium_lib_core/common/base/has_network_connection.rb +56 -0
- data/lib/appium_lib_core/common/base/http_default.rb +1 -3
- data/lib/appium_lib_core/common/base/remote_status.rb +31 -0
- data/lib/appium_lib_core/common/base/rotable.rb +54 -0
- data/lib/appium_lib_core/common/base/screenshot.rb +6 -6
- data/lib/appium_lib_core/common/base/search_context.rb +20 -5
- data/lib/appium_lib_core/common/base.rb +1 -3
- data/lib/appium_lib_core/common/command.rb +255 -4
- data/lib/appium_lib_core/common/device/app_management.rb +2 -14
- data/lib/appium_lib_core/common/device/image_comparison.rb +12 -4
- data/lib/appium_lib_core/common/device/keyevent.rb +4 -4
- data/lib/appium_lib_core/common/{command/mjsonwp.rb → device/orientation.rb} +14 -11
- data/lib/appium_lib_core/common/device/touch_actions.rb +2 -0
- data/lib/appium_lib_core/common/device/value.rb +6 -6
- data/lib/appium_lib_core/common/error.rb +4 -5
- data/lib/appium_lib_core/common/log.rb +4 -1
- data/lib/appium_lib_core/common/touch_action/multi_touch.rb +19 -0
- data/lib/appium_lib_core/common/touch_action/touch_actions.rb +16 -2
- data/lib/appium_lib_core/common/wait.rb +38 -6
- data/lib/appium_lib_core/device.rb +1 -5
- data/lib/appium_lib_core/driver.rb +68 -82
- data/lib/appium_lib_core/{patch.rb → element.rb} +66 -9
- data/lib/appium_lib_core/ios/uiautomation/patch.rb +1 -1
- data/lib/appium_lib_core/{common/base/command.rb → mac2/bridge.rb} +9 -8
- data/lib/appium_lib_core/mac2/device/screen.rb +48 -0
- data/lib/appium_lib_core/mac2/device.rb +92 -0
- data/lib/appium_lib_core/mac2.rb +17 -0
- data/lib/appium_lib_core/version.rb +2 -2
- data/lib/appium_lib_core.rb +20 -10
- metadata +26 -79
- data/.github/ISSUE_TEMPLATE/issue-report.md +0 -29
- data/.github/contributing.md +0 -26
- data/.github/issue_template.md +0 -20
- data/.github/workflows/unittest.yml +0 -68
- data/.gitignore +0 -18
- data/.rubocop.yml +0 -58
- data/azure-pipelines.yml +0 -15
- data/ci-jobs/functional/android_setup.yml +0 -3
- data/ci-jobs/functional/ios_setup.yml +0 -7
- data/ci-jobs/functional/publish_test_result.yml +0 -18
- data/ci-jobs/functional/run_appium.yml +0 -25
- data/ci-jobs/functional/start-emulator.sh +0 -26
- data/ci-jobs/functional_test.yml +0 -298
- data/docs/mobile_command.md +0 -34
- data/lib/appium_lib_core/common/base/bridge/mjsonwp.rb +0 -81
- data/lib/appium_lib_core/common/base/bridge/w3c.rb +0 -252
- data/lib/appium_lib_core/common/command/common.rb +0 -110
- data/lib/appium_lib_core/common/command/w3c.rb +0 -56
- data/release_notes.md +0 -816
- data/script/commands.rb +0 -200
data/script/commands.rb
DELETED
@@ -1,200 +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_mjsonwp_commands, :implemented_w3c_commands, :implemented_core_commands,
|
22
|
-
:webdriver_oss_commands, :webdriver_w3c_commands
|
23
|
-
|
24
|
-
# Set commands implemented in this core library.
|
25
|
-
#
|
26
|
-
# - implemented_mjsonwp_commands: All commands include ::Selenium::WebDriver::Remote::OSS::Bridge::COMMANDS
|
27
|
-
# - implemented_w3c_commands: All commands include ::Selenium::WebDriver::Remote::W3C::Bridge::COMMANDS
|
28
|
-
# - implemented_core_commands: All commands except for selenium-webdriver's commands
|
29
|
-
# - webdriver_oss_commands: ::Selenium::WebDriver::Remote::OSS::Bridge::COMMANDS
|
30
|
-
# - webdriver_w3c_commands: ::Selenium::WebDriver::Remote::W3C::Bridge::COMMANDS
|
31
|
-
#
|
32
|
-
def initialize
|
33
|
-
@spec_commands = nil
|
34
|
-
|
35
|
-
@implemented_mjsonwp_commands = convert_driver_commands Appium::Core::Commands::MJSONWP::COMMANDS
|
36
|
-
@implemented_w3c_commands = convert_driver_commands Appium::Core::Commands::W3C::COMMANDS
|
37
|
-
@implemented_core_commands = convert_driver_commands Appium::Core::Commands::COMMANDS
|
38
|
-
|
39
|
-
@webdriver_oss_commands = convert_driver_commands Appium::Core::Base::Commands::OSS
|
40
|
-
@webdriver_w3c_commands = convert_driver_commands Appium::Core::Base::Commands::W3C
|
41
|
-
end
|
42
|
-
|
43
|
-
# Get the bellow url's file.
|
44
|
-
# https://raw.githubusercontent.com/appium/appium-base-driver/master/lib/mjsonwp/routes.js?raw=1
|
45
|
-
#
|
46
|
-
# @param [String] to_path: A file path to routes.js
|
47
|
-
# @return [String] The file path in which has saved `routes.js`.
|
48
|
-
#
|
49
|
-
def get_mjsonwp_routes(to_path = './mjsonwp_routes.js')
|
50
|
-
uri = URI 'https://raw.githubusercontent.com/appium/appium-base-driver/master/lib/protocol/routes.js?raw=1'
|
51
|
-
result = Net::HTTP.get uri
|
52
|
-
|
53
|
-
File.delete to_path if File.exist? to_path
|
54
|
-
File.write to_path, result
|
55
|
-
to_path
|
56
|
-
end
|
57
|
-
|
58
|
-
# @private
|
59
|
-
HTTP_METHOD_MATCH = /GET:|POST:|DELETE:|PUT:|PATCH:/.freeze
|
60
|
-
# @private
|
61
|
-
WD_HUB_PREFIX_MATCH = "'/wd/hub/"
|
62
|
-
|
63
|
-
# Read routes.js and set the values in @spec_commands
|
64
|
-
#
|
65
|
-
# @param [String] path: A file path to routes.js
|
66
|
-
# @return [Hash] @spec_commands
|
67
|
-
#
|
68
|
-
def get_all_command_path(path = './mjsonwp_routes.js')
|
69
|
-
raise "No file in #{path}" unless File.exist? path
|
70
|
-
|
71
|
-
current_command = ''
|
72
|
-
@spec_commands = File.read(path).lines.each_with_object({}) do |line, memo|
|
73
|
-
if line =~ /#{WD_HUB_PREFIX_MATCH}.+'/
|
74
|
-
current_command = gsub_set(line.slice(/#{WD_HUB_PREFIX_MATCH}.+'/))
|
75
|
-
memo[current_command] = []
|
76
|
-
elsif line =~ HTTP_METHOD_MATCH
|
77
|
-
memo[current_command] << line.slice(HTTP_METHOD_MATCH).chop.downcase.to_sym
|
78
|
-
end
|
79
|
-
memo
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
# All commands which haven't been implemented in ruby core library yet.
|
84
|
-
# @return [Hash]
|
85
|
-
#
|
86
|
-
def all_diff_commands_mjsonwp
|
87
|
-
result = compare_commands(@spec_commands, @implemented_mjsonwp_commands)
|
88
|
-
|
89
|
-
white_list.each { |v| result.delete v }
|
90
|
-
w3c_spec.each { |v| result.delete v }
|
91
|
-
|
92
|
-
result
|
93
|
-
end
|
94
|
-
|
95
|
-
# All commands which haven't been implemented in ruby core library yet.
|
96
|
-
# @return [Hash]
|
97
|
-
#
|
98
|
-
def all_diff_commands_w3c
|
99
|
-
result = compare_commands(@spec_commands, @implemented_w3c_commands)
|
100
|
-
white_list.each { |v| result.delete v }
|
101
|
-
mjsonwp_spec.each { |v| result.delete v }
|
102
|
-
result
|
103
|
-
end
|
104
|
-
|
105
|
-
# Commands, only this core library, which haven't been implemented in ruby core library yet.
|
106
|
-
# @return [Hash]
|
107
|
-
#
|
108
|
-
def diff_except_for_webdriver
|
109
|
-
result = compare_commands(@spec_commands, @implemented_core_commands)
|
110
|
-
white_list.each { |v| result.delete v }
|
111
|
-
result
|
112
|
-
end
|
113
|
-
|
114
|
-
def diff_webdriver_oss
|
115
|
-
result = compare_commands(@spec_commands, @webdriver_oss_commands)
|
116
|
-
white_list.each { |v| result.delete v }
|
117
|
-
w3c_spec.each { |v| result.delete v }
|
118
|
-
result
|
119
|
-
end
|
120
|
-
|
121
|
-
def diff_webdriver_w3c
|
122
|
-
result = compare_commands(@spec_commands, @webdriver_w3c_commands)
|
123
|
-
white_list.each { |v| result.delete v }
|
124
|
-
mjsonwp_spec.each { |v| result.delete v }
|
125
|
-
result
|
126
|
-
end
|
127
|
-
|
128
|
-
def compare_commands(command1, with_command2)
|
129
|
-
return {} if command1.nil?
|
130
|
-
return command1 if with_command2.nil?
|
131
|
-
|
132
|
-
result = {}
|
133
|
-
command1.each_key do |key|
|
134
|
-
if with_command2.key? key
|
135
|
-
diff = command1[key] - with_command2[key]
|
136
|
-
result[key] = diff unless diff.empty?
|
137
|
-
else
|
138
|
-
result[key] = command1[key]
|
139
|
-
end
|
140
|
-
end
|
141
|
-
result
|
142
|
-
end
|
143
|
-
|
144
|
-
private
|
145
|
-
|
146
|
-
# rubocop:disable Lint/PercentStringArray
|
147
|
-
def white_list
|
148
|
-
%w(
|
149
|
-
'/wd/hub/session'
|
150
|
-
'/wd/hub/sessions'
|
151
|
-
).map { |v| gsub_set(v) }
|
152
|
-
end
|
153
|
-
|
154
|
-
# https://raw.githubusercontent.com/appium/appium-base-driver/master/lib/mjsonwp/routes.js
|
155
|
-
def mjsonwp_spec
|
156
|
-
%w(
|
157
|
-
'/wd/hub/session/:sessionId/alert_text'
|
158
|
-
'/wd/hub/session/:sessionId/accept_alert'
|
159
|
-
'/wd/hub/session/:sessionId/dismiss_alert'
|
160
|
-
).map { |v| gsub_set(v) }
|
161
|
-
end
|
162
|
-
|
163
|
-
def w3c_spec
|
164
|
-
%w(
|
165
|
-
'/wd/hub/session/:sessionId/alert/text'
|
166
|
-
'/wd/hub/session/:sessionId/alert/accept'
|
167
|
-
'/wd/hub/session/:sessionId/alert/dismiss'
|
168
|
-
'/wd/hub/session/:sessionId/element/:elementId/rect'
|
169
|
-
).map { |v| gsub_set(v) }
|
170
|
-
end
|
171
|
-
# rubocop:enable Lint/PercentStringArray
|
172
|
-
|
173
|
-
def gsub_set(line)
|
174
|
-
return nil if line.gsub(/(\A#{WD_HUB_PREFIX_MATCH}|'\z)/, '').nil?
|
175
|
-
|
176
|
-
line.gsub(/(\A#{WD_HUB_PREFIX_MATCH}|'\z)/, '')
|
177
|
-
.sub(':sessionId', ':session_id')
|
178
|
-
.sub('element/:elementId', 'element/:id')
|
179
|
-
.sub(':windowhandle', ':window_handle')
|
180
|
-
.sub('equals/:otherId', 'equals/:other')
|
181
|
-
.sub('css/:propertyName', 'css/:property_name')
|
182
|
-
.sub('element/:id/pageIndex', 'element/:id/page_index')
|
183
|
-
end
|
184
|
-
|
185
|
-
def convert_driver_commands(from)
|
186
|
-
from.each_with_object({}) do |command, memo|
|
187
|
-
method = command[1][0]
|
188
|
-
key = command[1][1]
|
189
|
-
|
190
|
-
if memo[key]
|
191
|
-
memo[key] << method
|
192
|
-
else
|
193
|
-
memo[key] = [method]
|
194
|
-
end
|
195
|
-
|
196
|
-
memo
|
197
|
-
end
|
198
|
-
end
|
199
|
-
end
|
200
|
-
end
|