appium_lib_core 6.2.1 → 6.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d75095d146ec0e3786352920f8d1fe385cedab5c8faddc6292db1cd94cd5e111
4
- data.tar.gz: be514be276344a3b488238716890d3bd99fbc1d9da3317ccb4ee943da8cf9ee3
3
+ metadata.gz: 3047299ce31d2eac69a3d62e52e2fa73ca02710e0f7c7d5d039e06e838822386
4
+ data.tar.gz: 2776a7ddebb3cc71a0334559c663b351c1f5f4dde223b313d3b581b91b83b402
5
5
  SHA512:
6
- metadata.gz: 40c066943b4d7c7f879a991b40b88d34da0317c0099c9fd14f011de8769d7d5cbc34665183b8f034ac532a7d5e5dd616aba4d433d4731fd37a9992ad82384108
7
- data.tar.gz: a277b62b251f4557592bbccc79816fe75d833b324965d121225d39364bfa2d5f0b2e62eff41eafc7a11996564046775dd5da9c0c4e0b85ca0248b8e3ba9ae845
6
+ metadata.gz: cfd4ad06897b4402556701ff40bb3722f4c5b8dd3b4704577ba7790c28f6e329d5aab83abbdea906c309897b9c95f87d61f6845e7eb8ef4f569105a82d816164
7
+ data.tar.gz: 6076c5d10ee6010eea91a78ff98aaa18187ef6c7c1519e024bba8b7207f4892311cea7ffcac0b081a5ebb39945d42eae46d1ca463fa581f6450d3e6b53f29731
data/CHANGELOG.md CHANGED
@@ -10,6 +10,17 @@ Read `release_notes.md` for commit level details.
10
10
 
11
11
  ### Deprecations
12
12
 
13
+ ## [6.4.0] - 2023-04-30
14
+
15
+ ### Enhancements
16
+ - Append `selenium-webdriver` `4.9` support
17
+
18
+ ## [6.3.0] - 2023-03-14
19
+
20
+ ### Enhancements
21
+ - Support custom listener
22
+ - e.g. A listener named `CustomListener` which inherits `::Selenium::WebDriver::Support::AbstractEventListener` can set as `appium_lib: { listener: CustomListener.new}` capability
23
+
13
24
  ## [6.2.1] - 2023-03-09
14
25
 
15
26
  ### Enhancements
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
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ['lib']
24
24
 
25
- spec.add_runtime_dependency 'selenium-webdriver', '~> 4.2', '< 4.9'
25
+ spec.add_runtime_dependency 'selenium-webdriver', '~> 4.2', '< 4.10'
26
26
  spec.add_runtime_dependency 'faye-websocket', '~> 0.11.0'
27
27
 
28
28
  spec.add_development_dependency 'rake', '~> 13.0'
@@ -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.47.0'
33
+ spec.add_development_dependency 'rubocop', '1.50.2'
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,26 @@ 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
47
+ # override
48
+ def initialize(bridge: nil, listener: nil, **opts) # rubocop:disable Lint/MissingSuper
49
+ original_opts = opts.dup
48
50
 
49
- def initialize(bridge: nil, listener: nil, **opts)
50
51
  # For ::Appium::Core::Waitable
51
52
  @wait_timeout = opts.delete(:wait_timeout)
52
53
  @wait_interval = opts.delete(:wait_interval)
53
54
 
54
- super
55
+ # Selenium WebDriver attributes
56
+ @devtools = nil
57
+ @bidi = nil
58
+
59
+ # in the selenium webdriver as well
60
+ bridge ||= create_bridge(**opts)
61
+ add_extensions(bridge.browser)
62
+ @bridge = listener ? ::Appium::Support::EventFiringBridge.new(bridge, listener, **original_opts) : bridge
55
63
  end
56
64
 
65
+ private
66
+
57
67
  # Create a proper bridge instance.
58
68
  #
59
69
  # @return [::Appium::Core::Base::Bridge]
@@ -1069,7 +1079,7 @@ module Appium
1069
1079
  #
1070
1080
  # @param [String] img_path A path to a partial image you'd like to find
1071
1081
  #
1072
- # @return [Array<Selenium::WebDriver::Element>]
1082
+ # @return [Array<::Appium::Core::Element>]
1073
1083
  #
1074
1084
  # @example
1075
1085
  #
@@ -41,6 +41,7 @@ module Appium
41
41
  @open_timeout = open_timeout
42
42
  @read_timeout = read_timeout
43
43
  @additional_headers = {}
44
+ super
44
45
  end
45
46
 
46
47
  # Update <code>server_url</code> provided when ruby_lib _core created a default http client.
@@ -24,7 +24,7 @@ module Appium
24
24
  def save_screenshot(png_path)
25
25
  extension = File.extname(png_path).downcase
26
26
  if extension != '.png'
27
- ::Appium::Logger.warn 'name used for saved screenshot does not match file type. '\
27
+ ::Appium::Logger.warn 'name used for saved screenshot does not match file type. ' \
28
28
  'It should end with .png extension'
29
29
  end
30
30
  File.open(png_path, 'wb') { |f| f << screenshot_as(:png) }
@@ -103,7 +103,7 @@ module Appium
103
103
  def save_viewport_screenshot(png_path)
104
104
  extension = File.extname(png_path).downcase
105
105
  if extension != '.png'
106
- ::Appium::Logger.warn 'name used for saved screenshot does not match file type. '\
106
+ ::Appium::Logger.warn 'name used for saved screenshot does not match file type. ' \
107
107
  'It should end with .png extension'
108
108
  end
109
109
  viewport_screenshot_encode64 = bridge.viewport_screenshot
@@ -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
@@ -488,13 +505,7 @@ module Appium
488
505
  end
489
506
 
490
507
  def get_http_client(http_client: nil, open_timeout: nil, read_timeout: nil)
491
- client = http_client || Appium::Core::Base::Http::Default.new
492
-
493
- # open_timeout and read_timeout are explicit wait.
494
- client.open_timeout = open_timeout if open_timeout
495
- client.read_timeout = read_timeout if read_timeout
496
-
497
- client
508
+ http_client || Appium::Core::Base::Http::Default.new(open_timeout: open_timeout, read_timeout: read_timeout)
498
509
  end
499
510
 
500
511
  # Ignore setting default wait if the target driver has no implementation
@@ -152,7 +152,7 @@ module Appium
152
152
  def save_screenshot(png_path)
153
153
  extension = File.extname(png_path).downcase
154
154
  if extension != '.png'
155
- ::Appium::Logger.warn 'name used for saved screenshot does not match file type. '\
155
+ ::Appium::Logger.warn 'name used for saved screenshot does not match file type. ' \
156
156
  'It should end with .png extension'
157
157
  end
158
158
  File.open(png_path, 'wb') { |f| f << screenshot_as(:png) }
@@ -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.1' unless defined? ::Appium::Core::VERSION
18
- DATE = '2023-03-09' unless defined? ::Appium::Core::DATE
17
+ VERSION = '6.4.0' unless defined? ::Appium::Core::VERSION
18
+ DATE = '2023-04-30' 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.1
4
+ version: 6.4.0
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: 2023-03-09 00:00:00.000000000 Z
11
+ date: 2023-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '4.2'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '4.9'
22
+ version: '4.10'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '4.2'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '4.9'
32
+ version: '4.10'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: faye-websocket
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -120,14 +120,14 @@ dependencies:
120
120
  requirements:
121
121
  - - '='
122
122
  - !ruby/object:Gem::Version
123
- version: 1.47.0
123
+ version: 1.50.2
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.47.0
130
+ version: 1.50.2
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
@@ -269,7 +270,7 @@ homepage: https://github.com/appium/ruby_lib_core/
269
270
  licenses:
270
271
  - Apache-2.0
271
272
  metadata: {}
272
- post_install_message:
273
+ post_install_message:
273
274
  rdoc_options: []
274
275
  require_paths:
275
276
  - lib
@@ -284,8 +285,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
284
285
  - !ruby/object:Gem::Version
285
286
  version: '0'
286
287
  requirements: []
287
- rubygems_version: 3.2.14
288
- signing_key:
288
+ rubygems_version: 3.3.3
289
+ signing_key:
289
290
  specification_version: 4
290
291
  summary: Minimal Ruby library for Appium.
291
292
  test_files: []