htmlcuke 2.0.3 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/htmlcuke/formatter.rb +63 -65
- data/lib/htmlcuke/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 982c7bf37759df7fdb22826f1c2513c5135cc2fc
|
4
|
+
data.tar.gz: 2bfe8bf60e54c7e4809d4c9c8d5e8b5f745d3c28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4db7cccc9d5d569e77c8e3fbb91ebb5f9bd10b8be820acc4bd120d9390b447471ba89939c9994f9ca39cfbb67103e43ec3410b4c7565d41388f7e9af1c5a4717
|
7
|
+
data.tar.gz: 211f429ae4c3f7ee47aa03641560da6cbe1cda194e091e389795459a52b78910fe32624599ef487562d195891f70ab7f3aa07a8e17259b726578db009d68a31a
|
data/README.md
CHANGED
@@ -8,11 +8,11 @@ The formatter also embeds a screenshot link of the last window focused in a fail
|
|
8
8
|
|
9
9
|
Add this line to your application's Gemfile:
|
10
10
|
|
11
|
-
gem 'htmlcuke'
|
11
|
+
gem 'htmlcuke', '~> 2.0.3'
|
12
12
|
|
13
13
|
And then execute:
|
14
14
|
|
15
|
-
$ bundle
|
15
|
+
$ bundle install
|
16
16
|
|
17
17
|
Or install it yourself as:
|
18
18
|
|
data/lib/htmlcuke/formatter.rb
CHANGED
@@ -1,75 +1,74 @@
|
|
1
1
|
require 'cucumber/formatter/html'
|
2
2
|
|
3
|
-
module
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
@
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
@builder << modified_msg
|
15
|
-
end
|
3
|
+
module Htmlcuke
|
4
|
+
class Formatter < Cucumber::Formatter::Html
|
5
|
+
|
6
|
+
def print_messages
|
7
|
+
return if @delayed_messages.empty?
|
8
|
+
|
9
|
+
@delayed_messages.each do |msg|
|
10
|
+
@builder.li(:class => 'step message') do
|
11
|
+
modified_msg = msg
|
12
|
+
modified_msg.to_s.gsub!(/\[[0-9;]*m/, '') # Remove color codes from colorizer/puts for HTML format only
|
13
|
+
@builder << modified_msg
|
16
14
|
end
|
17
|
-
empty_messages
|
18
15
|
end
|
16
|
+
empty_messages
|
17
|
+
end
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
end
|
19
|
+
def embed_image(src, label)
|
20
|
+
id = "img_#{@img_id}"
|
21
|
+
modified_src = src
|
22
|
+
modified_src = modified_src.split(',')
|
23
|
+
modified_src = modified_src.drop(1) unless modified_src.size != 2
|
24
|
+
modified_src = modified_src[0]
|
25
|
+
@img_id += 1
|
26
|
+
@builder.span(:class => 'embed') do |pre|
|
27
|
+
pre << %{<a href="" onclick="img=document.getElementById('#{id}'); img.style.display = 'none'; window.open('#{modified_src}', '_blank');return false">#{label}</a><br>
|
28
|
+
<img id="#{id}" style="display: none" src="#{modified_src}"/>} unless label == 'Screenshot' # if you want the image to show up on the same page change to: img.style.display = (img.style.display == 'none' ? 'block' : 'none')
|
31
29
|
end
|
30
|
+
end
|
32
31
|
|
33
|
-
|
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
|
-
end
|
59
|
-
@builder.div(:id => 'summary') do
|
60
|
-
@builder.p('',:id => 'totals')
|
61
|
-
@builder.p('',:id => 'duration')
|
62
|
-
end
|
32
|
+
def before_features(features)
|
33
|
+
@step_count = features && features.step_count || 0
|
34
|
+
|
35
|
+
# <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
36
|
+
@builder.declare!(
|
37
|
+
:DOCTYPE,
|
38
|
+
:html,
|
39
|
+
:PUBLIC,
|
40
|
+
'-//W3C//DTD XHTML 1.0 Strict//EN',
|
41
|
+
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'
|
42
|
+
)
|
43
|
+
|
44
|
+
@builder << '<html xmlns ="http://www.w3.org/1999/xhtml">'
|
45
|
+
@builder.head do
|
46
|
+
@builder.meta('http-equiv' => 'Content-Type', :content => 'text/html;charset=utf-8')
|
47
|
+
@builder.title 'Cucumber'
|
48
|
+
inline_css
|
49
|
+
inline_js
|
50
|
+
end
|
51
|
+
@builder << '<body>'
|
52
|
+
@builder << "<!-- Step count #{@step_count}-->"
|
53
|
+
@builder << '<div class="cucumber">'
|
54
|
+
@builder.div(:id => 'cucumber-header') do
|
55
|
+
@builder.div(:id => 'label') do
|
56
|
+
@builder.h1('Cucumber Features')
|
63
57
|
end
|
64
|
-
@builder.div(:id => '
|
65
|
-
@builder.p('
|
66
|
-
@builder.p('
|
67
|
-
@builder.p('Hide Pending', :id=> 'hide_pending', :class => 'hide_pending')
|
58
|
+
@builder.div(:id => 'summary') do
|
59
|
+
@builder.p('',:id => 'totals')
|
60
|
+
@builder.p('',:id => 'duration')
|
68
61
|
end
|
69
62
|
end
|
63
|
+
@builder.div(:id => 'expand-collapse') do
|
64
|
+
@builder.p('Hide Passing', :id => 'hide_passing', :class => 'hide_passing')
|
65
|
+
@builder.p('Hide Failing', :id => 'hide_failing', :class => 'hide_failing')
|
66
|
+
@builder.p('Hide Pending', :id=> 'hide_pending', :class => 'hide_pending')
|
67
|
+
end
|
68
|
+
end
|
70
69
|
|
71
|
-
|
72
|
-
|
70
|
+
def inline_js_content
|
71
|
+
<<-EOF
|
73
72
|
|
74
73
|
SCENARIOS = "h3[id^='scenario_'],h3[id^=background_]";
|
75
74
|
FAILED_SCENARIOS = "h3[style*='rgb(196, 13, 13)']";
|
@@ -188,9 +187,8 @@ module Cucumber
|
|
188
187
|
$('#'+element_id).css('color', '#000000');
|
189
188
|
}
|
190
189
|
|
191
|
-
|
192
|
-
end
|
193
|
-
|
190
|
+
EOF
|
194
191
|
end
|
192
|
+
|
195
193
|
end
|
196
|
-
end
|
194
|
+
end
|
data/lib/htmlcuke/version.rb
CHANGED