appium_lib_core 3.11.1 → 4.2.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.
- checksums.yaml +4 -4
- data/.github/workflows/unittest.yml +2 -2
- data/.rubocop.yml +20 -10
- data/CHANGELOG.md +27 -268
- data/README.md +1 -1
- data/appium_lib_core.gemspec +3 -3
- data/ci-jobs/functional/ios_setup.yml +2 -0
- data/ci-jobs/functional/run_appium.yml +1 -1
- data/ci-jobs/functional_test.yml +2 -2
- data/lib/appium_lib_core.rb +5 -5
- data/lib/appium_lib_core/android/device.rb +5 -5
- data/lib/appium_lib_core/common/base.rb +1 -0
- data/lib/appium_lib_core/common/base/bridge.rb +10 -36
- data/lib/appium_lib_core/common/base/bridge/w3c.rb +1 -0
- data/lib/appium_lib_core/common/base/driver.rb +6 -4
- data/lib/appium_lib_core/common/base/http_default.rb +2 -1
- data/lib/appium_lib_core/common/base/rotable.rb +54 -0
- data/lib/appium_lib_core/common/base/screenshot.rb +1 -1
- data/lib/appium_lib_core/common/base/search_context.rb +2 -4
- data/lib/appium_lib_core/common/command/common.rb +0 -2
- data/lib/appium_lib_core/common/command/mjsonwp.rb +0 -2
- data/lib/appium_lib_core/common/command/w3c.rb +0 -2
- data/lib/appium_lib_core/common/device/app_management.rb +1 -1
- data/lib/appium_lib_core/common/device/orientation.rb +31 -0
- data/lib/appium_lib_core/common/touch_action/multi_touch.rb +2 -2
- data/lib/appium_lib_core/common/touch_action/touch_actions.rb +3 -3
- data/lib/appium_lib_core/common/wait.rb +2 -2
- data/lib/appium_lib_core/driver.rb +2 -0
- data/lib/appium_lib_core/ios/xcuitest/device.rb +2 -2
- data/lib/appium_lib_core/patch.rb +53 -0
- data/lib/appium_lib_core/version.rb +2 -2
- data/lib/appium_lib_core/windows/device.rb +2 -2
- data/release_notes.md +42 -0
- data/script/commands.rb +3 -3
- metadata +9 -7
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[](https://badge.fury.io/rb/appium_lib_core)
|
4
4
|
|
5
|
-
[](https://dev.azure.com/AppiumCI/Appium%20CI/_build/latest?definitionId=54&branchName=master)
|
6
6
|
|
7
7
|
This library is a Ruby client for Appium. The gem is available via [appium_lib_core](https://rubygems.org/gems/appium_lib_core).
|
8
8
|
|
data/appium_lib_core.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'appium_lib_core/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.required_ruby_version = '>= 2.
|
7
|
+
spec.required_ruby_version = '>= 2.4'
|
8
8
|
|
9
9
|
spec.name = 'appium_lib_core'
|
10
10
|
spec.version = Appium::Core::VERSION
|
@@ -30,8 +30,8 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_development_dependency 'yard', '~> 0.9.11'
|
31
31
|
spec.add_development_dependency 'minitest', '~> 5.0'
|
32
32
|
spec.add_development_dependency 'minitest-reporters', '~> 1.1'
|
33
|
-
spec.add_development_dependency 'webmock', '~> 3.
|
34
|
-
spec.add_development_dependency 'rubocop', '
|
33
|
+
spec.add_development_dependency 'webmock', '~> 3.11.0'
|
34
|
+
spec.add_development_dependency 'rubocop', '1.8.0'
|
35
35
|
spec.add_development_dependency 'appium_thor', '~> 1.0'
|
36
36
|
spec.add_development_dependency 'pry'
|
37
37
|
spec.add_development_dependency 'pry-byebug'
|
@@ -3,3 +3,5 @@ steps:
|
|
3
3
|
displayName: Xcode Select ${{ parameters.xcodeVersion }}
|
4
4
|
- script: xcrun simctl list
|
5
5
|
displayName: List Installed Simulators
|
6
|
+
- script: defaults write com.apple.iphonesimulator PasteboardAutomaticSync -bool false
|
7
|
+
displayName: Disable pasteboard automatic sync
|
@@ -11,7 +11,7 @@ steps:
|
|
11
11
|
displayName: Installed node dependencies
|
12
12
|
- task: UseRubyVersion@0
|
13
13
|
inputs:
|
14
|
-
versionSpec: '2.
|
14
|
+
versionSpec: '2.7'
|
15
15
|
- script: |
|
16
16
|
mkdir -p test/report
|
17
17
|
nohup appium --relaxed-security --log-timestamp --log-no-colors > test/report/appium.out 2>&1 &
|
data/ci-jobs/functional_test.yml
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
parameters:
|
3
3
|
vmImage: 'macOS-10.15'
|
4
4
|
vmImageForIOS: 'macOS-10.15' # Not sure the reason, but macOS 10.14 instance raises no info.plist error
|
5
|
-
xcodeForIOS:
|
6
|
-
xcodeForTVOS:
|
5
|
+
xcodeForIOS: 12.2
|
6
|
+
xcodeForTVOS: 12.2
|
7
7
|
androidSDK: 30
|
8
8
|
appiumVersion: 'beta'
|
9
9
|
ignoreVersionSkip: true
|
data/lib/appium_lib_core.rb
CHANGED
@@ -34,11 +34,11 @@ module Appium
|
|
34
34
|
|
35
35
|
hash.each_with_object({}) do |pair, acc|
|
36
36
|
key = begin
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
pair[0].to_sym
|
38
|
+
rescue StandardError => e
|
39
|
+
::Appium::Logger.warn(e.message)
|
40
|
+
pair[0]
|
41
|
+
end
|
42
42
|
|
43
43
|
value = pair[1]
|
44
44
|
acc[key] = value.is_a?(Hash) ? symbolize_keys(value) : value
|
@@ -25,7 +25,7 @@ module Appium
|
|
25
25
|
module Device
|
26
26
|
extend Forwardable
|
27
27
|
|
28
|
-
# rubocop:disable
|
28
|
+
# rubocop:disable Layout/LineLength
|
29
29
|
|
30
30
|
# @!method open_notifications
|
31
31
|
# Open Android notifications
|
@@ -290,16 +290,16 @@ module Appium
|
|
290
290
|
# @driver.finger_print 1
|
291
291
|
#
|
292
292
|
|
293
|
-
# @!method execute_cdp(cmd, params)
|
293
|
+
# @!method execute_cdp(cmd, **params)
|
294
294
|
# Execute Chrome Devtools protocol commands
|
295
295
|
# https://chromedevtools.github.io/devtools-protocol
|
296
296
|
#
|
297
297
|
# @param [String] cmd The name of command
|
298
|
-
# @
|
298
|
+
# @option params The parameter for the command as keyword options.
|
299
299
|
#
|
300
300
|
# @example
|
301
301
|
#
|
302
|
-
# @driver.execute_cdp 'Page.captureScreenshot',
|
302
|
+
# @driver.execute_cdp 'Page.captureScreenshot', quality: 50, format: 'jpeg'
|
303
303
|
# @driver.execute_cdp 'Page.getResourceTree'
|
304
304
|
#
|
305
305
|
|
@@ -307,7 +307,7 @@ module Appium
|
|
307
307
|
## class << self
|
308
308
|
####
|
309
309
|
|
310
|
-
# rubocop:enable
|
310
|
+
# rubocop:enable Layout/LineLength
|
311
311
|
|
312
312
|
class << self
|
313
313
|
def extended(_mod)
|
@@ -29,6 +29,7 @@ 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'
|
@@ -60,9 +60,6 @@ module Appium
|
|
60
60
|
# Creates session handling both OSS and W3C dialects.
|
61
61
|
# Copy from Selenium::WebDriver::Remote::Bridge to keep using +merged_capabilities+ for Appium
|
62
62
|
#
|
63
|
-
# If +desired_capabilities+ has +forceMjsonwp: true+ in the capability, this bridge works with mjsonwp protocol.
|
64
|
-
# If +forceMjsonwp: false+ or no the capability, it depends on server side whether this bridge works as w3c or mjsonwp.
|
65
|
-
#
|
66
63
|
# @param [::Selenium::WebDriver::Remote::W3C::Capabilities, Hash] desired_capabilities A capability
|
67
64
|
# @return [::Selenium::WebDriver::Remote::Capabilities, ::Selenium::WebDriver::Remote::W3C::Capabilities]
|
68
65
|
#
|
@@ -76,25 +73,6 @@ module Appium
|
|
76
73
|
# platformVersion: '11.4',
|
77
74
|
# deviceName: 'iPhone Simulator',
|
78
75
|
# useNewWDA: true,
|
79
|
-
# forceMjsonwp: true
|
80
|
-
# },
|
81
|
-
# appium_lib: {
|
82
|
-
# wait: 30
|
83
|
-
# }
|
84
|
-
# }
|
85
|
-
# core = ::Appium::Core.for(caps)
|
86
|
-
# driver = core.start_driver #=> driver.dialect == :oss
|
87
|
-
#
|
88
|
-
# @example
|
89
|
-
#
|
90
|
-
# opts = {
|
91
|
-
# caps: {
|
92
|
-
# platformName: :ios,
|
93
|
-
# automationName: 'XCUITest',
|
94
|
-
# app: 'test/functional/app/UICatalog.app.zip',
|
95
|
-
# platformVersion: '11.4',
|
96
|
-
# deviceName: 'iPhone Simulator',
|
97
|
-
# useNewWDA: true,
|
98
76
|
# },
|
99
77
|
# appium_lib: {
|
100
78
|
# wait: 30
|
@@ -194,21 +172,17 @@ module Appium
|
|
194
172
|
force_mjsonwp = desired_capabilities[FORCE_MJSONWP]
|
195
173
|
desired_capabilities = delete_force_mjsonwp(desired_capabilities) unless force_mjsonwp.nil?
|
196
174
|
|
197
|
-
if force_mjsonwp
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
desiredCapabilities: desired_capabilities,
|
207
|
-
capabilities: {
|
208
|
-
firstMatch: [w3c_capabilities]
|
209
|
-
}
|
175
|
+
::Appium::Logger.warn "'forceMjsonwp' no longer works. Sending both W3C and MJSONWP capabilities" if force_mjsonwp
|
176
|
+
|
177
|
+
new_caps = add_appium_prefix(desired_capabilities)
|
178
|
+
w3c_capabilities = ::Selenium::WebDriver::Remote::W3C::Capabilities.from_oss(new_caps)
|
179
|
+
|
180
|
+
{
|
181
|
+
desiredCapabilities: desired_capabilities,
|
182
|
+
capabilities: {
|
183
|
+
firstMatch: [w3c_capabilities]
|
210
184
|
}
|
211
|
-
|
185
|
+
}
|
212
186
|
end
|
213
187
|
end # class Bridge
|
214
188
|
end # class Base
|
@@ -15,6 +15,7 @@
|
|
15
15
|
require 'base64'
|
16
16
|
require_relative 'search_context'
|
17
17
|
require_relative 'screenshot'
|
18
|
+
require_relative 'rotable'
|
18
19
|
|
19
20
|
module Appium
|
20
21
|
module Core
|
@@ -22,12 +23,12 @@ module Appium
|
|
22
23
|
class Driver < ::Selenium::WebDriver::Driver
|
23
24
|
include ::Selenium::WebDriver::DriverExtensions::UploadsFiles
|
24
25
|
include ::Selenium::WebDriver::DriverExtensions::HasSessionId
|
25
|
-
include ::Selenium::WebDriver::DriverExtensions::Rotatable
|
26
26
|
include ::Selenium::WebDriver::DriverExtensions::HasRemoteStatus
|
27
27
|
include ::Selenium::WebDriver::DriverExtensions::HasWebStorage
|
28
28
|
|
29
|
+
include ::Appium::Core::Base::Rotatable
|
29
30
|
include ::Appium::Core::Base::SearchContext
|
30
|
-
include ::Appium::Core::Base::
|
31
|
+
include ::Appium::Core::Base::TakesScreenshot
|
31
32
|
|
32
33
|
# Private API.
|
33
34
|
# Do not use this for general use. Used by flutter driver to get bridge for creating a new element
|
@@ -311,6 +312,7 @@ module Appium
|
|
311
312
|
|
312
313
|
# Perform a block within the given context, then switch back to the starting context.
|
313
314
|
# @param [String] context The context to switch to for the duration of the block.
|
315
|
+
# @param [Proc] block The block to involve within the context
|
314
316
|
#
|
315
317
|
# @example
|
316
318
|
#
|
@@ -318,8 +320,8 @@ module Appium
|
|
318
320
|
# @driver.find_element :tag, "button"
|
319
321
|
# end # The result of 'find_element :tag, "button"'
|
320
322
|
#
|
321
|
-
def within_context(context)
|
322
|
-
block_given? ? @bridge.within_context(context, &
|
323
|
+
def within_context(context, &block)
|
324
|
+
block_given? ? @bridge.within_context(context, &block) : @bridge.within_context(context)
|
323
325
|
end
|
324
326
|
|
325
327
|
# Change to the default context. This is equivalent to +set_context nil+.
|
@@ -36,7 +36,8 @@ module Appium
|
|
36
36
|
|
37
37
|
attr_reader :additional_headers
|
38
38
|
|
39
|
-
|
39
|
+
# override
|
40
|
+
def initialize(open_timeout: nil, read_timeout: nil) # rubocop:disable Lint/MissingSuper
|
40
41
|
@open_timeout = open_timeout
|
41
42
|
@read_timeout = read_timeout
|
42
43
|
@additional_headers = {}
|
@@ -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 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
|
@@ -18,7 +18,6 @@ module Appium
|
|
18
18
|
module SearchContext
|
19
19
|
# referenced: ::Selenium::WebDriver::SearchContext
|
20
20
|
|
21
|
-
# rubocop:disable Layout/AlignHash
|
22
21
|
FINDERS = ::Selenium::WebDriver::SearchContext::FINDERS.merge(
|
23
22
|
accessibility_id: 'accessibility id',
|
24
23
|
image: '-image',
|
@@ -37,9 +36,8 @@ module Appium
|
|
37
36
|
# Tizen with Tizen prefix
|
38
37
|
tizen_uiautomation: '-tizen uiautomation'
|
39
38
|
)
|
40
|
-
# rubocop:enable Layout/AlignHash
|
41
39
|
|
42
|
-
# rubocop:disable
|
40
|
+
# rubocop:disable Layout/LineLength
|
43
41
|
#
|
44
42
|
# Find the first element matching the given arguments
|
45
43
|
#
|
@@ -129,7 +127,7 @@ module Appium
|
|
129
127
|
# # For Tizen
|
130
128
|
# @driver.find_elements :tizen_uiautomation, '....'
|
131
129
|
#
|
132
|
-
# rubocop:enable
|
130
|
+
# rubocop:enable Layout/LineLength
|
133
131
|
def find_element(*args)
|
134
132
|
how, what = extract_args(args)
|
135
133
|
by = _set_by_from_finders(how)
|
@@ -12,7 +12,6 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
# rubocop:disable Layout/AlignHash
|
16
15
|
module Appium
|
17
16
|
module Core
|
18
17
|
# ref: https://github.com/appium/appium-base-driver/blob/master/lib/mjsonwp/routes.js
|
@@ -109,4 +108,3 @@ module Appium
|
|
109
108
|
end # module Commands
|
110
109
|
end # module Core
|
111
110
|
end # module Appium
|
112
|
-
# rubocop:enable Layout/AlignHash
|
@@ -12,7 +12,6 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
# rubocop:disable Layout/AlignHash
|
16
15
|
module Appium
|
17
16
|
module Core
|
18
17
|
module Commands
|
@@ -27,4 +26,3 @@ module Appium
|
|
27
26
|
end # module Commands
|
28
27
|
end # module Core
|
29
28
|
end # Appium
|
30
|
-
# rubocop:enable Layout/AlignHash
|
@@ -12,7 +12,6 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
# rubocop:disable Layout/AlignHash
|
16
15
|
module Appium
|
17
16
|
module Core
|
18
17
|
module Commands
|
@@ -55,4 +54,3 @@ module Appium
|
|
55
54
|
end # module Commands
|
56
55
|
end # module Core
|
57
56
|
end # module Appium
|
58
|
-
# rubocop:enable Layout/AlignHash
|
@@ -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
|
+
module Device
|
19
|
+
module Orientation
|
20
|
+
def screen_orientation=(orientation)
|
21
|
+
execute :set_screen_orientation, {}, { orientation: orientation }
|
22
|
+
end
|
23
|
+
|
24
|
+
def screen_orientation
|
25
|
+
execute :get_screen_orientation
|
26
|
+
end
|
27
|
+
end # module Orientation
|
28
|
+
end # module Device
|
29
|
+
end # class Base
|
30
|
+
end # module Core
|
31
|
+
end # module Appium
|
@@ -24,8 +24,8 @@ module Appium
|
|
24
24
|
# @example
|
25
25
|
#
|
26
26
|
# @driver = Appium::Core.for(opts).start_driver
|
27
|
-
# action_1 = TouchAction.new(@driver).press(x: 45, y: 100).wait(600).release
|
28
|
-
# action_2 = TouchAction.new(@driver).tap(element: el, x: 50, y:5, count: 3)
|
27
|
+
# action_1 = Appium::Core::TouchAction.new(@driver).press(x: 45, y: 100).wait(600).release
|
28
|
+
# action_2 = Appium::Core::TouchAction.new(@driver).tap(element: el, x: 50, y:5, count: 3)
|
29
29
|
#
|
30
30
|
# multi_touch_action = MultiTouch.new(@driver)
|
31
31
|
# multi_touch_action.add action_1
|
@@ -27,9 +27,9 @@ module Appium
|
|
27
27
|
# @example
|
28
28
|
#
|
29
29
|
# @driver = Appium::Core.for(opts).start_driver
|
30
|
-
# action = TouchAction.new(@driver).press(x: 45, y: 100).wait(600).release
|
30
|
+
# action = Appium::Core::TouchAction.new(@driver).press(x: 45, y: 100).wait(600).release
|
31
31
|
# action.perform
|
32
|
-
# action = TouchAction.new(@driver).swipe(....)
|
32
|
+
# action = Appium::Core::TouchAction.new(@driver).swipe(....)
|
33
33
|
# action.perform
|
34
34
|
#
|
35
35
|
class TouchAction
|
@@ -59,7 +59,7 @@ module Appium
|
|
59
59
|
# Press down for a specific duration.
|
60
60
|
# Alternatively, you can use +press(...).wait(...).release()+ instead of +long_press+ if duration doesn't work well.
|
61
61
|
# https://github.com/appium/ruby_lib/issues/231#issuecomment-269895512
|
62
|
-
# e.g. Appium::TouchAction.new.press(x: 280, y: 530).wait(2000).release.perform
|
62
|
+
# e.g. Appium::Core::TouchAction.new.press(x: 280, y: 530).wait(2000).release.perform
|
63
63
|
#
|
64
64
|
# @param opts [Hash] Options
|
65
65
|
# @option opts [WebDriver::Element] element the element to press.
|