appium_lib_core 5.4.0 → 5.5.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: d218a7a8a40159dbd710c8aec292346297a92b98f7026456fd7a29c5794f2914
4
- data.tar.gz: 9606b1256c653c693ed17b344cec7fe2adaf58e8f5f95c9be3f0b9b3811cd79c
3
+ metadata.gz: 5568507385da95987810f6234f38634ed832f09c328b42f340ed8f012eb979e3
4
+ data.tar.gz: f1e8d745816ef89c07a1f19adca47a4fbf6889cc533b3c50c671df749b55d084
5
5
  SHA512:
6
- metadata.gz: 9cf6fda7cec0c09f3b83e0bd786d3a914a8d24c1f1f6f355570c83f9ae1b33c486608370d6a4c5b5cd2aeab73df802509dce93d6de46efcf12cd8a86e3d9c6f9
7
- data.tar.gz: 4f57441793ffeb9b40d9f6cc5d1456e836b05cd166775d2ec3c2319767daf36e44f66b498b69fa3b4f5f3e304718fd5a32fa717b732983294ed8713d0950c33a
6
+ metadata.gz: '0508a3eeabfab5868052600c767ef21ad93ac5d5efed1deab030966e5e6125d07e98bffb2ca5b5c2aababa20cf140643b7e086c90b315dc3040627d3f70357fa'
7
+ data.tar.gz: 0b3e01eac1d50376d0c9bb669f8360587113472ccb5706473e64b0d349a19267c6723d5ce3d4db01ca658fe4df2b2d79a98f6d66946f0426a285241732939b8f
data/CHANGELOG.md CHANGED
@@ -10,6 +10,11 @@ Read `release_notes.md` for commit level details.
10
10
 
11
11
  ### Deprecations
12
12
 
13
+ ## [5.5.0] - 2022-10-09
14
+
15
+ ### Bug fixes
16
+ - Removed forcefully converting keys of capabilities into symbol, which caused unexpected capabilities format issue [ruby_lib/945](https://github.com/appium/ruby_lib/issues/945)
17
+
13
18
  ## [5.4.0] - 2022-10-01
14
19
 
15
20
  ### Enhancements
@@ -53,8 +53,8 @@ module Appium
53
53
  # Override
54
54
  # Creates session handling.
55
55
  #
56
- # @param [::Selenium::WebDriver::Remote::Capabilities, Hash] capabilities A capability
57
- # @return [::Selenium::WebDriver::Remote::Capabilities]
56
+ # @param [::Appium::Core::Base::Capabilities, Hash] capabilities A capability
57
+ # @return [::Appium::Core::Base::Capabilities]
58
58
  #
59
59
  # @example
60
60
  #
@@ -89,10 +89,10 @@ module Appium
89
89
  # Append +appium:+ prefix for Appium following W3C spec
90
90
  # https://www.w3.org/TR/webdriver/#dfn-validate-capabilities
91
91
  #
92
- # @param [::Selenium::WebDriver::Remote::Capabilities, Hash] capabilities A capability
93
- # @return [::Selenium::WebDriver::Remote::Capabilities]
92
+ # @param [::Appium::Core::Base::Capabilities, Hash] capabilities A capability
93
+ # @return [::Appium::Core::Base::Capabilities]
94
94
  def add_appium_prefix(capabilities)
95
- w3c_capabilities = ::Selenium::WebDriver::Remote::Capabilities.new
95
+ w3c_capabilities = ::Appium::Core::Base::Capabilities.new
96
96
 
97
97
  capabilities = capabilities.send(:capabilities) unless capabilities.is_a?(Hash)
98
98
 
@@ -111,12 +111,12 @@ module Appium
111
111
 
112
112
  private
113
113
 
114
- def camel_case(str)
115
- str.gsub(/_([a-z])/) { Regexp.last_match(1).upcase }
114
+ def camel_case(str_or_sym)
115
+ str_or_sym.to_s.gsub(/_([a-z])/) { Regexp.last_match(1).upcase }
116
116
  end
117
117
 
118
118
  def extension_prefix?(capability_name)
119
- snake_cased_capability_names = ::Selenium::WebDriver::Remote::Capabilities::KNOWN.map(&:to_s)
119
+ snake_cased_capability_names = ::Appium::Core::Base::Capabilities::KNOWN.map(&:to_s)
120
120
  camel_cased_capability_names = snake_cased_capability_names.map { |v| camel_case(v) }
121
121
 
122
122
  # Check 'EXTENSION_CAPABILITY_PATTERN'
@@ -126,7 +126,7 @@ module Appium
126
126
  end
127
127
 
128
128
  def json_create(value)
129
- ::Selenium::WebDriver::Remote::Capabilities.json_create(value)
129
+ ::Appium::Core::Base::Capabilities.json_create(value)
130
130
  end
131
131
 
132
132
  public
@@ -182,7 +182,7 @@ module Appium
182
182
 
183
183
  # Port from MJSONWP
184
184
  def session_capabilities
185
- ::Selenium::WebDriver::Remote::Capabilities.json_create execute(:get_capabilities)
185
+ ::Appium::Core::Base::Capabilities.json_create execute(:get_capabilities)
186
186
  end
187
187
 
188
188
  # Override for safe. Newer ruby selenium webdriver already has the same code
@@ -345,6 +345,9 @@ module Appium
345
345
  element_id = element_id_from(arg)
346
346
  return ::Appium::Core::Element.new(self, element_id) if element_id
347
347
 
348
+ shadow_root_id = shadow_root_id_from(arg)
349
+ return ::Selenium::WebDriver::Remote::ShadowRoot.new self, shadow_root_id if shadow_root_id
350
+
348
351
  arg.each { |k, v| arg[k] = unwrap_script_result(v) }
349
352
  else
350
353
  arg
@@ -15,22 +15,14 @@
15
15
  module Appium
16
16
  module Core
17
17
  class Base
18
- module Capabilities
19
- # @private
20
- # @param [Hash] opts_caps Capabilities for Appium server. All capability keys are converted to lowerCamelCase when
21
- # this client sends capabilities to Appium server as JSON format.
22
- # @return [::Selenium::WebDriver::Remote::Capabilities] Return instance of Appium::Core::Base::Capabilities
23
- # inherited ::Selenium::WebDriver::Remote::Capabilities
24
- def self.create_capabilities(opts_caps = {})
25
- # TODO: Move to 'Options' way instead of 'Capabilities'.
26
- # Selenium 5 will have Options instead of 'Capabilities'.
27
- # https://github.com/SeleniumHQ/selenium/blob/trunk/rb/lib/selenium/webdriver/common/options.rb
28
- # Then, Ruby client also shoud move to the Options way.
29
- # Appium's capabilities could change by depending on Appium versions. So it does not have
30
- # standard options like chrome and firefox etc. So, the implementation should differ from
31
- # other browsers. But here should inherit `Options` to follow Selenium.
32
- ::Selenium::WebDriver::Remote::Capabilities.new(opts_caps)
33
- end
18
+ class Capabilities < ::Selenium::WebDriver::Remote::Capabilities
19
+ # TODO: Move to 'Options' way instead of 'Capabilities'.
20
+ # Selenium 5 will have Options instead of 'Capabilities'.
21
+ # https://github.com/SeleniumHQ/selenium/blob/trunk/rb/lib/selenium/webdriver/common/options.rb
22
+ # Then, Ruby client also shoud move to the Options way.
23
+ # Appium's capabilities could change by depending on Appium versions. So it does not have
24
+ # standard options like chrome and firefox etc. So, the implementation should differ from
25
+ # other browsers. But here should inherit `Options` to follow Selenium.
34
26
  end
35
27
  end
36
28
  end
@@ -293,9 +293,6 @@ module Appium
293
293
  @delegate_target = self # for testing purpose
294
294
  @automation_name = nil # initialise before 'set_automation_name'
295
295
 
296
- opts = Appium.symbolize_keys opts
297
- validate_keys(opts)
298
-
299
296
  @custom_url = opts.delete :url
300
297
  @caps = get_caps(opts)
301
298
 
@@ -371,7 +368,7 @@ module Appium
371
368
  begin
372
369
  @driver = ::Appium::Core::Base::Driver.new(listener: @listener,
373
370
  http_client: @http_client,
374
- capabilities: @caps, # ::Selenium::WebDriver::Remote::Capabilities
371
+ capabilities: @caps, # ::Appium::Core::Base::Capabilities
375
372
  url: @custom_url,
376
373
  wait_timeout: @wait_timeout,
377
374
  wait_interval: @wait_interval,
@@ -555,32 +552,9 @@ module Appium
555
552
  self
556
553
  end
557
554
 
558
- # @private
559
- def validate_keys(opts)
560
- flatten_ops = flatten_hash_keys(opts)
561
-
562
- raise Error::NoCapabilityError unless opts.member?(:caps) || opts.member?(:capabilities)
563
-
564
- if !opts.member?(:appium_lib) && flatten_ops.member?(:appium_lib)
565
- raise Error::CapabilityStructureError, 'Please check the value of appium_lib in the capability'
566
- end
567
-
568
- true
569
- end
570
-
571
- # @private
572
- def flatten_hash_keys(hash, flatten_keys_result = [])
573
- hash.each do |key, value|
574
- flatten_keys_result << key
575
- flatten_hash_keys(value, flatten_keys_result) if value.is_a?(Hash)
576
- end
577
-
578
- flatten_keys_result
579
- end
580
-
581
555
  # @private
582
556
  def get_caps(opts)
583
- Core::Base::Capabilities.create_capabilities(opts[:caps] || opts[:capabilities] || {})
557
+ Core::Base::Capabilities.new(opts[:caps] || opts[:capabilities] || {})
584
558
  end
585
559
 
586
560
  # @private
@@ -14,7 +14,7 @@
14
14
 
15
15
  module Appium
16
16
  module Core
17
- VERSION = '5.4.0' unless defined? ::Appium::Core::VERSION
18
- DATE = '2022-10-01' unless defined? ::Appium::Core::DATE
17
+ VERSION = '5.5.0' unless defined? ::Appium::Core::VERSION
18
+ DATE = '2022-10-09' unless defined? ::Appium::Core::DATE
19
19
  end
20
20
  end
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: 5.4.0
4
+ version: 5.5.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: 2022-10-01 00:00:00.000000000 Z
11
+ date: 2022-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver