appium_lib 10.2.0 → 10.3.0

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.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -14
  3. data/.travis.yml +0 -2
  4. data/CHANGELOG.md +9 -0
  5. data/Gemfile +14 -0
  6. data/Rakefile +14 -0
  7. data/appium_lib.gemspec +2 -2
  8. data/docs/android_docs.md +261 -229
  9. data/docs/ios_docs.md +346 -282
  10. data/lib/appium_lib.rb +14 -0
  11. data/lib/appium_lib/android/android.rb +14 -0
  12. data/lib/appium_lib/android/common/command/command.rb +14 -0
  13. data/lib/appium_lib/android/common/helper.rb +14 -0
  14. data/lib/appium_lib/android/element/alert.rb +14 -0
  15. data/lib/appium_lib/android/element/button.rb +35 -18
  16. data/lib/appium_lib/android/element/generic.rb +14 -0
  17. data/lib/appium_lib/android/element/text.rb +29 -14
  18. data/lib/appium_lib/android/element/textfield.rb +30 -15
  19. data/lib/appium_lib/android/espresso.rb +14 -0
  20. data/lib/appium_lib/android/espresso/bridge.rb +14 -0
  21. data/lib/appium_lib/android/espresso/element.rb +14 -0
  22. data/lib/appium_lib/android/espresso/element/button.rb +26 -12
  23. data/lib/appium_lib/android/espresso/element/generic.rb +14 -0
  24. data/lib/appium_lib/android/espresso/helper.rb +14 -0
  25. data/lib/appium_lib/android/uiautomator2.rb +14 -0
  26. data/lib/appium_lib/android/uiautomator2/bridge.rb +14 -0
  27. data/lib/appium_lib/android/uiautomator2/element.rb +14 -0
  28. data/lib/appium_lib/android/uiautomator2/element/button.rb +14 -0
  29. data/lib/appium_lib/android/uiautomator2/helper.rb +14 -0
  30. data/lib/appium_lib/appium.rb +14 -0
  31. data/lib/appium_lib/common/command.rb +14 -0
  32. data/lib/appium_lib/common/command/ws_logcat.rb +14 -0
  33. data/lib/appium_lib/common/device.rb +14 -0
  34. data/lib/appium_lib/common/helper.rb +19 -5
  35. data/lib/appium_lib/common/http_client.rb +14 -0
  36. data/lib/appium_lib/common/log.rb +14 -0
  37. data/lib/appium_lib/common/multi_touch.rb +14 -0
  38. data/lib/appium_lib/common/touch_actions.rb +14 -0
  39. data/lib/appium_lib/common/wait.rb +14 -0
  40. data/lib/appium_lib/driver.rb +16 -2
  41. data/lib/appium_lib/ios/common/errors.rb +14 -0
  42. data/lib/appium_lib/ios/common/helper.rb +15 -1
  43. data/lib/appium_lib/ios/element/alert.rb +14 -0
  44. data/lib/appium_lib/ios/element/button.rb +26 -9
  45. data/lib/appium_lib/ios/element/generic.rb +14 -0
  46. data/lib/appium_lib/ios/element/text.rb +26 -9
  47. data/lib/appium_lib/ios/element/textfield.rb +25 -7
  48. data/lib/appium_lib/ios/ios.rb +14 -0
  49. data/lib/appium_lib/ios/xcuitest.rb +14 -0
  50. data/lib/appium_lib/ios/xcuitest/bridge.rb +14 -0
  51. data/lib/appium_lib/ios/xcuitest/command.rb +14 -0
  52. data/lib/appium_lib/ios/xcuitest/command/certificate.rb +14 -0
  53. data/lib/appium_lib/ios/xcuitest/command/gestures.rb +14 -0
  54. data/lib/appium_lib/ios/xcuitest/command/get_context.rb +14 -0
  55. data/lib/appium_lib/ios/xcuitest/command/multi_app_handler.rb +14 -0
  56. data/lib/appium_lib/ios/xcuitest/command/pasteboard.rb +14 -0
  57. data/lib/appium_lib/ios/xcuitest/command/source.rb +14 -0
  58. data/lib/appium_lib/ios/xcuitest/element.rb +14 -0
  59. data/lib/appium_lib/ios/xcuitest/element/button.rb +22 -8
  60. data/lib/appium_lib/ios/xcuitest/element/generic.rb +14 -0
  61. data/lib/appium_lib/ios/xcuitest/element/text.rb +22 -8
  62. data/lib/appium_lib/ios/xcuitest/element/textfield.rb +18 -4
  63. data/lib/appium_lib/ios/xcuitest/helper.rb +14 -0
  64. data/lib/appium_lib/sauce_labs.rb +14 -0
  65. data/lib/appium_lib/version.rb +16 -2
  66. data/release_notes.md +7 -0
  67. metadata +4 -4
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  module Appium
2
16
  module Android
3
17
  module Espresso
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  module Appium
2
16
  module Android
3
17
  module Espresso
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  require_relative 'uiautomator2/helper'
2
16
  require_relative 'uiautomator2/element'
3
17
  require_relative 'uiautomator2/bridge'
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  require_relative '../android'
2
16
 
3
17
  module Appium
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  require_relative 'element/button'
2
16
 
3
17
  module Appium
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  module Appium
2
16
  module Android
3
17
  module Uiautomator2
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  module Appium
2
16
  module Android
3
17
  module Uiautomator2
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  require 'rubygems'
2
16
  require 'selenium-webdriver'
3
17
  require 'nokogiri'
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  require_relative 'command/ws_logcat'
2
16
 
3
17
  module Appium
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  module Appium
2
16
  module Common
3
17
  module Command
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  module Appium
2
16
  module Device
3
17
  extend Forwardable
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  # Generic helper methods not specific to a particular tag name
2
16
  module Appium
3
17
  module Common
@@ -84,7 +98,7 @@ module Appium
84
98
  @result
85
99
  .sort_by { |_element, count| count }
86
100
  .reverse
87
- .each_with_object('') { |element, acc| acc << "#{element[1]}x #{element[0]}\n" }
101
+ .reduce('') { |acc, element| "#{acc}#{element[1]}x #{element[0]}\n" }
88
102
  .strip
89
103
  end
90
104
  end # class CountElements
@@ -160,7 +174,7 @@ module Appium
160
174
  def lazy_load_strings
161
175
  # app strings only works on local apps.
162
176
  # on disk apps (ex: com.android.settings) will error
163
- @strings_xml ||= ignore { app_strings } || {}
177
+ @lazy_load_strings ||= ignore { app_strings } || {}
164
178
  end
165
179
 
166
180
  # Search strings.xml's values for target.
@@ -168,7 +182,7 @@ module Appium
168
182
  # @return [Array]
169
183
  def xml_keys(target)
170
184
  lazy_load_strings
171
- @strings_xml.select { |key, _value| key.downcase.include? target.downcase }
185
+ @lazy_load_strings.select { |key, _value| key.downcase.include? target.downcase }
172
186
  end
173
187
 
174
188
  # Search strings.xml's keys for target.
@@ -176,7 +190,7 @@ module Appium
176
190
  # @return [Array]
177
191
  def xml_values(target)
178
192
  lazy_load_strings
179
- @strings_xml.select { |_key, value| value.downcase.include? target.downcase }
193
+ @lazy_load_strings.select { |_key, value| value.downcase.include? target.downcase }
180
194
  end
181
195
 
182
196
  # Resolve id in strings.xml and return the value.
@@ -184,7 +198,7 @@ module Appium
184
198
  # @return [String]
185
199
  def resolve_id(id)
186
200
  lazy_load_strings
187
- @strings_xml[id]
201
+ @lazy_load_strings[id]
188
202
  end
189
203
 
190
204
  # @private
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  require 'appium_lib_core'
2
16
  require_relative '../version'
3
17
 
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  module Appium
2
16
  module Common
3
17
  # @param [String|Hash] type You can get particular type's logs.
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  module Appium
2
16
  # MultiTouch actions allow for multiple touches to happen at the same time,
3
17
  # for instance, to simulate multiple finger swipes.
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  module Appium
2
16
  # Perform a series of gestures, one after another. Gestures are chained
3
17
  # together and only performed when `perform()` is called. Default is conducted by global driver.
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  require 'appium_lib_core'
2
16
 
3
17
  module Appium
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  # Load only Minitest is loaded
2
16
  if defined?(Minitest::VERSION)
3
17
  # Fix uninitialized constant Minitest (NameError)
@@ -176,7 +190,7 @@ module Appium
176
190
  set_app_path(opts)
177
191
 
178
192
  # enable debug patch
179
- @appium_debug = appium_lib_opts.fetch :debug, !!defined?(Pry)
193
+ @appium_debug = appium_lib_opts.fetch :debug, !!defined?(Pry) # rubocop:disable Style/DoubleNegation
180
194
  set_sauce_related_values(appium_lib_opts)
181
195
 
182
196
  # Extend Common methods
@@ -214,7 +228,7 @@ module Appium
214
228
  else # default and UiAutomator
215
229
  ::Appium::Android::Bridge.for(self)
216
230
  end
217
- when :ios
231
+ when :ios, :tvos
218
232
  case automation_name
219
233
  when :xcuitest
220
234
  ::Appium::Ios::Xcuitest::Bridge.for(self)
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  module Appium
2
16
  module Ios
3
17
  class CommandError < RuntimeError
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  module Appium
2
16
  module Ios
3
17
  # @private
@@ -7,7 +21,7 @@ module Appium
7
21
  def start_element(type, attrs = [])
8
22
  return if filter && !filter.eql?(type)
9
23
 
10
- page = attrs.inject({}) do |hash, attr|
24
+ page = attrs.each_with_object({}) do |hash, attr|
11
25
  hash[attr[0]] = attr[1] if %w(name label value hint visible).include?(attr[0])
12
26
  hash
13
27
  end
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  module Appium
2
16
  module Ios
3
17
  # Accept the alert.