appium_lib 9.15.0 → 9.15.1

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.
@@ -59,8 +59,9 @@ module Appium
59
59
  class CountElements < Nokogiri::XML::SAX::Document
60
60
  attr_reader :result
61
61
 
62
- def initialize
62
+ def initialize(platform)
63
63
  reset
64
+ @platform = platform
64
65
  end
65
66
 
66
67
  def reset
@@ -68,19 +69,23 @@ module Appium
68
69
  end
69
70
 
70
71
  # http://nokogiri.org/Nokogiri/XML/SAX/Document.html
71
- def start_element(name, attrs = [], driver = $driver)
72
- # Count only visible elements. Android is always visible
73
- element_visible = driver.device_is_android? ? true : Hash[attrs]['visible'] == 'true'
72
+ def start_element(name, attrs = [])
73
+ element_visible = case @platform.to_sym
74
+ when :android
75
+ true
76
+ else # :ios, :windows
77
+ Hash[attrs]['visible'] == 'true'
78
+ end
79
+
74
80
  @result[name] += 1 if element_visible
75
81
  end
76
82
 
77
83
  def formatted_result
78
- message = ''
79
- sorted = @result.sort_by { |_element, count| count }.reverse
80
- sorted.each do |element, count|
81
- message += "#{count}x #{element}\n"
82
- end
83
- message.strip
84
+ @result
85
+ .sort_by { |_element, count| count }
86
+ .reverse
87
+ .each_with_object('') { |element, acc| acc << "#{element[1]}x #{element[0]}\n" }
88
+ .strip
84
89
  end
85
90
  end # class CountElements
86
91
 
@@ -94,7 +99,7 @@ module Appium
94
99
  # # x XCUIElementTypeNavigationBar\n1x XCUIElementTypeApplication"
95
100
  #
96
101
  def get_page_class
97
- parser = @count_elements_parser ||= Nokogiri::XML::SAX::Parser.new(CountElements.new)
102
+ parser = @count_elements_parser ||= Nokogiri::XML::SAX::Parser.new(CountElements.new(@core.device))
98
103
 
99
104
  parser.document.reset
100
105
  parser.parse get_source
@@ -156,7 +156,8 @@ module Appium
156
156
  end
157
157
  raise 'opts must be a hash' unless opts.is_a? Hash
158
158
 
159
- @core = Appium::Core.for(self, opts)
159
+ @core = ::Appium::Core.for(opts)
160
+ extend ::Appium::Core::Device
160
161
 
161
162
  opts = Appium.symbolize_keys opts
162
163
  appium_lib_opts = opts[:appium_lib] || {}
@@ -67,7 +67,9 @@ module Appium
67
67
  parser.document.reset
68
68
  parser.document.filter = class_name
69
69
  parser.parse s
70
- parser.document.result
70
+ result = parser.document.result
71
+ puts result
72
+ result
71
73
  else
72
74
  s = get_source
73
75
  parser = Nokogiri::XML::SAX::Parser.new(UITestElementsPrinter.new)
@@ -1,5 +1,5 @@
1
1
  module Appium
2
2
  # Version and Date are defined on the 'Appium' module, not 'Appium::Common'
3
- VERSION = '9.15.0'.freeze unless defined? ::Appium::VERSION
4
- DATE = '2018-08-10'.freeze unless defined? ::Appium::DATE
3
+ VERSION = '9.15.1'.freeze unless defined? ::Appium::VERSION
4
+ DATE = '2018-08-27'.freeze unless defined? ::Appium::DATE
5
5
  end
data/release_notes.md CHANGED
@@ -1,3 +1,14 @@
1
+ #### v9.15.0 2018-08-10
2
+
3
+ - [b09ea84](https://github.com/appium/ruby_lib/commit/b09ea848cc595d8d3ef6494e0a26770521b9432c) [Release 9 15 0 (#810)](https://github.com/appium/ruby_lib/issues/810)
4
+ - [2e05c62](https://github.com/appium/ruby_lib/commit/2e05c62b07d7c8e395e429fe8b5add58cd41d2d2) [Fix rubocop for mighty (#809)](https://github.com/appium/ruby_lib/issues/809)
5
+ - [b4da941](https://github.com/appium/ruby_lib/commit/b4da94126b8f7791c510e81d7f080b248bbcdb72) [add a pull reqeust template (#808)](https://github.com/appium/ruby_lib/issues/808)
6
+ - [e553b3f](https://github.com/appium/ruby_lib/commit/e553b3fab6e733cb91a42dab93ea5331af79fa76) [add a section about parallel tests (#807)](https://github.com/appium/ruby_lib/issues/807)
7
+ - [6c6b73f](https://github.com/appium/ruby_lib/commit/6c6b73f18e76c73e71fde1ddf265913472423bce) [update core version (#806)](https://github.com/appium/ruby_lib/issues/806)
8
+ - [a1b2182](https://github.com/appium/ruby_lib/commit/a1b2182ac1f85b0f48ff934221876e9fd3292189) [Relax absolute app path (#804)](https://github.com/appium/ruby_lib/issues/804)
9
+ - [30ca236](https://github.com/appium/ruby_lib/commit/30ca236d871e06efc069ff59c5f13753dc109971) [add a limitation in readme (#803)](https://github.com/appium/ruby_lib/issues/803)
10
+
11
+
1
12
  #### v9.14.3 2018-07-07
2
13
 
3
14
  - [355ce1a](https://github.com/appium/ruby_lib/commit/355ce1a1618a06353da5dbc02eeb339031e9ded1) [Release 9 14 3 (#799)](https://github.com/appium/ruby_lib/issues/799)
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appium_lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.15.0
4
+ version: 9.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - code@bootstraponline.com
8
+ - Kazuaki Matsuo
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2018-08-10 00:00:00.000000000 Z
12
+ date: 2018-08-27 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: appium_lib_core
@@ -16,14 +17,14 @@ dependencies:
16
17
  requirements:
17
18
  - - "~>"
18
19
  - !ruby/object:Gem::Version
19
- version: 1.9.0
20
+ version: 2.0.0
20
21
  type: :runtime
21
22
  prerelease: false
22
23
  version_requirements: !ruby/object:Gem::Requirement
23
24
  requirements:
24
25
  - - "~>"
25
26
  - !ruby/object:Gem::Version
26
- version: 1.9.0
27
+ version: 2.0.0
27
28
  - !ruby/object:Gem::Dependency
28
29
  name: tomlrb
29
30
  requirement: !ruby/object:Gem::Requirement
@@ -193,6 +194,7 @@ dependencies:
193
194
  description: Ruby library for Appium.
194
195
  email:
195
196
  - code@bootstraponline.com
197
+ - fly.49.89.over@gmail.com
196
198
  executables: []
197
199
  extensions: []
198
200
  extra_rdoc_files: []