bauxite 0.6.8 → 0.6.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -35,56 +35,16 @@ require 'base64'
35
35
  # captures embedded into the report are deleted from
36
36
  # the filesystem.
37
37
  #
38
- class Bauxite::Loggers::HtmlLogger < Bauxite::Loggers::NullLogger
38
+ class Bauxite::Loggers::HtmlLogger < Bauxite::Loggers::ReportLogger
39
39
 
40
40
  # Constructs a new null logger instance.
41
41
  #
42
42
  def initialize(options)
43
43
  super(options)
44
- @data = []
45
44
  @file = options[:html] || 'test.html'
46
45
  @imgs = []
47
46
  end
48
47
 
49
- # Logs the specified string.
50
- #
51
- # +type+, if specified, should be one of +:error+, +:warning+,
52
- # +:info+ (default), +:debug+.
53
- #
54
- def log(s, type = :info)
55
- end
56
-
57
- # Echoes the raw action text.
58
- def log_cmd(action)
59
- ret = yield || false
60
- ensure
61
- status = case ret; when nil; :error; when false; :skip; else :ok; end
62
-
63
- test_name = action.ctx.variables['__TEST__'] || 'Main'
64
- test = @data.find { |t| t[:name] == test_name }
65
- unless test
66
- test = { :name => test_name, :actions => [] }
67
- @data << test
68
- end
69
-
70
- capture = action.ctx.variables['__CAPTURE__']
71
- if capture == @last_capture
72
- capture = nil
73
- else
74
- @last_capture = capture
75
- end
76
-
77
- test[:actions] << {
78
- :cmd => action.cmd,
79
- :args => action.args(true),
80
- :action => action,
81
- :status => status,
82
- :capture => capture
83
- }
84
-
85
- ret
86
- end
87
-
88
48
  # Completes the log execution.
89
49
  #
90
50
  def finalize(ctx)
@@ -97,16 +57,18 @@ class Bauxite::Loggers::HtmlLogger < Bauxite::Loggers::NullLogger
97
57
  body { font: 10pt sans-serif; }
98
58
  .action div { display: inline-block; }
99
59
  .cmd { width: 100px }
100
- .status { width: 100px; float: right; text-align: center; font-weight: bold }
60
+ .status { float: right; text-align: center; }
61
+ .status .text { width: 100px; font-weight: bold }
101
62
  .test { background-color: #DFDFFF; margin-top: 20px }
102
- .ok .status { background-color: #DFFFDF }
103
- .error .status { background-color: #FFDFDF }
104
- .skip .status { background-color: #FFDFFF }
63
+ .ok .status .text { background-color: #DFFFDF }
64
+ .error .status .text { background-color: #FFDFDF }
65
+ .skip .status .text { background-color: #FFDFFF }
105
66
  .capture { border: 1px solid black }
106
67
  .capture img { max-width: 100% }
107
68
  .odd { background-color: #EEEEEE }
108
69
  .summary th { background-color: #DFDFFF; text-align: left }
109
70
  .summary td { cursor: pointer; }
71
+ .top { position: absolute; top: 0px; right: 0px; background-color: #DFDFFF; padding: 5px; border-radius: 0px 0px 0px 5px; }
110
72
 
111
73
  </style>
112
74
  <script type='text/javascript'>
@@ -117,7 +79,7 @@ class Bauxite::Loggers::HtmlLogger < Bauxite::Loggers::NullLogger
117
79
  </script>
118
80
  </head>
119
81
  <body>"
120
-
82
+ html << _d(2, "<div class='top'>Created using <a href='https://github.com/pzavolinsky/bauxite'>bauxite</a> on #{Time.new}</div>")
121
83
  if ctx.tests.any?
122
84
  html << _d(2, "<h1>Test Summary</h1>")
123
85
  html << _d(2, "<table class='summary'>")
@@ -139,14 +101,17 @@ class Bauxite::Loggers::HtmlLogger < Bauxite::Loggers::NullLogger
139
101
  name = test[:name]
140
102
  status = test[:actions].find { |a| a[:status] == :error } ? :error : :ok
141
103
  html << _d(2, "<a name='#{name}'></a>")
142
- html << _d(2, "<div class='test #{status}'>#{name}<div class='status'>#{status.upcase}</div></div>")
104
+ html << _d(2, "<div class='test #{status}'>#{name}<div class='status'><div class='text'>#{status.upcase}</div></div></div>")
143
105
  html << _d(2, "<div id='#{name}_content' class='test-content'>")
144
106
 
145
107
  test[:actions].each_with_index do |action,idx|
146
108
  html << _d(3, "<div class='action #{action[:status]} #{(idx % 2) == 1 ? 'odd' : 'even'}'>")
147
109
  html << _d(4, "<div class='cmd'>#{action[:cmd]}</div>")
148
110
  html << _d(4, "<div class='args'>#{action[:args].join(' ')}</div>")
149
- html << _d(4, "<div class='status'>#{action[:status].upcase}</div>")
111
+ html << _d(4, "<div class='status'>")
112
+ html << _d(5, "<div class='time'>(#{action[:time].round(2).to_s}s)</div>")
113
+ html << _d(5, "<div class='text'>#{action[:status].upcase}</div>")
114
+ html << _d(4, "</div>")
150
115
  html << _d(3, "</div>")
151
116
  capture = action[:capture]
152
117
  if capture
@@ -40,10 +40,4 @@ class Bauxite::Parser
40
40
  end
41
41
  end.select { |item| item != nil }
42
42
  end
43
-
44
- private
45
- def _selenium_ide_html_parse_selector(selector)
46
- selector = 'xpath='+selector if selector[0..1] == '//'
47
- selector
48
- end
49
43
  end
data/lib/bauxite.rb CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  #--
24
24
  module Bauxite
25
- VERSION = "0.6.8"
25
+ VERSION = "0.6.9"
26
26
  end
27
27
  #++
28
28
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bauxite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.8
4
+ version: 0.6.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patricio Zavolinsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-11 00:00:00.000000000 Z
11
+ date: 2014-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -67,6 +67,7 @@ files:
67
67
  - doc/Bauxite/Loggers/FileLogger.html
68
68
  - doc/Bauxite/Loggers/HtmlLogger.html
69
69
  - doc/Bauxite/Loggers/NullLogger.html
70
+ - doc/Bauxite/Loggers/ReportLogger.html
70
71
  - doc/Bauxite/Loggers/TerminalLogger.html
71
72
  - doc/Bauxite/Loggers/XtermLogger.html
72
73
  - doc/Bauxite/Parser.html