appium_lib_core 5.0.0.rc5 → 5.0.0.rc6

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: c4ee843cbe6c1b2cb6d84fcc40000c017d8334ba542012b304d21d66ffa9295a
4
+ data.tar.gz: c13938466767e24d8d9687d070e63510e73c52fb2d8640d9475e8a4b6ef68c89
5
5
  SHA512:
6
- metadata.gz: e9e155e17e026514e12657489569b17b389d62cb9d7cd79e8a753e12b37571d4a9d3a3f28227b935b2d3d101747a7ce66d28ff7eb08f6c9cfb7c1c94ca7f3f03
7
- data.tar.gz: 13e2620a48fe753b5647a0ffcb6bf370f54796aa3b87ca34522659c219474804dfa7843394307ad84b36dc377a10d2bd5bec782467354abb252e945c27cdd748
6
+ metadata.gz: a7d82afb3e81636c6759515dd3126ce44308bf61e419bb88860daf62574252ad66ef07d04b4d75a47044e162113436caabccef332d01abbd08fd0d3459b38985
7
+ data.tar.gz: 8940887d4f189c002dff3d68bd895059a4a085d94f69a582a0998e2a2be7e2a7c6d5ae7575ae71303b836413f3a3638bf8306a07071b5b2e7ed48a7da52b878a
@@ -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
@@ -25,6 +25,8 @@ Read `release_notes.md` for commit level details.
25
25
  - Removed `forceMjsonwp` to send only MJSONWP capabilities since Selenium cleint v4 no longer supports MJSONWP
26
26
  - No longer set default `timeouts` as `0`. ruby_lib_core calls `/timeouts` endpoint only when `appium_lib: { wait: 5 }` is provided explicitly
27
27
  - Raises `::Appium::Core::Error::ArgumentError` instead of `ArgumentError` for this library specific argument errors
28
+ - Add `driver#wait`, `driver#wait_until`, `driver#wait_true`, `driver#wait_until_true` syntaxes
29
+ - Can give `driver` instance as its block variable
28
30
 
29
31
  ## [4.7.1] - 2021-09-26
30
32
 
@@ -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
@@ -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.
@@ -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
 
@@ -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
@@ -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
@@ -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
@@ -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
 
@@ -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.rc6' unless defined? ::Appium::Core::VERSION
18
+ DATE = '2021-10-23' unless defined? ::Appium::Core::DATE
19
19
  end
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appium_lib_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0.rc5
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-15 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
@@ -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