Class: SilenceHtml

Inherits:
Cucumber::Formatter::Html
  • Object
show all
Defined in:
lib/features/support/formatter/SilenceHtml/formatter.rb

Overview

Very simple report with execution status for each scenario without steps description.

Instance Method Summary collapse

Instance Method Details

#before_steps(steps) ⇒ Object



80
81
82
# File 'lib/features/support/formatter/SilenceHtml/formatter.rb', line 80

def before_steps(steps)
  @builder << '<ol style="display:none;">'
end

#build_exception_detail(exception) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/features/support/formatter/SilenceHtml/formatter.rb', line 34

def build_exception_detail(exception)
  backtrace = Array.new
  @builder.div(:class => 'message') do
    message = exception.message

    unless exception.instance_of?(RuntimeError)
      message = "#{message} (#{exception.class})"
    end

    @builder.pre do
      @builder.text!(message)
    end
  end
  @builder.div(:class => 'backtrace') do
    @builder.a("backtrace", :class => 'backtrace_toggle')
    @builder.pre(:class => 'backtrace_details', style: "display:none") do
      exception.backtrace.each { |trace|  
        if trace.include? Dir.getwd
          @builder.span(style: "font-weight:bold;") do
            @builder << "#{trace}\n"
          end
        else
          @builder.span(style: "color: #303030;") do
            @builder << "#{trace}\n"
          end
        end
      }
    end
  end
  extra = extra_failure_content(exception.backtrace)
  @builder.div do 
    @builder.a("ruby code", :class => 'ruby_error_toggle')
    @builder.div(:class => "ruby_error", :style => "display:none;") do 
      @builder << extra unless extra == ""
    end
  end
end

#inline_cssObject



84
85
86
87
88
89
# File 'lib/features/support/formatter/SilenceHtml/formatter.rb', line 84

def inline_css
  super
  @builder.style(:type => 'text/css') do
    @builder << File.read(File.dirname(__FILE__) + '/inline_css.css')
  end
end

#inline_js_contentObject

Adds custom inline JavaScript code



92
93
94
# File 'lib/features/support/formatter/SilenceHtml/formatter.rb', line 92

def inline_js_content
  File.read(File.dirname(__FILE__) + '/inline_js.js')
end

#scenario_name(keyword, name, file_colon_line, source_indent) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/features/support/formatter/SilenceHtml/formatter.rb', line 11

def scenario_name(keyword, name, file_colon_line, source_indent)
  @builder.span(:class => 'scenario_file') do
    @builder << file_colon_line
  end
  @listing_background = false
  unless @tags.nil?
    if @tags.include? "@known_bug"
      @known_bug_h3 = "known_bug_title"
    else
      @known_bug_h3 = "normal_title"
    end
  end
  @builder.h3(:id => "scenario_#{@scenario_number}", :class => @known_bug_h3) do
    @builder.span(keyword + ':', :class => 'keyword')
    @builder.text!(' ')
    @builder.span(name, :class => 'val')
    @builder.text!(' ')
    @builder.span("")
    tags_in_title(@tags)
  end
  @tags = nil
end

#tag_name(tag_name) ⇒ Object



6
7
8
9
# File 'lib/features/support/formatter/SilenceHtml/formatter.rb', line 6

def tag_name(tag_name)
  @tags = [] if @tags.nil?
  @tags << tag_name
end

#tags_in_title(tags) ⇒ Object



72
73
74
75
76
77
78
# File 'lib/features/support/formatter/SilenceHtml/formatter.rb', line 72

def tags_in_title(tags)
  unless tags.nil?
    tags.each do |tag| 
      @builder.span(tag, :class => 'tag_in_title') 
    end
  end
end