Class: UIAuto::Formatters::ColorIndentFormatter
Instance Method Summary
collapse
#output
#element_tree, #element_tree_finish, #instruments_line, #run_start, #script_finish, #script_summary, #unknown
Constructor Details
Returns a new instance of ColorIndentFormatter.
7
8
9
10
11
|
# File 'lib/uiauto/formatters/color_indent_formatter.rb', line 7
def initialize
@passes = []
@failures = []
@current_script = ''
end
|
Instance Method Details
#element_tree_line(line) ⇒ Object
82
83
84
|
# File 'lib/uiauto/formatters/color_indent_formatter.rb', line 82
def element_tree_line(line)
output.puts " #{line}".color("333333")
end
|
#element_tree_start ⇒ Object
78
79
80
|
# File 'lib/uiauto/formatters/color_indent_formatter.rb', line 78
def element_tree_start
output.puts " Element Tree:".color("333333")
end
|
#load_simulator_data(path) ⇒ Object
19
20
21
22
|
# File 'lib/uiauto/formatters/color_indent_formatter.rb', line 19
def load_simulator_data(path)
output.puts
output.puts " Simulator Data: #{path}"
end
|
#log_debug(message) ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/uiauto/formatters/color_indent_formatter.rb', line 43
def log_debug(message)
if output.tty?
colored_message = message.foreground(:cyan)
colored_message = colored_message.gsub(/"((?:[^"\\]|\\.)*)"/) do
"\e[0m#{"\"#{$1}\"".bright.foreground(:cyan)}\e[36m"
end
message = colored_message
end
output.puts " #{message}"
end
|
#log_default(message) ⇒ Object
60
61
62
|
# File 'lib/uiauto/formatters/color_indent_formatter.rb', line 60
def log_default(message)
output.puts message
end
|
#log_error(message) ⇒ Object
56
57
58
|
# File 'lib/uiauto/formatters/color_indent_formatter.rb', line 56
def log_error(message)
output.puts " Error: #{message}".foreground(:red)
end
|
#log_fail(message) ⇒ Object
34
35
36
37
|
# File 'lib/uiauto/formatters/color_indent_formatter.rb', line 34
def log_fail(message)
output.puts " Test: \"#{message}\" Failed".foreground(:red)
@failures << "#{@current_script} \"#{message}\""
end
|
#log_issue(message) ⇒ Object
39
40
41
|
# File 'lib/uiauto/formatters/color_indent_formatter.rb', line 39
def log_issue(message)
output.puts " Test: \"#{message}\" Issue".foreground(:yellow)
end
|
#log_none(message) ⇒ Object
68
69
70
71
|
# File 'lib/uiauto/formatters/color_indent_formatter.rb', line 68
def log_none(message)
output.puts " #{message}".foreground(:red)
@failures << @current_script unless @failures.include?(@current_script)
end
|
#log_pass(message) ⇒ Object
29
30
31
32
|
# File 'lib/uiauto/formatters/color_indent_formatter.rb', line 29
def log_pass(message)
output.puts " Test: \"#{message}\" Passed".foreground(:green)
@passes << message
end
|
#log_start(message) ⇒ Object
24
25
26
27
|
# File 'lib/uiauto/formatters/color_indent_formatter.rb', line 24
def log_start(message)
output.puts
output.puts " Test: \"#{message}\""
end
|
#log_stopped(message) ⇒ Object
73
74
75
76
|
# File 'lib/uiauto/formatters/color_indent_formatter.rb', line 73
def log_stopped(message)
output.puts " #{message}".foreground(:red)
@failures << @current_script unless @failures.include?(@current_script)
end
|
#log_warning(message) ⇒ Object
64
65
66
|
# File 'lib/uiauto/formatters/color_indent_formatter.rb', line 64
def log_warning(message)
output.puts " Warning: #{message}".foreground(:yellow)
end
|
#run_finish ⇒ Object
86
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/uiauto/formatters/color_indent_formatter.rb', line 86
def run_finish
if @failures.count > 0
output.puts
output.puts "Failing Tests:".foreground(:red)
@failures.each do |failure|
output.puts failure.foreground(:red)
end
end
output.puts
output.puts "#{@passes.count + @failures.count} tests #{summary}"
end
|
#script_start(script) ⇒ Object
13
14
15
16
17
|
# File 'lib/uiauto/formatters/color_indent_formatter.rb', line 13
def script_start(script)
output.puts
output.puts "Script: #{script}"
@current_script = script
end
|