appium_lib_core 6.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2797136f9ad9290a9e38fe27dd02d99c99ae12656e378a049dd653190be569bc
4
- data.tar.gz: 38c66b8f7fd0fdab194906cdf05640301431fab6a0b91492125a6c8f9f3d4993
3
+ metadata.gz: c45a558b448d89b1b356b221257279ff8c148680a1dc09f7414877e6e59a6257
4
+ data.tar.gz: d09d57109c80759c9b92942b7f8e1424c2614f34e4fcdbe9f6d4d0e48ee41816
5
5
  SHA512:
6
- metadata.gz: f6168e1739ede67cbdb0eae874498d6a156d93c8fce9684b37108b40d183395ce5089659f70af8724adae804caeaafd490a318a22d2527bae98b597a40befa1a
7
- data.tar.gz: c7126ebb44078aaacae3c81ebf39853d1c9da0b6718ed74f28209ed13f8b639f85a6b36744e311105fca5a340b103da21bd1ca3b72d3545d818c3bb5891ac5d9
6
+ metadata.gz: 6f50481e6656b18e7dfe5dc631137ab1ab041c9c6087fcf27b1fd24e91814e83ce051f22db1a3e4b41f5d2a4b8320e2ac7c323638e9e9b76d2508d66a7992cdf
7
+ data.tar.gz: 0b04644ee8c7704080935777b01886cca17acce8dab8c7953b769c9dd9ca33efc588e3da5e08bba6a91f0ac17bde973c607f3b886c4724eb84be3c44aece2690
data/CHANGELOG.md CHANGED
@@ -10,7 +10,20 @@ Read `release_notes.md` for commit level details.
10
10
 
11
11
  ### Deprecations
12
12
 
13
- ## [6.2.0]
13
+ ## [6.3.0] - 2023-03-14
14
+
15
+ ### Enhancements
16
+ - Support custom listener
17
+ - e.g. A listener named `CustomListener` which inherits `::Selenium::WebDriver::Support::AbstractEventListener` can set as `appium_lib: { listener: CustomListener.new}` capability
18
+
19
+ ## [6.2.1] - 2023-03-09
20
+
21
+ ### Enhancements
22
+ - Add `uia_device_orientation_landscaperight` and `uia_device_orientation_portrait_upsidedown` symbols in the `drivede.rotation=`
23
+ - Add `drivede.orientation=` as a syntax sugar of `drivede.rotation=`
24
+
25
+
26
+ ## [6.2.0] - 2023-01-26
14
27
 
15
28
  ### Enhancements
16
29
 
data/README.md CHANGED
@@ -154,6 +154,29 @@ attached_driver.page_source
154
154
  Read [Appium/Core/Driver](https://www.rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Driver) to catch up with available capabilities.
155
155
  Capabilities affect only ruby_lib is [Appium/Core/Options](https://www.rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Options).
156
156
 
157
+
158
+ ### Gives custom listener
159
+
160
+ An example to define a customer listener with [Selenium::WebDriver::Support::AbstractEventListener](https://www.selenium.dev/selenium/docs/api/rb/Selenium/WebDriver/Support/AbstractEventListener.html)
161
+
162
+ ```ruby
163
+ class CustomListener < ::Selenium::WebDriver::Support::AbstractEventListener
164
+ // something
165
+ end
166
+ capabilities: {
167
+ platformName: :ios,
168
+ platformVersion: '11.0',
169
+ deviceName: 'iPhone Simulator',
170
+ automationName: 'XCUITest',
171
+ app: '/path/to/MyiOS.app'
172
+ },
173
+ appium_lib: {
174
+ listener: CustomListener.new
175
+ }
176
+ @core = Appium::Core.for capabilities: capabilities, appium_lib: appium_lib
177
+ @core.start_driver
178
+ ```
179
+
157
180
  # Development
158
181
  - Demo app
159
182
  - https://android.googlesource.com/platform/development/+/master/samples/ApiDemos
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency 'minitest', '~> 5.0'
31
31
  spec.add_development_dependency 'minitest-reporters', '~> 1.1'
32
32
  spec.add_development_dependency 'webmock', '~> 3.18.1'
33
- spec.add_development_dependency 'rubocop', '1.44.0'
33
+ spec.add_development_dependency 'rubocop', '1.47.0'
34
34
  spec.add_development_dependency 'appium_thor', '~> 1.0'
35
35
  spec.add_development_dependency 'parallel_tests'
36
36
  spec.add_development_dependency 'simplecov'
@@ -44,16 +44,25 @@ module Appium
44
44
  # Do not use this for general use. Used by flutter driver to get bridge for creating a new element
45
45
  attr_reader :bridge
46
46
 
47
- private
48
-
49
47
  def initialize(bridge: nil, listener: nil, **opts)
48
+ original_opts = opts.dup
49
+
50
50
  # For ::Appium::Core::Waitable
51
51
  @wait_timeout = opts.delete(:wait_timeout)
52
52
  @wait_interval = opts.delete(:wait_interval)
53
53
 
54
- super
54
+ # Selenium WebDriver attributes
55
+ @devtools = nil
56
+ @bidi = nil
57
+
58
+ # in the selenium webdriver as well
59
+ bridge ||= create_bridge(**opts)
60
+ add_extensions(bridge.browser)
61
+ @bridge = listener ? ::Appium::Support::EventFiringBridge.new(bridge, listener, **original_opts) : bridge
55
62
  end
56
63
 
64
+ private
65
+
57
66
  # Create a proper bridge instance.
58
67
  #
59
68
  # @return [::Appium::Core::Base::Bridge]
@@ -947,8 +956,6 @@ module Appium
947
956
  # # "appPackage"=>"io.appium.android.apis",
948
957
  # # "appActivity"=>"io.appium.android.apis.ApiDemos",
949
958
  # # "someCapability"=>"some_capability",
950
- # # "unicodeKeyboard"=>true,
951
- # # "resetKeyboard"=>true},
952
959
  # # "automationName"=>"uiautomator2",
953
960
  # # "app"=>"/path/to/app/api.apk.zip",
954
961
  # # "platformVersion"=>"8.1.0",
@@ -956,8 +963,6 @@ module Appium
956
963
  # # "appPackage"=>"io.appium.android.apis",
957
964
  # # "appActivity"=>"io.appium.android.apis.ApiDemos",
958
965
  # # "someCapability"=>"some_capability",
959
- # # "unicodeKeyboard"=>true,
960
- # # "resetKeyboard"=>true,
961
966
  # # "deviceUDID"=>"emulator-5554",
962
967
  # # "deviceScreenSize"=>"1080x1920",
963
968
  # # "deviceScreenDensity"=>420,
@@ -1073,7 +1078,7 @@ module Appium
1073
1078
  #
1074
1079
  # @param [String] img_path A path to a partial image you'd like to find
1075
1080
  #
1076
- # @return [Array<Selenium::WebDriver::Element>]
1081
+ # @return [Array<::Appium::Core::Element>]
1077
1082
  #
1078
1083
  # @example
1079
1084
  #
@@ -37,7 +37,7 @@ module Appium
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
+ def initialize(open_timeout: nil, read_timeout: nil)
41
41
  @open_timeout = open_timeout
42
42
  @read_timeout = read_timeout
43
43
  @additional_headers = {}
@@ -20,12 +20,18 @@ module Appium
20
20
  #
21
21
 
22
22
  module Rotatable
23
- ORIENTATIONS = %i[landscape portrait].freeze
23
+ ORIENTATIONS = %i[
24
+ landscape
25
+ portrait
26
+ uia_device_orientation_landscaperight
27
+ uia_device_orientation_portrait_upsidedown
28
+ ].freeze
24
29
 
25
30
  #
26
31
  # Change the screen orientation
27
32
  #
28
- # @param [:landscape, :portrait] orientation
33
+ # @param [:landscape, :portrait,
34
+ # :uia_device_orientation_landscaperight, :uia_device_orientation_portrait_upsidedown] orientation
29
35
  #
30
36
  #
31
37
  def rotation=(orientation)
@@ -36,11 +42,13 @@ module Appium
36
42
  bridge.screen_orientation = orientation.to_s.upcase
37
43
  end
38
44
  alias rotate rotation=
45
+ alias orientation= rotation=
39
46
 
40
47
  #
41
48
  # Get the current screen orientation
42
49
  #
43
- # @return [:landscape, :portrait] orientation
50
+ # @return [:landscape, :portrait,
51
+ # :uia_device_orientation_landscaperight, :uia_device_orientation_portrait_upsidedown] orientation
44
52
  #
45
53
  # @api public
46
54
  #
@@ -276,6 +276,23 @@ module Appium
276
276
  # @core = Appium::Core.for(opts) # create a core driver with 'opts' and extend methods into 'self'
277
277
  # @core.start_driver # start driver with 'url'. Connect to 'http://custom-host:8080/wd/hub.com'
278
278
  #
279
+ # # With a custom listener
280
+ # class CustomListener < ::Selenium::WebDriver::Support::AbstractEventListener
281
+ # // something
282
+ # end
283
+ # capabilities: {
284
+ # platformName: :ios,
285
+ # platformVersion: '11.0',
286
+ # deviceName: 'iPhone Simulator',
287
+ # automationName: 'XCUITest',
288
+ # app: '/path/to/MyiOS.app'
289
+ # },
290
+ # appium_lib: {
291
+ # listener: CustomListener.new,
292
+ # }
293
+ # @core = Appium::Core.for capabilities: capabilities, appium_lib: appium_lib
294
+ # @core.start_driver
295
+ #
279
296
  def self.for(opts = {})
280
297
  new.setup_for_new_session(opts)
281
298
  end
@@ -0,0 +1,57 @@
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 Support
17
+ class EventFiringBridge < ::Selenium::WebDriver::Support::EventFiringBridge
18
+ # This module inherits ::Selenium::WebDriver::Support::EventFiringBridge
19
+ # to provide customer listener availability.
20
+ # https://github.com/SeleniumHQ/selenium/blob/trunk/rb/lib/selenium/webdriver/support/event_firing_bridge.rb#L79
21
+
22
+ def initialize(delegate, listener, **opts)
23
+ @appium_options = opts
24
+ super delegate, listener
25
+ end
26
+
27
+ def find_element_by(how, what, parent = nil)
28
+ e = dispatch(:find, how, what, driver) do
29
+ @delegate.find_element_by how, what, parent
30
+ end
31
+
32
+ ::Appium::Core::Element.new self, e.ref.last
33
+ end
34
+
35
+ def find_elements_by(how, what, parent = nil)
36
+ es = dispatch(:find, how, what, driver) do
37
+ @delegate.find_elements_by(how, what, parent)
38
+ end
39
+
40
+ es.map { |e| ::Appium::Core::Element.new self, e.ref.last }
41
+ end
42
+
43
+ private
44
+
45
+ def create_element(ref)
46
+ ::Appium::Core::Element.new @delegate, ref
47
+ end
48
+
49
+ def driver
50
+ # To not gives the listener
51
+ @appium_options.delete(:listener)
52
+
53
+ @driver ||= ::Appium::Core::Base::Driver.new(bridge: self, listener: nil, **@appium_options)
54
+ end
55
+ end
56
+ end
57
+ end
@@ -14,7 +14,7 @@
14
14
 
15
15
  module Appium
16
16
  module Core
17
- VERSION = '6.2.0' unless defined? ::Appium::Core::VERSION
18
- DATE = '2023-01-26' unless defined? ::Appium::Core::DATE
17
+ VERSION = '6.3.0' unless defined? ::Appium::Core::VERSION
18
+ DATE = '2023-03-14' unless defined? ::Appium::Core::DATE
19
19
  end
20
20
  end
@@ -19,6 +19,7 @@ require_relative 'appium_lib_core/common'
19
19
  require_relative 'appium_lib_core/driver'
20
20
  require_relative 'appium_lib_core/device'
21
21
  require_relative 'appium_lib_core/element'
22
+ require_relative 'appium_lib_core/support/event_firing_bridge'
22
23
 
23
24
  module Appium
24
25
  # @private
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appium_lib_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.2.0
4
+ version: 6.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuaki MATSUO
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-26 00:00:00.000000000 Z
11
+ date: 2023-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -120,14 +120,14 @@ dependencies:
120
120
  requirements:
121
121
  - - '='
122
122
  - !ruby/object:Gem::Version
123
- version: 1.44.0
123
+ version: 1.47.0
124
124
  type: :development
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - '='
129
129
  - !ruby/object:Gem::Version
130
- version: 1.44.0
130
+ version: 1.47.0
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: appium_thor
133
133
  requirement: !ruby/object:Gem::Requirement
@@ -259,6 +259,7 @@ files:
259
259
  - lib/appium_lib_core/mac2/bridge.rb
260
260
  - lib/appium_lib_core/mac2/device.rb
261
261
  - lib/appium_lib_core/mac2/device/screen.rb
262
+ - lib/appium_lib_core/support/event_firing_bridge.rb
262
263
  - lib/appium_lib_core/version.rb
263
264
  - lib/appium_lib_core/windows.rb
264
265
  - lib/appium_lib_core/windows/bridge.rb