appium_lib_core 5.0.0.rc2 → 5.0.0.rc6

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: 3eba36b9dee77259cd1a14dd0e03c3a140a0e4bcb014d3d7d277ca9d4c47e011
4
- data.tar.gz: 511a0a3fa46c55f078185c8d25262ec4c6b5d281be628a2217df1d90fd58d331
3
+ metadata.gz: c4ee843cbe6c1b2cb6d84fcc40000c017d8334ba542012b304d21d66ffa9295a
4
+ data.tar.gz: c13938466767e24d8d9687d070e63510e73c52fb2d8640d9475e8a4b6ef68c89
5
5
  SHA512:
6
- metadata.gz: 47a0de22452cdfa19f9e9aa71dd1b29bedc17c0b431860c7db5bbccb4f50ff83e08db3103caa5ad9e40aaf526518c072ee32563a7139d126222c63d52375048e
7
- data.tar.gz: 868a920d5221fba2e9e9e3c583a7e5c81cd00bbdf19680ef4795ae23cb71ea773fdce24889935574190a82d888f8ba7f99f1e98e3f86ddd3dab344710598675a
6
+ metadata.gz: a7d82afb3e81636c6759515dd3126ce44308bf61e419bb88860daf62574252ad66ef07d04b4d75a47044e162113436caabccef332d01abbd08fd0d3459b38985
7
+ data.tar.gz: 8940887d4f189c002dff3d68bd895059a4a085d94f69a582a0998e2a2be7e2a7c6d5ae7575ae71303b836413f3a3638bf8306a07071b5b2e7ed48a7da52b878a
@@ -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,33 @@ 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
+ ## [4.7.1] - 2021-09-26
32
+
33
+ ### Enhancements
34
+ - Allow to override an existing method by `Appium::Core::Base::Driver#add_command` since Appium drivers/plugins allow to override them
22
35
 
23
36
  ## [4.7.0] - 2021-07-17
24
37
 
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.rc2'
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.
@@ -48,11 +51,7 @@ module Appium
48
51
  super
49
52
  end
50
53
 
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.
54
+ # Create a proper bridge instance.
56
55
  #
57
56
  # @return [::Appium::Core::Base::Bridge]
58
57
  #
@@ -83,7 +82,7 @@ module Appium
83
82
  def update_sending_request_to(protocol:, host:, port:, path:)
84
83
  unless @bridge.http&.class&.method_defined? :update_sending_request_to
85
84
  ::Appium::Logger.warn "#{@bridge.http&.class} has no 'update_sending_request_to'. " \
86
- 'It keeps current connection target.'
85
+ 'It keeps current connection target.'
87
86
  return
88
87
  end
89
88
 
@@ -159,8 +158,7 @@ module Appium
159
158
  # # ':session_id' in the given url is replaced with current 'session id'.
160
159
  # # ':id' in the given url is replaced with the given 'element_id'.
161
160
  # e = @driver.find_element :accessibility_id, 'an element'
162
- # _, element_id = e.ref
163
- # @driver.test_action_command(element_id, 'action')
161
+ # @driver.test_action_command(e.id, 'action')
164
162
  #
165
163
  def add_command(method:, url:, name:, &block)
166
164
  unless AVAILABLE_METHODS.include? method
@@ -239,22 +237,6 @@ module Appium
239
237
  end
240
238
  alias is_keyboard_shown keyboard_shown?
241
239
 
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
240
  # Returns an instance of DriverSettings to call get/update.
259
241
  #
260
242
  # @example
@@ -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
@@ -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
@@ -195,10 +195,7 @@ module Appium
195
195
  end
196
196
 
197
197
  def args_with_ele_ref(args)
198
- if args.key? :element
199
- _, element_id = args[:element].ref
200
- args[:element] = element_id
201
- end
198
+ args[:element] = args[:element].id if args.key? :element
202
199
  args
203
200
  end
204
201
  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)
141
- Wait.until_true(timeout: timeout || @wait_timeout,
142
- interval: interval || @wait_interval,
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)
157
+ Wait.until_true(timeout: timeout || @wait_timeout || ::Appium::Core::Wait::DEFAULT_TIMEOUT,
158
+ interval: interval || @wait_interval || ::Appium::Core::Wait::DEFAULT_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)
163
- Wait.until(timeout: timeout || @wait_timeout,
164
- interval: interval || @wait_interval,
192
+ def wait_until(timeout: nil, interval: nil, message: nil, ignored: nil, &block)
193
+ Wait.until(timeout: timeout || @wait_timeout || ::Appium::Core::Wait::DEFAULT_TIMEOUT,
194
+ interval: interval || @wait_interval || ::Appium::Core::Wait::DEFAULT_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
@@ -40,7 +40,7 @@ module Appium
40
40
 
41
41
  def initialize(appium_lib_opts)
42
42
  @custom_url = appium_lib_opts.fetch :server_url, nil
43
- @default_wait = appium_lib_opts.fetch :wait, Driver::DEFAULT_IMPLICIT_WAIT
43
+ @default_wait = appium_lib_opts.fetch :wait, nil
44
44
  @enable_idempotency_header = appium_lib_opts.fetch :enable_idempotency_header, true
45
45
 
46
46
  # bump current session id into a particular file
@@ -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
 
@@ -135,11 +135,9 @@ module Appium
135
135
  attr_reader :export_session_path
136
136
 
137
137
  # Default wait time for elements to appear in Appium server side.
138
- # Defaults to {::Appium::Core::Driver::DEFAULT_IMPLICIT_WAIT}.<br>
139
138
  # Provide <code>{ appium_lib: { wait: 30 } }</code> to {::Appium::Core.for}
140
139
  # @return [Integer]
141
140
  attr_reader :default_wait
142
- DEFAULT_IMPLICIT_WAIT = 0
143
141
 
144
142
  # Appium's server port. 4723 is by default. Defaults to {::Appium::Core::Driver::DEFAULT_APPIUM_PORT}.<br>
145
143
  # Provide <code>{ appium_lib: { port: 8080 } }</code> to {::Appium::Core.for}.
@@ -407,6 +405,8 @@ module Appium
407
405
 
408
406
  # Ignore setting default wait if the target driver has no implementation
409
407
  def set_implicit_wait_by_default(wait)
408
+ return if @default_wait.nil?
409
+
410
410
  @driver.manage.timeouts.implicit_wait = wait
411
411
  rescue ::Selenium::WebDriver::Error::UnknownError => e
412
412
  unless e.message.include?('The operation requested is not yet implemented')
@@ -476,21 +476,6 @@ module Appium
476
476
  p_version.split('.').map(&:to_i)
477
477
  end
478
478
 
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
479
  private
495
480
 
496
481
  # @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.rc2' unless defined? ::Appium::Core::VERSION
18
- DATE = '2021-10-01' unless defined? ::Appium::Core::DATE
17
+ VERSION = '5.0.0.rc6' unless defined? ::Appium::Core::VERSION
18
+ DATE = '2021-10-23' 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.rc2
4
+ version: 5.0.0.rc6
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-01 00:00:00.000000000 Z
11
+ date: 2021-10-23 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.rc2
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.rc2
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
  - - ">"