appium_lib_core 5.0.0.rc3 → 5.0.0.rc7

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: 007f4811a4dfb2fa4592354eb4e736482436e72e155b51958156025fda15f0be
4
- data.tar.gz: 2197f6bd36999883b43673da670e43032569bd2eb75860753d8e8a1b2461a467
3
+ metadata.gz: 86c326e32b6a255221e4eeb9c4636a2ad9862e33c536099fd926b5f75aa722ca
4
+ data.tar.gz: 42badc486fa895ccad392a404778cf59fc6bdf3ef8cd084e67375b757a6066ef
5
5
  SHA512:
6
- metadata.gz: f586786cec414da935ae88599866a199c9350715a7cb71f41fb47dfe8f9eef8e4e81043349d0d5619662f53ea56279ec196a95f7594ab73ff8f8bcf0ffc30699
7
- data.tar.gz: 792b6474ab0a6b5096c6cd20a467af3f2fe480bf3459fcdb2d8ae5791a4cbd5efdd50b369b9fe610fa032d49e77000f4628272f8f9bf1bc51fd5918d4e3be55c
6
+ metadata.gz: 0e7d2d0a230bc1de4396276a7eebf7963e71253214d2f57910f3ff25f1f7ee6979f59c22d5d63874bf4dc6f4f68417710454b1fb8870060a0ad20db2b9c65048
7
+ data.tar.gz: e3bdca124e8d17d4452f1a9bfc98c7246c4de6ff8593c579a21849593715e112545bf8a934f4babd8da9332a53aba904f22ec4b20ffc320d6e8b5ca86e256858
@@ -11,7 +11,7 @@ jobs:
11
11
  strategy:
12
12
  fail-fast: false
13
13
  matrix:
14
- ruby: [2.5, 2.6, 2.7, 3.0]
14
+ ruby: [2.6, 2.7, 3.0]
15
15
 
16
16
  runs-on: ubuntu-latest
17
17
 
@@ -29,16 +29,15 @@ 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:
38
38
  fail-fast: false
39
39
  matrix:
40
- # Does not add 2.7 on Windows so far since a command fails only on Windows
41
- ruby: [2.5, 2.6]
40
+ ruby: [2.6, 2.7, 3.0]
42
41
 
43
42
  runs-on: windows-latest
44
43
 
@@ -58,11 +57,11 @@ jobs:
58
57
  gem uninstall --force eventmachine && gem install eventmachine --platform ruby
59
58
  - name: Run tests
60
59
  run: |
61
- parallel_test test/unit/ -n 4
60
+ rake test:unit
62
61
 
63
62
  setx AUTOMATION_NAME_DROID espresso
64
- parallel_test test/unit/android -n 4
63
+ rake test:unit:android
65
64
 
66
65
  setx AUTOMATION_NAME_DROID appium
67
66
  setx AUTOMATION_NAME_IOS appium
68
- 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
@@ -5,20 +5,43 @@ Read `release_notes.md` for commit level details.
5
5
  ## [Unreleased]
6
6
 
7
7
  ### Enhancements
8
- - Allow to override an existing method by `Appium::Core::Base::Driver#add_command` since Appium drivers/plugins allow to override them
9
8
 
10
9
  ### Bug fixes
11
10
 
12
11
  ### Deprecations
13
12
 
14
- ## [5.0.0.beta]
13
+ ## [5.0.0]
14
+
15
+ ### Enhancements
15
16
 
16
- - Update base selenium webdriver version to `4.0.0.beta2`
17
- - Support only W3C spec
18
- - Support Ruby 2.5+
17
+ - Update base selenium webdriver version to `4.0.0`
18
+ - Support only W3C spec as following Selenium v4 client
19
+ - 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
23
+ - Removed `driver#screenshot`. Please use `driver#save_screenshot` instead
24
+ - Removed `driver#send_keys` to send keys to an active element. Please use `driver.action.send_keys('happy testing').perform` instead
25
+ - 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
19
27
  - Raises `::Appium::Core::Error::ArgumentError` instead of `ArgumentError` for this library specific argument errors
20
- - Removed `desired_capabilities` from capabilities. Please use `capabilities` instead.
21
- - `element.ref` returns not only element id. It returns an array like `[:driver, id]`. You should do `_, element_id = element.ref` to get the element id
28
+ - Add `driver#wait`, `driver#wait_until`, `driver#wait_true`, `driver#wait_until_true` syntaxes
29
+ - Can give `driver` instance as its block variable
30
+
31
+ ### Deprecations
32
+ - `Appium::Core::TouchAction` and `Appium::Core::MultiTouch` are deprecated
33
+ - Please use W3C actions instead http://appium.io/docs/en/commands/interactions/actions/
34
+ - More working examples:
35
+ - test/functional/android/webdriver/w3c_actions_test.rb
36
+ - test/functional/ios/webdriver/w3c_actions_test.rb
37
+ - test/functional/common_w3c_actions.rb
38
+ - https://www.selenium.dev/documentation/support_packages/mouse_and_keyboard_actions_in_detail/
39
+ - Removed Selendroid related methods
40
+
41
+ ## [4.7.1] - 2021-09-26
42
+
43
+ ### Enhancements
44
+ - Allow to override an existing method by `Appium::Core::Base::Driver#add_command` since Appium drivers/plugins allow to override them
22
45
 
23
46
  ## [4.7.0] - 2021-07-17
24
47
 
data/README.md CHANGED
@@ -79,7 +79,7 @@ $ PARALLEL=1 bundle exec parallel_test test/functional/ios -n 2
79
79
 
80
80
  - Runs on CI environment (on Azure)
81
81
  - Non `IGNORE_VERSION_SKIP` or `IGNORE_VERSION_SKIP=true` runs all tests ignoring `skip` them by Appium versions
82
- - `IGNORE_VERSION_SKIP=false` skips the following tests if the Appium version is lower than the requirement
82
+ - `IGNORE_VERSION_SKIP=false` skips the following tests if the Appium version is lower than the requirement
83
83
 
84
84
  ```
85
85
  $ IGNORE_VERSION_SKIP=true CI=true bundle exec rake test:func:android
@@ -93,9 +93,9 @@ $ IGNORE_VERSION_SKIP=true CI=true bundle exec rake test:func:android
93
93
  ```ruby
94
94
  require 'rubygems'
95
95
  require 'appium_lib_core'
96
-
96
+
97
97
  opts = {
98
- desired_capabilities: { # or { caps: {....} }
98
+ capabilities: { # or { caps: {....} }
99
99
  platformName: :ios,
100
100
  platformVersion: '11.0',
101
101
  deviceName: 'iPhone Simulator',
@@ -108,7 +108,7 @@ $ IGNORE_VERSION_SKIP=true CI=true bundle exec rake test:func:android
108
108
  }
109
109
  @core = Appium::Core.for(opts) # create a core driver with `opts`
110
110
  @driver = @core.start_driver
111
-
111
+
112
112
  # Launch iPhone Simulator and `MyiOS.app`
113
113
  @driver.find_element(:accessibility_id, 'some accessibility') # find an element
114
114
  ```
@@ -116,7 +116,7 @@ $ IGNORE_VERSION_SKIP=true CI=true bundle exec rake test:func:android
116
116
  ```bash
117
117
  # shell 1
118
118
  $ appium --log-level warn:error # show only warning and error logs
119
-
119
+
120
120
  # shell 2
121
121
  $ ruby test.rb
122
122
  ```
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'appium_lib_core/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.required_ruby_version = '>= 2.5'
7
+ spec.required_ruby_version = '>= 2.6'
8
8
 
9
9
  spec.name = 'appium_lib_core'
10
10
  spec.version = Appium::Core::VERSION
@@ -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.0.0.rc3'
25
+ spec.add_runtime_dependency 'selenium-webdriver', '~> 4.0.0'
26
26
  spec.add_runtime_dependency 'faye-websocket', '~> 0.11.0'
27
27
 
28
28
  spec.add_development_dependency 'bundler', '>= 1.14'
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency 'minitest', '~> 5.0'
32
32
  spec.add_development_dependency 'minitest-reporters', '~> 1.1'
33
33
  spec.add_development_dependency 'webmock', '~> 3.14.0'
34
- spec.add_development_dependency 'rubocop', '1.12.1'
34
+ spec.add_development_dependency 'rubocop', '1.22.2'
35
35
  spec.add_development_dependency 'appium_thor', '~> 1.0'
36
36
  spec.add_development_dependency 'pry'
37
37
  spec.add_development_dependency 'pry-byebug'
@@ -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
@@ -28,8 +28,7 @@ To handle it, we would recommend you to handle the error based on the error mess
28
28
 
29
29
  ```ruby
30
30
  error = assert_raises ::Selenium::WebDriver::Error::UnknownError do
31
- _, element_id = el.ref
32
- @driver.execute_script 'mobile: scrollToPage', { element: element_id, scrollToPage: -100 }
31
+ @driver.execute_script 'mobile: scrollToPage', { element: el.id, scrollToPage: -100 }
33
32
  end
34
33
  assert error.message.include? 'be a non-negative integer'
35
34
  ```
@@ -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
@@ -207,8 +207,7 @@ module Appium
207
207
  # For W3C
208
208
  # https://github.com/SeleniumHQ/selenium/commit/b618499adcc3a9f667590652c5757c0caa703289
209
209
  # execute_atom :isDisplayed, element
210
- _, element_id = element.ref
211
- execute :is_element_displayed, id: element_id
210
+ execute :is_element_displayed, id: element.id
212
211
  end
213
212
 
214
213
  # For Appium
@@ -216,8 +215,7 @@ module Appium
216
215
  def element_attribute(element, name)
217
216
  # For W3C in Selenium Client
218
217
  # execute_atom :getAttribute, element, name
219
- _, element_id = element.ref
220
- execute :get_element_attribute, id: element_id, name: name
218
+ execute :get_element_attribute, id: element.id, name: name
221
219
  end
222
220
 
223
221
  # For Appium
@@ -321,11 +319,9 @@ module Appium
321
319
  data = execute :get_log, {}, { type: type.to_s }
322
320
 
323
321
  Array(data).map do |l|
324
- begin
325
- ::Selenium::WebDriver::LogEntry.new l.fetch('level', 'UNKNOWN'), l.fetch('timestamp'), l.fetch('message')
326
- rescue KeyError
327
- next
328
- end
322
+ ::Selenium::WebDriver::LogEntry.new l.fetch('level', 'UNKNOWN'), l.fetch('timestamp'), l.fetch('message')
323
+ rescue KeyError
324
+ next
329
325
  end
330
326
  end
331
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,14 @@ 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
+
48
55
  super
49
56
  end
50
57
 
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.
58
+ # Create a proper bridge instance.
56
59
  #
57
60
  # @return [::Appium::Core::Base::Bridge]
58
61
  #
@@ -83,7 +86,7 @@ module Appium
83
86
  def update_sending_request_to(protocol:, host:, port:, path:)
84
87
  unless @bridge.http&.class&.method_defined? :update_sending_request_to
85
88
  ::Appium::Logger.warn "#{@bridge.http&.class} has no 'update_sending_request_to'. " \
86
- 'It keeps current connection target.'
89
+ 'It keeps current connection target.'
87
90
  return
88
91
  end
89
92
 
@@ -159,8 +162,7 @@ module Appium
159
162
  # # ':session_id' in the given url is replaced with current 'session id'.
160
163
  # # ':id' in the given url is replaced with the given 'element_id'.
161
164
  # e = @driver.find_element :accessibility_id, 'an element'
162
- # _, element_id = e.ref
163
- # @driver.test_action_command(element_id, 'action')
165
+ # @driver.test_action_command(e.id, 'action')
164
166
  #
165
167
  def add_command(method:, url:, name:, &block)
166
168
  unless AVAILABLE_METHODS.include? method
@@ -239,22 +241,6 @@ module Appium
239
241
  end
240
242
  alias is_keyboard_shown keyboard_shown?
241
243
 
242
- # [DEPRECATION]
243
- # Send keys for a current active element
244
- # @param [String] key Input text
245
- #
246
- # @example
247
- #
248
- # @driver.send_keys 'happy testing!'
249
- #
250
- def send_keys(*key)
251
- ::Appium::Logger.warn(
252
- '[DEPRECATION] Driver#send_keys is deprecated in W3C spec. Use driver.action.<command>.perform instead'
253
- )
254
- @bridge.send_keys_to_active_element(key)
255
- end
256
- alias type send_keys
257
-
258
244
  # Returns an instance of DriverSettings to call get/update.
259
245
  #
260
246
  # @example
@@ -526,19 +512,6 @@ module Appium
526
512
  @bridge.pull_folder(path)
527
513
  end
528
514
 
529
- # Send keyevent on the device.(Only for Selendroid)
530
- # http://developer.android.com/reference/android/view/KeyEvent.html
531
- # @param [integer] key The key to press.
532
- # @param [String] metastate The state the metakeys should be in when pressing the key.
533
- #
534
- # @example
535
- #
536
- # @driver.keyevent 82
537
- #
538
- def keyevent(key, metastate = nil)
539
- @bridge.keyevent(key, metastate)
540
- end
541
-
542
515
  # Press keycode on the device.
543
516
  # http://developer.android.com/reference/android/view/KeyEvent.html
544
517
  # @param [Integer] key The key to press. The values which have +KEYCODE_+ prefix in http://developer.android.com/reference/android/view/KeyEvent.html
@@ -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
@@ -82,12 +82,11 @@ module Appium
82
82
  # @@driver.element_screenshot_as element, :base64 #=> "iVBORw0KGgoAAAANSUhEUgAABDgAAAB+CAIAAABOPDa6AAAAAX"
83
83
  #
84
84
  def element_screenshot_as(element, format)
85
- _, element_id = element.ref
86
85
  case format
87
86
  when :base64
88
- bridge.element_screenshot element_id
87
+ bridge.element_screenshot element.id
89
88
  when :png
90
- bridge.element_screenshot(element_id).unpack('m')[0]
89
+ bridge.element_screenshot(element.id).unpack('m')[0]
91
90
  else
92
91
  raise Core::Error::UnsupportedOperationError, "unsupported format: #{format.inspect}"
93
92
  end
@@ -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
  #
@@ -36,6 +39,10 @@ module Appium
36
39
  attr_reader :driver
37
40
 
38
41
  def initialize(driver)
42
+ ::Appium::Logger.warn(
43
+ '[DEPRECATION] Appium::Core::MultiTouch is deprecated in W3C spec. Use W3C actions instead'
44
+ )
45
+
39
46
  @actions = []
40
47
  @driver = driver
41
48
  end
@@ -14,13 +14,16 @@
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
  #
@@ -39,6 +42,10 @@ module Appium
39
42
  attr_reader :actions, :driver
40
43
 
41
44
  def initialize(driver)
45
+ ::Appium::Logger.warn(
46
+ '[DEPRECATION] Appium::Core::TouchAction is deprecated in W3C spec. Use W3C actions instead'
47
+ )
48
+
42
49
  @actions = []
43
50
  @driver = driver
44
51
  end
@@ -195,10 +202,7 @@ module Appium
195
202
  end
196
203
 
197
204
  def args_with_ele_ref(args)
198
- if args.key? :element
199
- _, element_id = args[:element].ref
200
- args[:element] = element_id
201
- end
205
+ args[:element] = args[:element].id if args.key? :element
202
206
  args
203
207
  end
204
208
  end # class TouchAction
@@ -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
 
@@ -364,7 +364,9 @@ 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)
368
370
 
369
371
  if @direct_connect
370
372
  d_c = DirectConnections.new(@driver.capabilities)
@@ -476,21 +478,6 @@ module Appium
476
478
  p_version.split('.').map(&:to_i)
477
479
  end
478
480
 
479
- # Takes a png screenshot and saves to the target path.
480
- #
481
- # @param png_save_path [String] the full path to save the png
482
- # @return [File]
483
- #
484
- # @example
485
- #
486
- # @core.screenshot '/tmp/hi.png' #=> nil
487
- # # same as '@driver.save_screenshot png_save_path'
488
- #
489
- def screenshot(png_save_path)
490
- ::Appium::Logger.warn '[DEPRECATION] screenshot will be removed. Please use driver.save_screenshot instead.'
491
- @driver.save_screenshot png_save_path
492
- end
493
-
494
481
  private
495
482
 
496
483
  # @private
@@ -20,6 +20,15 @@ module Appium
20
20
  include ::Appium::Core::Base::SearchContext
21
21
  include ::Appium::Core::Base::TakesScreenshot
22
22
 
23
+ # Retuns the element id.
24
+ #
25
+ # @return [String]
26
+ # @example
27
+ # e = @driver.find_element :accessibility_id, 'something'
28
+ # e.id
29
+ #
30
+ attr_reader :id
31
+
23
32
  # Returns the value of attributes like below. Read each platform to know more details.
24
33
  #
25
34
  # uiautomator2: https://github.com/appium/appium-uiautomator2-server/blob/203cc7e57ce477f3cff5d95b135d1b3450a6033a/app/src/main/java/io/appium/uiautomator2/utils/Attribute.java#L19
@@ -14,7 +14,7 @@
14
14
 
15
15
  module Appium
16
16
  module Core
17
- VERSION = '5.0.0.rc3' unless defined? ::Appium::Core::VERSION
18
- DATE = '2021-10-10' unless defined? ::Appium::Core::DATE
17
+ VERSION = '5.0.0.rc7' unless defined? ::Appium::Core::VERSION
18
+ DATE = '2021-10-26' unless defined? ::Appium::Core::DATE
19
19
  end
20
20
  end
data/release_notes.md CHANGED
@@ -1,3 +1,13 @@
1
+ #### v4.7.1 2021-09-26
2
+
3
+ - [cdd8906](https://github.com/appium/ruby_lib_core/commit/cdd890662585aa5051912d20d90ec3c3866ad8b1) Release 4.7.1
4
+ - [059b092](https://github.com/appium/ruby_lib_core/commit/059b0920becd60d691b0b4fac05cc0d96bcc59c7) ci: tweak brew install
5
+ - [fb32697](https://github.com/appium/ruby_lib_core/commit/fb32697d5ee7cf4ea4367aa9f9bf4458723d6fce) feat: allow to override an existing method by add_command (#330)
6
+ - [cbf7f1f](https://github.com/appium/ruby_lib_core/commit/cbf7f1fc2ce6bb8833e2a7324446d79cbc848834) chore(deps-dev): update webmock requirement from ~> 3.13.0 to ~> 3.14.0 (#329)
7
+ - [beefb17](https://github.com/appium/ruby_lib_core/commit/beefb179ac25e9337bf2badaf4eb0c4cfc5b1e45) chore(deps-dev): update rubocop requirement from = 1.12.0 to = 1.12.1 (#322)
8
+ - [3438b48](https://github.com/appium/ruby_lib_core/commit/3438b481523ec978d06bc243cd42eee8dc00356f) docs: tweak docstring
9
+
10
+
1
11
  #### v4.7.0 2021-07-17
2
12
 
3
13
  - [0059974](https://github.com/appium/ruby_lib_core/commit/0059974b0b1d79a822db84d8b0169e8393e00ef9) Release 4.7.0
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appium_lib_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0.rc3
4
+ version: 5.0.0.rc7
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-11 00:00:00.000000000 Z
11
+ date: 2021-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 4.0.0.rc3
19
+ version: 4.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 4.0.0.rc3
26
+ version: 4.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: faye-websocket
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - '='
130
130
  - !ruby/object:Gem::Version
131
- version: 1.12.1
131
+ version: 1.22.2
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - '='
137
137
  - !ruby/object:Gem::Version
138
- version: 1.12.1
138
+ version: 1.22.2
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: appium_thor
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -333,7 +333,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
333
333
  requirements:
334
334
  - - ">="
335
335
  - !ruby/object:Gem::Version
336
- version: '2.5'
336
+ version: '2.6'
337
337
  required_rubygems_version: !ruby/object:Gem::Requirement
338
338
  requirements:
339
339
  - - ">"