Sha256: a3f5811bdb46011fef903071089be4b486dc227baa56af20e304dd415bc759c6
Contents?: true
Size: 1.36 KB
Versions: 1
Compression:
Stored size: 1.36 KB
Contents
module Calabash module ConsoleHelpers def self.render(data, indentation) if visible?(data) type = data['type'] simple_name = type.split('.').last.split('$').last str_type = if data['type'] == 'dom' "#{Color.yellow("[")}#{simple_name}:#{Color.yellow("#{data['nodeName']}]")} " else Color.yellow("[#{simple_name}] ") end text = nil if data['value'] unless data['value'].empty? if data['value'].length > 45 text = "#{data['value'][0,45]}[...]" else text = data['value'] end newline_index = text.index("\n") unless newline_index.nil? text = "#{text[0,newline_index]}[...]" end end end str_id = data['id'] ? "[id:#{Color.blue(data['id'])}] " : '' str_label = data['label'] ? "[contentDescription:#{Color.green(data['label'])}] " : '' str_text = text ? "[text:#{Color.magenta(text)}] " : '' output("#{str_type}#{str_id}#{str_label}#{str_text}", indentation) output("\n", indentation) end end def self.visible?(data) (data['type'] != '[object Exception]' && data['visible']) || data['children'].map{|child| visible?(child)}.any? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
calabash-1.9.9.pre2 | lib/calabash/android/console_helpers.rb |