appium_lib_core 5.5.0 → 5.5.2

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: 5568507385da95987810f6234f38634ed832f09c328b42f340ed8f012eb979e3
4
- data.tar.gz: f1e8d745816ef89c07a1f19adca47a4fbf6889cc533b3c50c671df749b55d084
3
+ metadata.gz: 5302590b2b8b8d265a99ddcd5fda4bf24681b0602cff9eb00125f26bae83bf09
4
+ data.tar.gz: 94abea1e0ea3f4295259d3c5ffa1b44dd91ea14900bc39d6444e85e29181aed9
5
5
  SHA512:
6
- metadata.gz: '0508a3eeabfab5868052600c767ef21ad93ac5d5efed1deab030966e5e6125d07e98bffb2ca5b5c2aababa20cf140643b7e086c90b315dc3040627d3f70357fa'
7
- data.tar.gz: 0b3e01eac1d50376d0c9bb669f8360587113472ccb5706473e64b0d349a19267c6723d5ce3d4db01ca658fe4df2b2d79a98f6d66946f0426a285241732939b8f
6
+ metadata.gz: 3d299a05f52932b4ea717d6056d5bd6425f940eb9d76381f85b9dd8e7f4fc3c6c7baa783aefe39c04200df5d52c02e89348b841cd3343de501201ded8da9b007
7
+ data.tar.gz: 768d729de2a8e7c67cf9cab4b024cf3f91141557aa0b6cb9efd7f3383d1bbbd35ec3ed9bc6d29093435ee709d9be685d400170f5b8a1c18c4882abf57e4a7783
data/CHANGELOG.md CHANGED
@@ -10,6 +10,21 @@ Read `release_notes.md` for commit level details.
10
10
 
11
11
  ### Deprecations
12
12
 
13
+ ## [5.5.2] - 2022-10-11
14
+
15
+ ### Bug fixes
16
+ - Fix wrong deprecation message
17
+
18
+ ## [5.5.1] - 2022-10-10
19
+
20
+ ### Bug fixes
21
+ - Keep converting String to Symbol for `capabilities`, `caps` and `appium_lib` for the backward compatibility
22
+ - Wrong `automationName` and `platformName` detection in this library before starting a session
23
+
24
+ ### Deprecations
25
+ - Converting `capabilities`, `caps` and `appium_lib` from String to Symbol
26
+ - They are expected to be Symbol. Nothing affects existing users who already give the above keys as Symbol for `Appium::Core.for`.
27
+
13
28
  ## [5.5.0] - 2022-10-09
14
29
 
15
30
  ### Bug fixes
@@ -17,10 +17,6 @@ module Appium
17
17
  module Error
18
18
  class CoreError < StandardError; end
19
19
 
20
- # Capability related errors
21
- class NoCapabilityError < CoreError; end
22
- class CapabilityStructureError < CoreError; end
23
-
24
20
  # Appium related errors
25
21
  class NotSupportedAppiumServer < CoreError; end
26
22
  class NoSuchElementError < CoreError; end
@@ -293,6 +293,12 @@ module Appium
293
293
  @delegate_target = self # for testing purpose
294
294
  @automation_name = nil # initialise before 'set_automation_name'
295
295
 
296
+ # TODO: Remove when we implement Options
297
+ # The symbolize_keys is to keep compatiility for the legacy code, which allows capabilities to give 'string' as the key.
298
+ # The toplevel `caps`, `capabilities` and `appium_lib` are expected to be symbol.
299
+ # FIXME: First, please try to remove `nested: true` to `nested: false`.
300
+ opts = Appium.symbolize_keys(opts, nested: true)
301
+
296
302
  @custom_url = opts.delete :url
297
303
  @caps = get_caps(opts)
298
304
 
@@ -486,14 +492,24 @@ module Appium
486
492
 
487
493
  private
488
494
 
495
+ def convert_to_symbol(value)
496
+ if value.nil?
497
+ value
498
+ else
499
+ value.to_sym
500
+ end
501
+ end
502
+
489
503
  # @private
490
504
  def extend_for(device:, automation_name:) # rubocop:disable Metrics/CyclomaticComplexity
491
505
  extend Appium::Core
492
506
  extend Appium::Core::Device
493
507
 
494
- case device
508
+ sym_automation_name = convert_to_symbol(automation_name)
509
+
510
+ case convert_to_symbol(device)
495
511
  when :android
496
- case automation_name
512
+ case sym_automation_name
497
513
  when :espresso
498
514
  ::Appium::Core::Android::Espresso::Bridge.for self
499
515
  when :uiautomator2
@@ -504,7 +520,7 @@ module Appium
504
520
  ::Appium::Core::Android::Uiautomator1::Bridge.for self
505
521
  end
506
522
  when :ios, :tvos
507
- case automation_name
523
+ case sym_automation_name
508
524
  when :safari
509
525
  ::Appium::Logger.debug('SafariDriver for iOS')
510
526
  when :xcuitest
@@ -513,7 +529,7 @@ module Appium
513
529
  ::Appium::Core::Ios::Uiautomation::Bridge.for self
514
530
  end
515
531
  when :mac
516
- case automation_name
532
+ case sym_automation_name
517
533
  when :safari
518
534
  ::Appium::Logger.debug('SafariDriver for macOS')
519
535
  when :gecko
@@ -525,7 +541,7 @@ module Appium
525
541
  ::Appium::Logger.debug('macOS Native')
526
542
  end
527
543
  when :windows
528
- case automation_name
544
+ case sym_automation_name
529
545
  when :gecko
530
546
  ::Appium::Logger.debug('Gecko Driver for Windows')
531
547
  else
@@ -535,7 +551,7 @@ module Appium
535
551
  # https://github.com/Samsung/appium-tizen-driver
536
552
  ::Appium::Logger.debug('tizen')
537
553
  else
538
- case automation_name
554
+ case sym_automation_name
539
555
  when :youiengine
540
556
  # https://github.com/YOU-i-Labs/appium-youiengine-driver
541
557
  ::Appium::Logger.debug('YouiEngine')
@@ -567,6 +583,7 @@ module Appium
567
583
  # The path can be local, HTTP/S, Windows Share and other path like 'sauce-storage:'.
568
584
  # Use @caps[:app] without modifications if the path isn't HTTP/S or local path.
569
585
  def set_app_path
586
+ # FIXME: maybe `:app` should check `app` as well.
570
587
  return unless @caps && @caps[:app] && !@caps[:app].empty?
571
588
  return if @caps[:app] =~ URI::DEFAULT_PARSER.make_regexp
572
589
 
@@ -605,7 +622,8 @@ module Appium
605
622
  # @private
606
623
  def set_appium_device
607
624
  # https://code.google.com/p/selenium/source/browse/spec-draft.md?repo=mobile
608
- @device = @caps[:platformName]
625
+ # TODO: check if the Appium.symbolize_keys(opts, nested: false) enoug with this
626
+ @device = @caps[:platformName] || @caps['platformName']
609
627
  return @device unless @device
610
628
 
611
629
  @device = @device.is_a?(Symbol) ? @device.downcase : @device.downcase.strip.intern
@@ -613,7 +631,9 @@ module Appium
613
631
 
614
632
  # @private
615
633
  def set_automation_name
616
- @automation_name = @caps[:automationName] if @caps[:automationName]
634
+ # TODO: check if the Appium.symbolize_keys(opts, nested: false) enoug with this
635
+ candidate = @caps[:automationName] || @caps['automationName']
636
+ @automation_name = candidate if candidate
617
637
  @automation_name = if @automation_name
618
638
  @automation_name.is_a?(Symbol) ? @automation_name.downcase : @automation_name.downcase.strip.intern
619
639
  end
@@ -14,7 +14,7 @@
14
14
 
15
15
  module Appium
16
16
  module Core
17
- VERSION = '5.5.0' unless defined? ::Appium::Core::VERSION
18
- DATE = '2022-10-09' unless defined? ::Appium::Core::DATE
17
+ VERSION = '5.5.2' unless defined? ::Appium::Core::VERSION
18
+ DATE = '2022-10-11' unless defined? ::Appium::Core::DATE
19
19
  end
20
20
  end
@@ -21,16 +21,25 @@ require_relative 'appium_lib_core/device'
21
21
  require_relative 'appium_lib_core/element'
22
22
 
23
23
  module Appium
24
- # convert all keys (including nested) to symbols
24
+ # @private
25
+ #
26
+ # convert the top level keys to symbols.
25
27
  #
26
- # based on deep_symbolize_keys & deep_transform_keys from rails
27
- # https://github.com/rails/docrails/blob/a3b1105ada3da64acfa3843b164b14b734456a50/activesupport/lib/active_support/core_ext/hash/keys.rb#L84
28
28
  # @param [Hash] hash Hash value to make symbolise
29
- def self.symbolize_keys(hash)
29
+ def self.symbolize_keys(hash, nested: false, enable_deprecation_msg: true)
30
+ # FIXME: As https://github.com/appium/ruby_lib/issues/945, we must remove this implicit string to symbol.
31
+ # But appium_lib_core's some capability handling expect to be symbol, so we should test to remove
32
+ # the mehotds which expect the symbol first.
30
33
  raise ::Appium::Core::Error::ArgumentError, 'symbolize_keys requires a hash' unless hash.is_a? Hash
31
34
 
32
35
  hash.each_with_object({}) do |pair, acc|
33
36
  key = begin
37
+ if enable_deprecation_msg && !(pair[0].is_a? Symbol)
38
+ ::Appium::Logger.warn("[Deprecation] The key '#{pair[0]}' must be a symbol while currently it " \
39
+ "is #{pair[0].class.name}. Please define the key as a Symbol. " \
40
+ 'Converting it to Symbol for now.')
41
+ end
42
+
34
43
  pair[0].to_sym
35
44
  rescue StandardError => e
36
45
  ::Appium::Logger.warn(e.message)
@@ -38,7 +47,11 @@ module Appium
38
47
  end
39
48
 
40
49
  value = pair[1]
41
- acc[key] = value.is_a?(Hash) ? symbolize_keys(value) : value
50
+ acc[key] = if nested
51
+ value.is_a?(Hash) ? symbolize_keys(value, nested: false, enable_deprecation_msg: false) : value
52
+ else
53
+ value
54
+ end
42
55
  end
43
56
  end
44
57
 
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.5.0
4
+ version: 5.5.2
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: 2022-10-09 00:00:00.000000000 Z
11
+ date: 2022-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -272,7 +272,7 @@ homepage: https://github.com/appium/ruby_lib_core/
272
272
  licenses:
273
273
  - Apache-2.0
274
274
  metadata: {}
275
- post_install_message:
275
+ post_install_message:
276
276
  rdoc_options: []
277
277
  require_paths:
278
278
  - lib
@@ -287,8 +287,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
287
287
  - !ruby/object:Gem::Version
288
288
  version: '0'
289
289
  requirements: []
290
- rubygems_version: 3.3.3
291
- signing_key:
290
+ rubygems_version: 3.2.14
291
+ signing_key:
292
292
  specification_version: 4
293
293
  summary: Minimal Ruby library for Appium.
294
294
  test_files: []