appium_lib_core 5.0.0.rc5 → 5.0.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: 19a2c4c9f752e5f2e4287ce8b0d53bc428bafaa997b58c40bc0b796b878eadeb
4
- data.tar.gz: 451e46bc56fa768879ab680520dff4ec137455ca020e1176f3022160d1a46009
3
+ metadata.gz: 88e1099c62a49f922529ee84563d0b475c160a981451da59210819e61956f985
4
+ data.tar.gz: bb653d62d35c461e8e0c9dcec726064992e735418b20c85b4aa6aae16d9b0a88
5
5
  SHA512:
6
- metadata.gz: e9e155e17e026514e12657489569b17b389d62cb9d7cd79e8a753e12b37571d4a9d3a3f28227b935b2d3d101747a7ce66d28ff7eb08f6c9cfb7c1c94ca7f3f03
7
- data.tar.gz: 13e2620a48fe753b5647a0ffcb6bf370f54796aa3b87ca34522659c219474804dfa7843394307ad84b36dc377a10d2bd5bec782467354abb252e945c27cdd748
6
+ metadata.gz: 1a18f9f6ea13b72f0aff09ea748c102fdfe202be60ac59f7fcaceee34485746a75fd83d8e438c2fd0447b64ce3c17655418ccdf599fba618afd75db7bab72e73
7
+ data.tar.gz: 6cac7cbba8c64d8f97fa34af6adc1b33f432549950551826cfc0e1d0340e0add900b85bf0c09cbbfa9fae551aec873d68b08b9f301d9ace40e9716d453c3ca4b
@@ -29,9 +29,9 @@ jobs:
29
29
  - name: Run tests
30
30
  run: |
31
31
  bundle exec rake rubocop
32
- bundle exec parallel_test test/unit/ -n 4
33
- AUTOMATION_NAME_DROID=espresso bundle exec parallel_test test/unit/android -n 4
34
- AUTOMATION_NAME_DROID=appium AUTOMATION_NAME_IOS=appium bundle exec parallel_test test/unit -n 4
32
+ bundle exec rake test:unit
33
+ AUTOMATION_NAME_DROID=espresso bundle exec rake test:unit:android
34
+ AUTOMATION_NAME_DROID=appium AUTOMATION_NAME_IOS=appium bundle exec rake test:unit
35
35
 
36
36
  test-win:
37
37
  strategy:
@@ -57,11 +57,11 @@ jobs:
57
57
  gem uninstall --force eventmachine && gem install eventmachine --platform ruby
58
58
  - name: Run tests
59
59
  run: |
60
- parallel_test test/unit/ -n 4
60
+ rake test:unit
61
61
 
62
62
  setx AUTOMATION_NAME_DROID espresso
63
- parallel_test test/unit/android -n 4
63
+ rake test:unit:android
64
64
 
65
65
  setx AUTOMATION_NAME_DROID appium
66
66
  setx AUTOMATION_NAME_IOS appium
67
- parallel_test test/unit -n 4
67
+ rake test:unit
data/.rubocop.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.4
2
+ TargetRubyVersion: 2.6
3
3
  Layout/LineLength:
4
4
  Max: 128
5
5
  Layout/RescueEnsureAlignment:
@@ -56,3 +56,91 @@ Style/ExplicitBlockArgument:
56
56
  Enabled: false
57
57
  Style/KeywordParametersOrder:
58
58
  Enabled: false
59
+ Gemspec/DateAssignment:
60
+ Enabled: true
61
+ Layout/LineEndStringConcatenationIndentation:
62
+ Enabled: true
63
+ Layout/SpaceBeforeBrackets:
64
+ Enabled: true
65
+ Lint/AmbiguousAssignment:
66
+ Enabled: true
67
+ Lint/AmbiguousOperatorPrecedence:
68
+ Enabled: false
69
+ Lint/AmbiguousRange:
70
+ Enabled: true
71
+ Lint/DeprecatedConstants:
72
+ Enabled: true
73
+ Lint/DuplicateBranch:
74
+ Enabled: true
75
+ Lint/DuplicateRegexpCharacterClassElement:
76
+ Enabled: true
77
+ Lint/EmptyBlock:
78
+ Enabled: true
79
+ Lint/EmptyClass:
80
+ Enabled: true
81
+ Lint/EmptyInPattern:
82
+ Enabled: true
83
+ Lint/IncompatibleIoSelectWithFiberScheduler:
84
+ Enabled: true
85
+ Lint/LambdaWithoutLiteralBlock:
86
+ Enabled: true
87
+ Lint/NoReturnInBeginEndBlocks:
88
+ Enabled: true
89
+ Lint/NumberedParameterAssignment:
90
+ Enabled: true
91
+ Lint/OrAssignmentToConstant:
92
+ Enabled: true
93
+ Lint/RedundantDirGlobSort:
94
+ Enabled: true
95
+ Lint/RequireRelativeSelfPath:
96
+ Enabled: true
97
+ Lint/SymbolConversion:
98
+ Enabled: true
99
+ Lint/ToEnumArguments:
100
+ Enabled: true
101
+ Lint/TripleQuotes:
102
+ Enabled: true
103
+ Lint/UnexpectedBlockArity:
104
+ Enabled: true
105
+ Lint/UnmodifiedReduceAccumulator:
106
+ Enabled: true
107
+ Security/IoMethods:
108
+ Enabled: true
109
+ Style/ArgumentsForwarding:
110
+ Enabled: true
111
+ Style/CollectionCompact:
112
+ Enabled: true
113
+ Style/DocumentDynamicEvalDefinition:
114
+ Enabled: true
115
+ Style/EndlessMethod:
116
+ Enabled: true
117
+ Style/HashConversion:
118
+ Enabled: true
119
+ Style/HashExcept:
120
+ Enabled: true
121
+ Style/IfWithBooleanLiteralBranches:
122
+ Enabled: true
123
+ Style/InPatternThen:
124
+ Enabled: true
125
+ Style/MultilineInPatternThen:
126
+ Enabled: true
127
+ Style/NegatedIfElseCondition:
128
+ Enabled: true
129
+ Style/NilLambda:
130
+ Enabled: true
131
+ Style/NumberedParameters:
132
+ Enabled: true
133
+ Style/NumberedParametersLimit:
134
+ Enabled: true
135
+ Style/QuotedSymbols:
136
+ Enabled: true
137
+ Style/RedundantArgument:
138
+ Enabled: true
139
+ Style/RedundantSelfAssignmentBranch:
140
+ Enabled: true
141
+ Style/SelectByRegexp:
142
+ Enabled: true
143
+ Style/StringChars:
144
+ Enabled: true
145
+ Style/SwapValues:
146
+ Enabled: true
data/CHANGELOG.md CHANGED
@@ -10,21 +10,44 @@ Read `release_notes.md` for commit level details.
10
10
 
11
11
  ### Deprecations
12
12
 
13
- ## [5.0.0]
13
+ ## [5.0.0] - 2021-11-05
14
14
 
15
15
  ### Enhancements
16
16
 
17
- - Update base selenium webdriver version to `4.0.0`
18
- - Support only W3C spec as following Selenium v4 client
17
+ - Update base selenium webdriver version to `v4`
18
+ - Base Selenium Ruby binding is now v4
19
+ - Support only W3C WebDriver spec (and a few Appium specific commands)
19
20
  - Support Ruby 2.6+
20
- - `element.id` returns the element id instead of `element.ref`. `element.ref` now returns an array.
21
- - Removed `desired_capabilities` as capabilities for `Appium::Core#for`. Please use `capabilities` key name instead
22
- - Removals that already had _duplication_ mark
21
+ - Add `driver#wait`, `driver#wait_until`, `driver#wait_true`, `driver#wait_until_true` syntaxes
22
+ - Can give `driver` instance as its block variable
23
+ - `element.id` returns the element id instead of `element.ref`.
24
+ - `element.ref` now returns an array.
25
+ - Removed `desired_capabilities` as capabilities for `Appium::Core#for`. Please use `capabilities` key name instead.
26
+ - e.g. `Appium::Core.for capabilities: {...}` instead of `Appium::Core.for desired_capabilities: {...}`
27
+ - Removed methods that had _Deprecated_ mark
23
28
  - Removed `driver#screenshot`. Please use `driver#save_screenshot` instead
24
29
  - Removed `driver#send_keys` to send keys to an active element. Please use `driver.action.send_keys('happy testing').perform` instead
25
30
  - Removed `forceMjsonwp` to send only MJSONWP capabilities since Selenium cleint v4 no longer supports MJSONWP
26
- - No longer set default `timeouts` as `0`. ruby_lib_core calls `/timeouts` endpoint only when `appium_lib: { wait: 5 }` is provided explicitly
31
+ - No longer set default `timeouts` as `0`
32
+ - ruby_lib_core calls `/timeouts` endpoint only when `appium_lib: { wait: 5 }` is provided explicitly
27
33
  - Raises `::Appium::Core::Error::ArgumentError` instead of `ArgumentError` for this library specific argument errors
34
+ - Removed Selendroid related methods
35
+
36
+ ### Deprecations
37
+ - `Appium::Core::TouchAction` and `Appium::Core::MultiTouch` are deprecated
38
+ - Please use W3C actions instead http://appium.io/docs/en/commands/interactions/actions/
39
+ - More working examples:
40
+ - [test/functional/android/webdriver/w3c_actions_test.rb](test/functional/android/webdriver/w3c_actions_test.rb)
41
+ - [test/functional/ios/webdriver/w3c_actions_test.rb](test/functional/ios/webdriver/w3c_actions_test.rb)
42
+ - [test/functional/common_w3c_actions.rb](test/functional/common_w3c_actions.rb)
43
+ - https://www.selenium.dev/documentation/support_packages/mouse_and_keyboard_actions_in_detail/
44
+ - https://www.youtube.com/watch?v=oAJ7jwMNFVU
45
+ - https://appiumpro.com/editions/30-ios-specific-touch-action-methods
46
+ - https://appiumpro.com/editions/29-automating-complex-gestures-with-the-w3c-actions-api
47
+ - `launch_app`, `close_app` and `reset`. Please read [issues#15807](https://github.com/appium/appium/issues/15807) for more details.
48
+ - `activate_app` or a new session request can be alternatives of `launch_app`
49
+ - `terminate_app` or close the session request can be alternatives of `close_app`
50
+ - Close current session and creating a new session, or `terminate_app` and `launch_app` can be alternatives of `reset`
28
51
 
29
52
  ## [4.7.1] - 2021-09-26
30
53
 
data/README.md CHANGED
@@ -13,6 +13,10 @@ This library wraps [selenium-webdriver](https://github.com/SeleniumHQ/selenium/w
13
13
  - http://www.rubydoc.info/github/appium/ruby_lib_core
14
14
  - You can find working API examples in test code, [test/functional](test/functional)
15
15
 
16
+ # Migration from v4 to v5
17
+
18
+ Please read `[5.0.0]` section in CHANGELOG.md
19
+
16
20
  # Related library
17
21
  - https://github.com/appium/ruby_lib
18
22
 
@@ -25,16 +25,13 @@ Gem::Specification.new do |spec|
25
25
  spec.add_runtime_dependency 'selenium-webdriver', '~> 4.0.0'
26
26
  spec.add_runtime_dependency 'faye-websocket', '~> 0.11.0'
27
27
 
28
- spec.add_development_dependency 'bundler', '>= 1.14'
29
28
  spec.add_development_dependency 'rake', '~> 13.0'
30
29
  spec.add_development_dependency 'yard', '~> 0.9.11'
31
30
  spec.add_development_dependency 'minitest', '~> 5.0'
32
31
  spec.add_development_dependency 'minitest-reporters', '~> 1.1'
33
32
  spec.add_development_dependency 'webmock', '~> 3.14.0'
34
- spec.add_development_dependency 'rubocop', '1.12.1'
33
+ spec.add_development_dependency 'rubocop', '1.22.3'
35
34
  spec.add_development_dependency 'appium_thor', '~> 1.0'
36
- spec.add_development_dependency 'pry'
37
- spec.add_development_dependency 'pry-byebug'
38
35
  spec.add_development_dependency 'parallel_tests'
39
36
  spec.add_development_dependency 'simplecov'
40
37
  end
data/bin/console CHANGED
@@ -6,9 +6,5 @@ require "appium_lib_core"
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
8
8
 
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
9
  require "irb"
14
10
  IRB.start(__FILE__)
@@ -11,7 +11,7 @@ steps:
11
11
  displayName: Installed node dependencies
12
12
  - task: UseRubyVersion@0
13
13
  inputs:
14
- versionSpec: '2.7'
14
+ versionSpec: '3.0'
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 &
@@ -1,7 +1,7 @@
1
1
  # jobs for functional test
2
2
  parameters:
3
3
  vmImage: 'macOS-10.15'
4
- vmImageForIOS: 'macOS-10.15' # Not sure the reason, but macOS 10.14 instance raises no info.plist error
4
+ vmImageForIOS: 'macOS-10.15'
5
5
  xcodeForIOS: 12.2
6
6
  xcodeForTVOS: 12.2
7
7
  androidSDK: 29 # API Level 30 emulators are more unstable than 29
@@ -51,7 +51,7 @@ module Appium
51
51
  end
52
52
 
53
53
  # Override
54
- # Creates session handling both OSS and W3C dialects.
54
+ # Creates session handling.
55
55
  #
56
56
  # @param [::Selenium::WebDriver::Remote::Capabilities, Hash] capabilities A capability
57
57
  # @return [::Selenium::WebDriver::Remote::Capabilities]
@@ -187,8 +187,8 @@ module Appium
187
187
 
188
188
  # Port from MJSONWP
189
189
  def send_keys_to_active_element(key)
190
- text = ::Selenium::WebDriver::Keys.encode(key).join('')
191
- execute :send_keys_to_active_element, {}, { value: text.split(//) }
190
+ text = ::Selenium::WebDriver::Keys.encode(key).join
191
+ execute :send_keys_to_active_element, {}, { value: text.chars }
192
192
  end
193
193
 
194
194
  # For Appium
@@ -319,11 +319,9 @@ module Appium
319
319
  data = execute :get_log, {}, { type: type.to_s }
320
320
 
321
321
  Array(data).map do |l|
322
- begin
323
- ::Selenium::WebDriver::LogEntry.new l.fetch('level', 'UNKNOWN'), l.fetch('timestamp'), l.fetch('message')
324
- rescue KeyError
325
- next
326
- end
322
+ ::Selenium::WebDriver::LogEntry.new l.fetch('level', 'UNKNOWN'), l.fetch('timestamp'), l.fetch('message')
323
+ rescue KeyError
324
+ next
327
325
  end
328
326
  end
329
327
 
@@ -21,6 +21,7 @@ require_relative 'rotable'
21
21
  require_relative 'remote_status'
22
22
  require_relative 'has_location'
23
23
  require_relative 'has_network_connection'
24
+ require_relative '../wait'
24
25
 
25
26
  module Appium
26
27
  module Core
@@ -38,6 +39,8 @@ module Appium
38
39
  include ::Appium::Core::Base::HasLocation
39
40
  include ::Appium::Core::Base::HasNetworkConnection
40
41
 
42
+ include ::Appium::Core::Waitable
43
+
41
44
  private
42
45
 
43
46
  # Private API.
@@ -45,14 +48,18 @@ module Appium
45
48
  attr_reader :bridge
46
49
 
47
50
  def initialize(bridge: nil, listener: nil, **opts)
51
+ # For ::Appium::Core::Waitable
52
+ @wait_timeout = opts.delete(:wait_timeout)
53
+ @wait_interval = opts.delete(:wait_interval)
54
+
55
+ # For logging.
56
+ # TODO: Remove when appium core no longer uses this in this bridge.
57
+ @automation_name = opts.delete(:automation_name)
58
+
48
59
  super
49
60
  end
50
61
 
51
- # Implements protocol handshake which:
52
- #
53
- # 1. Creates session with driver.
54
- # 2. Sniffs response.
55
- # 3. Based on the response, understands which dialect we should use.
62
+ # Create a proper bridge instance.
56
63
  #
57
64
  # @return [::Appium::Core::Base::Bridge]
58
65
  #
@@ -83,7 +90,7 @@ module Appium
83
90
  def update_sending_request_to(protocol:, host:, port:, path:)
84
91
  unless @bridge.http&.class&.method_defined? :update_sending_request_to
85
92
  ::Appium::Logger.warn "#{@bridge.http&.class} has no 'update_sending_request_to'. " \
86
- 'It keeps current connection target.'
93
+ 'It keeps current connection target.'
87
94
  return
88
95
  end
89
96
 
@@ -411,17 +418,9 @@ module Appium
411
418
  alias set_context context=
412
419
 
413
420
  # Place a file in a specific location on the device.
414
- # On iOS, the server should have ifuse libraries installed and configured properly for this feature to work on
415
- # real devices.
416
421
  # On Android, the application under test should be built with debuggable flag enabled in order to get access to
417
422
  # its container on the internal file system.
418
423
  #
419
- # {https://github.com/libimobiledevice/ifuse iFuse GitHub page6}
420
- #
421
- # {https://github.com/osxfuse/osxfuse/wiki/FAQ osxFuse FAQ}
422
- #
423
- # {https://developer.android.com/studio/debug 'Debug Your App' developer article}
424
- #
425
424
  # @param [String] path Either an absolute path OR, for iOS devices, a path relative to the app, as described.
426
425
  # If the path starts with application id prefix, then the file will be pushed to the root of
427
426
  # the corresponding application container.
@@ -438,18 +437,10 @@ module Appium
438
437
  @bridge.push_file(path, filedata)
439
438
  end
440
439
 
441
- # Pull a file from the simulator/device.
442
- # On iOS the server should have ifuse
443
- # libraries installed and configured properly for this feature to work on real devices.
440
+ # Pull a file from the remote device.
444
441
  # On Android the application under test should be built with debuggable flag enabled in order to get access
445
442
  # to its container on the internal file system.
446
443
  #
447
- # {https://github.com/libimobiledevice/ifuse iFuse GitHub page6}
448
- #
449
- # {https://github.com/osxfuse/osxfuse/wiki/FAQ osxFuse FAQ}
450
- #
451
- # {https://developer.android.com/studio/debug 'Debug Your App' developer article}
452
- #
453
444
  # @param [String] path Either an absolute path OR, for iOS devices, a path relative to the app, as described.
454
445
  # If the path starts with application id prefix, then the file will be pulled from the root
455
446
  # of the corresponding application container.
@@ -458,7 +449,6 @@ module Appium
458
449
  # Only pulling files from application containers is supported for iOS Simulator.
459
450
  # Provide the remote path in format
460
451
  # <code>@bundle.identifier:container_type/relative_path_in_container</code>
461
- # (Make sure this in ifuse doc)
462
452
  #
463
453
  # @return [Base64-decoded] Base64 decoded data
464
454
  #
@@ -475,18 +465,10 @@ module Appium
475
465
  @bridge.pull_file(path)
476
466
  end
477
467
 
478
- # Pull a folder content from the simulator/device.
479
- # On iOS the server should have ifuse libraries installed and configured properly for this feature to work
480
- # on real devices.
468
+ # Pull a folder content from the remote device.
481
469
  # On Android the application under test should be built with debuggable flag enabled in order to get access to
482
470
  # its container on the internal file system.
483
471
  #
484
- # {https://github.com/libimobiledevice/ifuse iFuse GitHub page6}
485
- #
486
- # {https://github.com/osxfuse/osxfuse/wiki/FAQ osxFuse FAQ}
487
- #
488
- # {https://developer.android.com/studio/debug 'Debug Your App' developer article}
489
- #
490
472
  # @param [String] path Absolute path to the folder.
491
473
  # If the path starts with <em>@applicationId/</em> prefix, then the folder will be pulled
492
474
  # from the root of the corresponding application container.
@@ -495,7 +477,6 @@ module Appium
495
477
  # Only pulling files from application containers is supported for iOS Simulator.
496
478
  # Provide the remote path in format
497
479
  # <code>@bundle.identifier:container_type/relative_path_in_container</code>
498
- # (Make sure this in ifuse doc)
499
480
  #
500
481
  # @return [Base64-decoded] Base64 decoded data which is zip archived
501
482
  #
@@ -509,19 +490,6 @@ module Appium
509
490
  @bridge.pull_folder(path)
510
491
  end
511
492
 
512
- # Send keyevent on the device.(Only for Selendroid)
513
- # http://developer.android.com/reference/android/view/KeyEvent.html
514
- # @param [integer] key The key to press.
515
- # @param [String] metastate The state the metakeys should be in when pressing the key.
516
- #
517
- # @example
518
- #
519
- # @driver.keyevent 82
520
- #
521
- def keyevent(key, metastate = nil)
522
- @bridge.keyevent(key, metastate)
523
- end
524
-
525
493
  # Press keycode on the device.
526
494
  # http://developer.android.com/reference/android/view/KeyEvent.html
527
495
  # @param [Integer] key The key to press. The values which have +KEYCODE_+ prefix in http://developer.android.com/reference/android/view/KeyEvent.html
@@ -566,6 +534,7 @@ module Appium
566
534
  @bridge.long_press_keycode(key, metastate: metastate, flags: flags)
567
535
  end
568
536
 
537
+ # @deprecated Except for Windows
569
538
  # Start the simulator and application configured with desired capabilities
570
539
  #
571
540
  # @example
@@ -573,9 +542,16 @@ module Appium
573
542
  # @driver.launch_app
574
543
  #
575
544
  def launch_app
545
+ # TODO: Define only in Windows module when ruby_lib_core removes this method
546
+ if @automation_name != :windows
547
+ ::Appium::Logger.warn(
548
+ '[DEPRECATION] launch_app is deprecated. Please use activate_app instead.'
549
+ )
550
+ end
576
551
  @bridge.launch_app
577
552
  end
578
553
 
554
+ # @deprecated Except for Windows
579
555
  # Close an app on device
580
556
  #
581
557
  # @example
@@ -583,9 +559,16 @@ module Appium
583
559
  # @driver.close_app
584
560
  #
585
561
  def close_app
562
+ # TODO: Define only in Windows module when ruby_lib_core removes this method
563
+ if @automation_name != :windows
564
+ ::Appium::Logger.warn(
565
+ '[DEPRECATION] close_app is deprecated. Please use terminate_app instead.'
566
+ )
567
+ end
586
568
  @bridge.close_app
587
569
  end
588
570
 
571
+ # @deprecated
589
572
  # Reset the device, relaunching the application.
590
573
  #
591
574
  # @example
@@ -593,6 +576,10 @@ module Appium
593
576
  # @driver.reset
594
577
  #
595
578
  def reset
579
+ ::Appium::Logger.warn(
580
+ '[DEPRECATION] reset is deprecated. Please use terminate_app and activate_app, ' \
581
+ 'or quit and create a new session instead.'
582
+ )
596
583
  @bridge.reset
597
584
  end
598
585
 
@@ -810,7 +797,7 @@ module Appium
810
797
  #
811
798
  # @example: Zoom
812
799
  #
813
- # f1 = @driver.action.add_pointer_input(:touch, 'finger1')
800
+ # f1 = ::Selenium::WebDriver::Interactions.pointer(:touch, name: 'finger1')
814
801
  # f1.create_pointer_move(duration: 1, x: 200, y: 500,
815
802
  # origin: ::Selenium::WebDriver::Interactions::PointerMove::VIEWPORT)
816
803
  # f1.create_pointer_down(:left)
@@ -818,7 +805,7 @@ module Appium
818
805
  # origin: ::Selenium::WebDriver::Interactions::PointerMove::VIEWPORT)
819
806
  # f1.create_pointer_up(:left)
820
807
  #
821
- # f2 = @driver.action.add_pointer_input(:touch, 'finger2')
808
+ # f2 = ::Selenium::WebDriver::Interactions.pointer(:touch, name: 'finger2')
822
809
  # f2.create_pointer_move(duration: 1, x: 200, y: 500,
823
810
  # origin: ::Selenium::WebDriver::Interactions::PointerMove::VIEWPORT)
824
811
  # f2.create_pointer_down(:left)
@@ -831,6 +818,10 @@ module Appium
831
818
  def perform_actions(data)
832
819
  raise ::Appium::Core::Error::ArgumentError, "'#{data}' must be Array" unless data.is_a? Array
833
820
 
821
+ # NOTE: 'add_input' in Selenium Ruby implementation has additional 'pause'.
822
+ # This implementation is to avoid the additional pause.
823
+ # https://github.com/SeleniumHQ/selenium/blob/64447d4b03f6986337d1ca8d8b6476653570bcc1/rb/lib/selenium/webdriver/common/action_builder.rb#L207
824
+
834
825
  @bridge.send_actions data.map(&:encode).compact
835
826
  data.each(&:clear_actions)
836
827
  nil
@@ -63,8 +63,8 @@ module Appium
63
63
  def save_element_screenshot(element, png_path)
64
64
  extension = File.extname(png_path).downcase
65
65
  if extension != '.png'
66
- ::Appium::Logger.warn 'name used for saved screenshot does not match file type. '\
67
- 'It should end with .png extension'
66
+ ::Appium::Logger.warn 'name used for saved screenshot does not match file type. ' \
67
+ 'It should end with .png extension'
68
68
  end
69
69
  File.open(png_path, 'wb') { |f| f << element_screenshot_as(element, :png) }
70
70
  end
@@ -32,6 +32,7 @@ module Appium
32
32
  predicate: '-ios predicate string',
33
33
  class_chain: '-ios class chain',
34
34
  # Windows with windows prefix
35
+ # @deprecated
35
36
  windows_uiautomation: '-windows uiautomation',
36
37
  # Tizen with Tizen prefix
37
38
  tizen_uiautomation: '-tizen uiautomation'
@@ -122,6 +123,7 @@ module Appium
122
123
  # e.tag_name #=> "XCUIElementTypeStaticText"
123
124
  #
124
125
  # # For Windows
126
+ # # @deprecated
125
127
  # @driver.find_elements :windows_uiautomation, '....'
126
128
  #
127
129
  # # For Tizen
@@ -158,6 +160,12 @@ module Appium
158
160
  private
159
161
 
160
162
  def _set_by_from_finders(how)
163
+ if how == :windows_uiautomation
164
+ ::Appium::Logger.warn(
165
+ '[DEPRECATION] :windows_uiautomation is deprecated. Please use other locators.'
166
+ )
167
+ end
168
+
161
169
  by = FINDERS[how.to_sym]
162
170
  unless by
163
171
  raise ::Appium::Core::Error::ArgumentError,
@@ -213,8 +213,6 @@ module Appium
213
213
  hide_keyboard: [:post, 'session/:session_id/appium/device/hide_keyboard'],
214
214
  press_keycode: [:post, 'session/:session_id/appium/device/press_keycode'],
215
215
  long_press_keycode: [:post, 'session/:session_id/appium/device/long_press_keycode'],
216
- # keyevent is only for Selendroid
217
- keyevent: [:post, 'session/:session_id/appium/device/keyevent'],
218
216
  push_file: [:post, 'session/:session_id/appium/device/push_file'],
219
217
  pull_file: [:post, 'session/:session_id/appium/device/pull_file'],
220
218
  pull_folder: [:post, 'session/:session_id/appium/device/pull_folder'],
@@ -20,11 +20,13 @@ module Appium
20
20
  class Base
21
21
  module Device
22
22
  module TouchActions
23
+ # @deprecated Use W3C actions instead
23
24
  def touch_actions(actions)
24
25
  actions = { actions: [actions].flatten }
25
26
  execute :touch_actions, {}, actions
26
27
  end
27
28
 
29
+ # @deprecated Use W3C actions instead
28
30
  def multi_touch(actions)
29
31
  execute :multi_touch, {}, actions: actions
30
32
  end
@@ -39,11 +39,11 @@ module Appium
39
39
  end
40
40
 
41
41
  # Keep .split(//) for backward compatibility for now
42
- text = keys.join('')
42
+ text = keys.join
43
43
 
44
44
  # FIXME: further work for W3C. Over appium 1.15.0 or later
45
45
  # { value: text.split(//), text: text }
46
- { value: text.split(//) }
46
+ { value: text.chars }
47
47
  end
48
48
  end # module Value
49
49
  end # module Device
@@ -14,6 +14,9 @@
14
14
 
15
15
  module Appium
16
16
  module Core
17
+ #
18
+ # @deprecated Use W3C actions instead
19
+ #
17
20
  # MultiTouch actions allow for multiple touches to happen at the same time,
18
21
  # for instance, to simulate multiple finger swipes.
19
22
  #
@@ -21,6 +24,18 @@ module Appium
21
24
  # add to a new MultiTouch action. When ready, call +prepare()+ and all
22
25
  # actions will be executed simultaneously.
23
26
  #
27
+ # Consider to use W3C spec touch action like the followings.
28
+ # https://www.selenium.dev/selenium/docs/api/rb/Selenium/WebDriver/PointerActions.html
29
+ # https://github.com/appium/ruby_lib_core/blob/master/test/functional/android/webdriver/w3c_actions_test.rb
30
+ # https://github.com/appium/ruby_lib_core/blob/master/test/functional/ios/webdriver/w3c_actions_test.rb
31
+ #
32
+ # About W3C actions
33
+ # https://www.youtube.com/watch?v=oAJ7jwMNFVU
34
+ # https://appiumpro.com/editions/30-ios-specific-touch-action-methods
35
+ # https://appiumpro.com/editions/29-automating-complex-gestures-with-the-w3c-actions-api
36
+ #
37
+ # Functional test code in ruby_lib_core repository also helps.
38
+ #
24
39
  # @example
25
40
  #
26
41
  # @driver = Appium::Core.for(opts).start_driver
@@ -36,6 +51,10 @@ module Appium
36
51
  attr_reader :driver
37
52
 
38
53
  def initialize(driver)
54
+ ::Appium::Logger.warn(
55
+ '[DEPRECATION] Appium::Core::MultiTouch is deprecated in W3C spec. Use W3C actions instead'
56
+ )
57
+
39
58
  @actions = []
40
59
  @driver = driver
41
60
  end
@@ -14,16 +14,26 @@
14
14
 
15
15
  module Appium
16
16
  module Core
17
+ #
18
+ # @deprecated Use W3C actions instead
19
+ #
17
20
  # Perform a series of gestures, one after another. Gestures are chained
18
21
  # together and only performed when +perform()+ is called. Default is conducted by global driver.
19
22
  #
20
23
  # Each method returns the object itself, so calls can be chained.
21
24
  #
22
25
  # Consider to use W3C spec touch action like the followings.
23
- # https://seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/W3CActionBuilder.html
26
+ # https://www.selenium.dev/selenium/docs/api/rb/Selenium/WebDriver/PointerActions.html
24
27
  # https://github.com/appium/ruby_lib_core/blob/master/test/functional/android/webdriver/w3c_actions_test.rb
25
28
  # https://github.com/appium/ruby_lib_core/blob/master/test/functional/ios/webdriver/w3c_actions_test.rb
26
29
  #
30
+ # About W3C actions
31
+ # https://www.youtube.com/watch?v=oAJ7jwMNFVU
32
+ # https://appiumpro.com/editions/30-ios-specific-touch-action-methods
33
+ # https://appiumpro.com/editions/29-automating-complex-gestures-with-the-w3c-actions-api
34
+ #
35
+ # Functional test code in ruby_lib_core repository also helps.
36
+ #
27
37
  # @example
28
38
  #
29
39
  # @driver = Appium::Core.for(opts).start_driver
@@ -39,6 +49,10 @@ module Appium
39
49
  attr_reader :actions, :driver
40
50
 
41
51
  def initialize(driver)
52
+ ::Appium::Logger.warn(
53
+ '[DEPRECATION] Appium::Core::TouchAction is deprecated in W3C spec. Use W3C actions instead'
54
+ )
55
+
42
56
  @actions = []
43
57
  @driver = driver
44
58
  end
@@ -38,6 +38,8 @@ module Appium
38
38
  #
39
39
  # result = Appium::Core::Wait.until { @driver.find_element(:id, 'something') }
40
40
  #
41
+ # result = Appium::Core::Wait.until(timeout: 30, message: 'timeout') { @driver.find_element(:id, 'something') }
42
+ #
41
43
  # result = Appium::Core::Wait.until(object: 'some object') { |object|
42
44
  # @driver.find_element(:id, object)
43
45
  # }
@@ -82,6 +84,8 @@ module Appium
82
84
  #
83
85
  # Appium::Core::Wait.until_true { @driver.find_element(:id, 'something') }
84
86
  #
87
+ # Appium::Core::Wait.until_true(timeout: 30) { @driver.find_element(:id, 'something') }
88
+ #
85
89
  # Appium::Core::Wait.until_true(object: 'some object') { |object|
86
90
  # @driver.find_element(:id, object)
87
91
  # }
@@ -133,17 +137,31 @@ module Appium
133
137
  # @param [String] message Exception message if timed out.
134
138
  # @param [Array, Exception] ignored Exceptions to ignore while polling (default: Exception)
135
139
  #
136
- # @example
140
+ # @example With core instance
137
141
  #
138
142
  # @core.wait_true { @driver.find_element :accessibility_id, 'something' }
143
+ # @core.wait_true(timeout: 30, interval: 2) { @driver.find_element :accessibility_id, 'something' }
144
+ #
145
+ # @core.wait_until_true { @driver.find_element :accessibility_id, 'something' }
146
+ # @core.wait_until_true(timeout: 30, interval: 2) { @driver.find_element :accessibility_id, 'something' }
147
+ #
148
+ # @example With driver instance
149
+ #
150
+ # @driver.wait_true { |d| d.find_element :accessibility_id, 'something' }
151
+ # @driver.wait_true(timeout: 30, interval: 2) { |d| driver.find_element :accessibility_id, 'something' }
139
152
  #
140
- def wait_true(timeout: nil, interval: nil, message: nil, ignored: nil)
153
+ # @driver.wait_until_true { |d| d.find_element :accessibility_id, 'something' }
154
+ # @driver.wait_until_true(timeout: 30, interval: 2) { |d| driver.find_element :accessibility_id, 'something' }
155
+ #
156
+ def wait_until_true(timeout: nil, interval: nil, message: nil, ignored: nil, &block)
141
157
  Wait.until_true(timeout: timeout || @wait_timeout,
142
158
  interval: interval || @wait_interval,
143
159
  message: message,
144
160
  ignored: ignored,
145
- object: self) { yield }
161
+ object: self,
162
+ &block)
146
163
  end
164
+ alias wait_true wait_until_true
147
165
 
148
166
  # Check every interval seconds to see if yield doesn't raise an exception.
149
167
  # Give up after timeout seconds.
@@ -155,17 +173,31 @@ module Appium
155
173
  # @param [String] message Exception message if timed out.
156
174
  # @param [Array, Exception] ignored Exceptions to ignore while polling (default: Exception)
157
175
  #
158
- # @example
176
+ # @example With core instance
159
177
  #
160
178
  # @core.wait { @driver.find_element :accessibility_id, 'something' }
179
+ # @core.wait(timeout: 30, interval: 2) { @driver.find_element :accessibility_id, 'something' }
180
+ #
181
+ # @core.wait_until { @driver.find_element :accessibility_id, 'something' }
182
+ # @core.wait_until(timeout: 30, interval: 2) { @driver.find_element :accessibility_id, 'something' }
183
+ #
184
+ # @example With driver instance
185
+ #
186
+ # @driver.wait { @driver.find_element :accessibility_id, 'something' }
187
+ # @driver.wait(timeout: 30, interval: 2) { @driver.find_element :accessibility_id, 'something' }
188
+ #
189
+ # @driver.wait_until { |d| d.find_element :accessibility_id, 'something' }
190
+ # @driver.wait_until(timeout: 30, interval: 2) { |d| d.find_element :accessibility_id, 'something' }
161
191
  #
162
- def wait(timeout: nil, interval: nil, message: nil, ignored: nil)
192
+ def wait_until(timeout: nil, interval: nil, message: nil, ignored: nil, &block)
163
193
  Wait.until(timeout: timeout || @wait_timeout,
164
194
  interval: interval || @wait_interval,
165
195
  message: message,
166
196
  ignored: ignored,
167
- object: self) { yield }
197
+ object: self,
198
+ &block)
168
199
  end
200
+ alias wait wait_until
169
201
  end
170
202
  end # module Core
171
203
  end # module Appium
@@ -51,7 +51,7 @@ module Appium
51
51
 
52
52
  @port = appium_lib_opts.fetch :port, Driver::DEFAULT_APPIUM_PORT
53
53
 
54
- # timeout and interval used in ::Appium::Comm.wait/wait_true
54
+ # timeout and interval used in ::Appium::Commn.wait/wait_true
55
55
  @wait_timeout = appium_lib_opts.fetch :wait_timeout, ::Appium::Core::Wait::DEFAULT_TIMEOUT
56
56
  @wait_interval = appium_lib_opts.fetch :wait_interval, ::Appium::Core::Wait::DEFAULT_INTERVAL
57
57
 
@@ -320,7 +320,7 @@ module Appium
320
320
  #
321
321
  # # Start iOS driver
322
322
  # opts = {
323
- # caps: {
323
+ # capabilities: {
324
324
  # platformName: :ios,
325
325
  # platformVersion: '11.0',
326
326
  # deviceName: 'iPhone Simulator',
@@ -364,7 +364,10 @@ module Appium
364
364
  @driver = ::Appium::Core::Base::Driver.new(listener: @listener,
365
365
  http_client: @http_client,
366
366
  capabilities: @caps, # ::Selenium::WebDriver::Remote::Capabilities
367
- url: @custom_url)
367
+ url: @custom_url,
368
+ wait_timeout: @wait_timeout,
369
+ wait_interval: @wait_interval,
370
+ automation_name: @automation_name)
368
371
 
369
372
  if @direct_connect
370
373
  d_c = DirectConnections.new(@driver.capabilities)
@@ -14,7 +14,7 @@
14
14
 
15
15
  module Appium
16
16
  module Core
17
- VERSION = '5.0.0.rc5' unless defined? ::Appium::Core::VERSION
18
- DATE = '2021-10-15' unless defined? ::Appium::Core::DATE
17
+ VERSION = '5.0.0' unless defined? ::Appium::Core::VERSION
18
+ DATE = '2021-11-05' unless defined? ::Appium::Core::DATE
19
19
  end
20
20
  end
data/release_notes.md CHANGED
@@ -1,3 +1,27 @@
1
+ #### v5.0.0 2021-11-05
2
+
3
+ - [e2d1e2d](https://github.com/appium/ruby_lib_core/commit/e2d1e2da59b10f84b3c8ecafba7be6ab27223b73) Release 5.0.0
4
+ - [ac4c312](https://github.com/appium/ruby_lib_core/commit/ac4c312b7e6b314a5e23463d930fb6a957ec3e8f) chore: cleanup dev dependencies
5
+ - [0c84f30](https://github.com/appium/ruby_lib_core/commit/0c84f30a1623445576df70de54d8c46e40948d18) bump rc to 8
6
+ - [8c42356](https://github.com/appium/ruby_lib_core/commit/8c423566315b47cf99150a38be09b059aab4d358) chore: add deprecated in app management (#353)
7
+ - [5ad23bc](https://github.com/appium/ruby_lib_core/commit/5ad23bc0826c7afa36a95066b65aeb00f1742ad8) chore: use ::Selenium::WebDriver::Interactions.pointer as example (#352)
8
+ - [a77a6eb](https://github.com/appium/ruby_lib_core/commit/a77a6ebd87b1116254c4900cebd900a3d106940e) chore: create links
9
+ - [bc13166](https://github.com/appium/ruby_lib_core/commit/bc13166ac7f2e65d94acdf3cff1841863f4b59fe) chore: tweak the order of changelog
10
+ - [a6fa1b9](https://github.com/appium/ruby_lib_core/commit/a6fa1b9a68584915646ff11fef4cc70a750d5d79) chore: add deprecation mark for windows (#351)
11
+ - [c7286ed](https://github.com/appium/ruby_lib_core/commit/c7286eda8bfbaa49154b12d024187fd384171d4e) chore(deps-dev): update rubocop requirement from = 1.22.2 to = 1.22.3 (#350)
12
+ - [d30dff4](https://github.com/appium/ruby_lib_core/commit/d30dff483dec6d0fec67b01f1a28a8c6612e32e6) bump version to 5.0.0.rc7
13
+ - [7f0fe5a](https://github.com/appium/ruby_lib_core/commit/7f0fe5aedf43c9f81636b8db7efd505e93850f00) chore: add deprecations for TouchAction and Multitouch (#348)
14
+ - [9ed1202](https://github.com/appium/ruby_lib_core/commit/9ed1202a7979500a4744ceb340827b16137eb188) chore: remove selendroid stuff (#349)
15
+ - [fc37c9f](https://github.com/appium/ruby_lib_core/commit/fc37c9f1841fcb7efb5c23cf9200a13d0d35bdcf) chore: pass wait_timeout and wait_interval (#346)
16
+ - [1da3e75](https://github.com/appium/ruby_lib_core/commit/1da3e753907ac431d925a1489a50af3fa406638f) chore: bump to rc6
17
+ - [61ebace](https://github.com/appium/ruby_lib_core/commit/61ebaceaf2d4a6450356a0a51ffe67cab0b33287) feat: add a few new wait syntaxes (#344)
18
+ - [d6f73b1](https://github.com/appium/ruby_lib_core/commit/d6f73b131fd6c8da96b45edfaa6c6db9a85b383a) chore(deps-dev): update rubocop requirement from = 1.22.1 to = 1.22.2 (#345)
19
+ - [0d69af1](https://github.com/appium/ruby_lib_core/commit/0d69af1b93deefd343c910833557a39ceaef59da) chore: cleanup a bit (#342)
20
+ - [115465e](https://github.com/appium/ruby_lib_core/commit/115465e2b73e65dd3777e698d98f1cdaa161f3eb) chore: append example in wait
21
+ - [ad519ee](https://github.com/appium/ruby_lib_core/commit/ad519ee70ba7b7122107b8b2d986ff1523b654d0) chore: update rubocop (#341)
22
+ - [e13b0ef](https://github.com/appium/ruby_lib_core/commit/e13b0efae6b964cc6b0e7b0ed10816eaf6e007d4) feat: selenium v4 base (#315)
23
+
24
+
1
25
  #### v4.7.1 2021-09-26
2
26
 
3
27
  - [cdd8906](https://github.com/appium/ruby_lib_core/commit/cdd890662585aa5051912d20d90ec3c3866ad8b1) Release 4.7.1
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.0.0.rc5
4
+ version: 5.0.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: 2021-10-15 00:00:00.000000000 Z
11
+ date: 2021-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.11.0
41
- - !ruby/object:Gem::Dependency
42
- name: bundler
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '1.14'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '1.14'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: rake
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +114,14 @@ dependencies:
128
114
  requirements:
129
115
  - - '='
130
116
  - !ruby/object:Gem::Version
131
- version: 1.12.1
117
+ version: 1.22.3
132
118
  type: :development
133
119
  prerelease: false
134
120
  version_requirements: !ruby/object:Gem::Requirement
135
121
  requirements:
136
122
  - - '='
137
123
  - !ruby/object:Gem::Version
138
- version: 1.12.1
124
+ version: 1.22.3
139
125
  - !ruby/object:Gem::Dependency
140
126
  name: appium_thor
141
127
  requirement: !ruby/object:Gem::Requirement
@@ -150,34 +136,6 @@ dependencies:
150
136
  - - "~>"
151
137
  - !ruby/object:Gem::Version
152
138
  version: '1.0'
153
- - !ruby/object:Gem::Dependency
154
- name: pry
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: '0'
167
- - !ruby/object:Gem::Dependency
168
- name: pry-byebug
169
- requirement: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - ">="
172
- - !ruby/object:Gem::Version
173
- version: '0'
174
- type: :development
175
- prerelease: false
176
- version_requirements: !ruby/object:Gem::Requirement
177
- requirements:
178
- - - ">="
179
- - !ruby/object:Gem::Version
180
- version: '0'
181
139
  - !ruby/object:Gem::Dependency
182
140
  name: parallel_tests
183
141
  requirement: !ruby/object:Gem::Requirement
@@ -336,9 +294,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
336
294
  version: '2.6'
337
295
  required_rubygems_version: !ruby/object:Gem::Requirement
338
296
  requirements:
339
- - - ">"
297
+ - - ">="
340
298
  - !ruby/object:Gem::Version
341
- version: 1.3.1
299
+ version: '0'
342
300
  requirements: []
343
301
  rubygems_version: 3.2.15
344
302
  signing_key: