lib/appium_lib/android/helper.rb in appium_lib-0.10.0 vs lib/appium_lib/android/helper.rb in appium_lib-0.11.0

- old
+ new

@@ -22,10 +22,12 @@ prefix 'AbsSeekBar' when 'absspinner' prefix 'AbsSpinner' when 'absolute' prefix 'AbsoluteLayout' + when 'adapterview' + prefix 'AdapterView' when 'adapterviewanimator' prefix 'AdapterViewAnimator' when 'adapterviewflipper' prefix 'AdapterViewFlipper' when 'analogclock' @@ -154,10 +156,12 @@ prefix 'TimePicker' when 'toggle' prefix 'ToggleButton' when 'twolinelistitem' prefix 'TwoLineListItem' + when 'view' + 'android.view.View' when 'video' prefix 'VideoView' when 'viewanimator' prefix 'ViewAnimator' when 'viewflipper' @@ -290,15 +294,16 @@ run_internal.call node['node'] if keys.include?('node') end json = get_source run_internal.call json['hierarchy'] - res = '' + res = [] r = r.sort r.uniq.each do |ele| - res += "#{r.count(ele)}x #{ele}\n" + res.push "#{r.count(ele)}x #{ele}\n" end - res + count_sort = ->(one,two) { two.match(/(\d+)x/)[1].to_i <=> one.match(/(\d+)x/)[1].to_i } + res.sort(&count_sort).join '' end # Count all classes on screen and print to stdout. # Useful for appium_console. def page_class \ No newline at end of file