htmlcuke 2.0.2 → 2.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc7424a52e612935d387baf757a96c92cfafce34
4
- data.tar.gz: 9012fdc0d7e9e5d8fdb906a7754dd047f2218a41
3
+ metadata.gz: b13616fd06fa25c4f83603eaed79792cba0719b6
4
+ data.tar.gz: 30f4b9c0371d0952c9b46d9b5d1ff8cc2dddf0b8
5
5
  SHA512:
6
- metadata.gz: 5240baca3b5246806b96d0c547f971333c83ca76e3db292e3e248c8ba74fcda4467782aac14306adc200144431526e2223df301cfb050892aa25066b9aa9b68a
7
- data.tar.gz: 4c284a3f49c8dde2761454262f2a2a7af18a8aa56c8ebc9acac58229efb46e5ccdb3ba3c9916eabb73570a00b4e768986a0728ab418b503ef6b73bb005eaf1d5
6
+ metadata.gz: 60bf4a8b1c2530d472acff190924746e3c8e64689e584001470012162e2e49c52b7c3beff8a6a590210a048cd2d607fd4822d4e9e5465e62d5adf580798393fa
7
+ data.tar.gz: e80558bf93ba44e36b998444f44c5e0358e1436c4938c17fbccb783a0ca60b6db4d223bd8440acc1a3d8bb0bfea0f2c3ca162d8b2b67188a1c389ee71e26b3e0
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Htmlcuke [![htmlcuke API Documentation](https://www.omniref.com/ruby/gems/htmlcuke.png)](https://www.omniref.com/ruby/gems/htmlcuke)
2
2
 
3
3
  A custom Html formatter for Cucumber that provides specific functionality.
4
- This formatter removes (if necessary) any color codes wrapped around puts statements within a suite that is using the ```colorized``` or similar gem.
5
- The formatter also embeds a screenshot link of the last window focused in a failed test and opens the shot in a new tab upon clicking the link as well as providing custom buttons with hover and switch-text click functionality to hide/show all pending, failed, or passed tests.
4
+ This formatter removes (if necessary) any color codes wrapped around puts statements within a suite that is using the ```colorized``` or similar gem - as those codes will show up in your html report otherwise.
5
+ The formatter also embeds a screenshot link of the last window focused in a failed test and opens the shot in a new tab upon clicking the link, as well as providing custom buttons with hover and switch-text click functionality to hide/show all pending, failed, or passed tests.
6
6
 
7
7
  ## Installation
8
8
 
@@ -1,7 +1,9 @@
1
1
  require 'cucumber/formatter/html'
2
2
 
3
- module Htmlcuke
4
- class Formatter < Cucumber::Formatter::Html
3
+ module Cucumber
4
+ module Formatter
5
+ class CustomHtml < Cucumber::Formatter::Html
6
+
5
7
  def print_messages
6
8
  return if @delayed_messages.empty?
7
9
 
@@ -16,15 +18,15 @@ require 'cucumber/formatter/html'
16
18
  end
17
19
 
18
20
  def embed_image(src, label)
21
+ id = "img_#{@img_id}"
19
22
  modified_src = src
20
23
  modified_src = modified_src.split(',')
21
24
  modified_src = modified_src.drop(1) unless modified_src.size != 2
22
25
  modified_src = modified_src[0]
23
- id = "img_#{@img_id}"
24
26
  @img_id += 1
25
27
  @builder.span(:class => 'embed') do |pre|
26
- pre << %{<a href="" onclick="img=document.getElementById('#{id}'); img.style.display = 'none'; window.open('file://#{src}', '_blank');return false">#{label}</a><br>&nbsp;
27
- <img id="#{id}" style="display: none" src="#{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')
28
+ pre << %{<a href="" onclick="img=document.getElementById('#{id}'); img.style.display = 'none'; window.open('#{modified_src}', '_blank');return false">#{label}</a><br>&nbsp;
29
+ <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')
28
30
  end
29
31
  end
30
32
 
@@ -74,6 +76,14 @@ require 'cucumber/formatter/html'
74
76
  PENDING_SCENARIOS = "h3[style*='rgb(250, 248, 52)']";
75
77
  PASSED_SCENARIOS = "h3[style^='cursor:']";
76
78
  BACKGROUND_SCENARIOS = "h3[id^=background_]";
79
+ var box_color = "#666"
80
+ var button_color = "#2DB6CF"
81
+ var hover_button_color = "#46b98a"
82
+ var click_button_color = "#294A4F"
83
+ var $box_style = "text-align: right; padding-bottom: 1em; background-color:" + box_color + "; background-position: initial initial; background-repeat: initial initial;";
84
+ var $button_style = "margin-right: 1em; border: 0 none; border-radius: 6px 6px 6px 6px; color: #FFFFFF; cursor: pointer; display: inline-block; font-family: Arial,sans-serif; font-size: 12px; font-weight: bold; line-height: 20px; margin-bottom: 0; margin-top: 10px; padding: 7px 10px; text-transform: none; transition: all 0.3s ease 0s; -moz-transition: all 0.3s ease 0s; -webkit-transition: all 0.3s ease 0s; width: auto; text-align: center; background: none repeat scroll 0 0" + button_color + ";";
85
+ var $hover_button_style = "margin-right: 1em; border: 0 none; border-radius: 6px 6px 6px 6px; color: #FFFFFF; cursor: pointer; display: inline-block; font-family: Arial,sans-serif; font-size: 12px; font-weight: bold; line-height: 20px; margin-bottom: 0; margin-top: 10px; padding: 7px 10px; text-transform: none; transition: all 0.3s ease 0s; -moz-transition: all 0.3s ease 0s; -webkit-transition: all 0.3s ease 0s; width: auto; text-align: center; background: none repeat scroll 0 0" + hover_button_color + ";";
86
+ var $click_button_style = "margin-right: 1em; border: 0 none; border-radius: 6px 6px 6px 6px; color: #FFFFFF; cursor: pointer; display: inline-block; font-family: Arial,sans-serif; font-size: 12px; font-weight: bold; line-height: 20px; margin-bottom: 0; margin-top: 10px; padding: 7px 10px; text-transform: none; transition: all 0.3s ease 0s; -moz-transition: all 0.3s ease 0s; -webkit-transition: all 0.3s ease 0s; width: auto; text-align: center; background: none repeat scroll 0 0" + click_button_color + ";";
77
87
 
78
88
  $(document).ready(function() {
79
89
  $(SCENARIOS).css('cursor', 'pointer');
@@ -81,13 +91,13 @@ require 'cucumber/formatter/html'
81
91
  $(this).siblings().toggle(250);
82
92
  });
83
93
 
84
- $("#expand-collapse").attr("style", "text-align: right; padding-bottom: 1em; background-color: #666; background-position: initial initial; background-repeat: initial initial;");
94
+ $("#expand-collapse").attr("style", $box_style);
85
95
 
86
- $("#hide_pending").attr("style", "margin-right: 1em; border: 0 none; border-radius: 6px 6px 6px 6px; color: #FFFFFF; cursor: pointer; display: inline-block; font-family: Arial,sans-serif; font-size: 12px; font-weight: bold; line-height: 20px; margin-bottom: 0; margin-top: 10px; padding: 7px 10px; text-transform: none; transition: all 0.3s ease 0s; -moz-transition: all 0.3s ease 0s; -webkit-transition: all 0.3s ease 0s; width: auto; text-align: center; background: none repeat scroll 0 0 #2DB6CF;");
96
+ $("#hide_pending").attr("style", $button_style);
87
97
 
88
98
  $("#hide_pending").hover(function() {
89
- $("#hide_pending").attr("style", "margin-right: 1em; border: 0 none; border-radius: 6px 6px 6px 6px; color: #FFFFFF; cursor: pointer; display: inline-block; font-family: Arial,sans-serif; font-size: 12px; font-weight: bold; line-height: 20px; margin-bottom: 0; margin-top: 10px; padding: 7px 10px; text-transform: none; transition: all 0.3s ease 0s; -moz-transition: all 0.3s ease 0s; -webkit-transition: all 0.3s ease 0s; width: auto; text-align: center; background: none repeat scroll 0 0 #46b98a;")}, function() {
90
- $("#hide_pending").attr("style", "margin-right: 1em; border: 0 none; border-radius: 6px 6px 6px 6px; color: #FFFFFF; cursor: pointer; display: inline-block; font-family: Arial,sans-serif; font-size: 12px; font-weight: bold; line-height: 20px; margin-bottom: 0; margin-top: 10px; padding: 7px 10px; text-transform: none; transition: all 0.3s ease 0s; -moz-transition: all 0.3s ease 0s; -webkit-transition: all 0.3s ease 0s; width: auto; text-align: center; background: none repeat scroll 0 0 #2DB6CF;");
99
+ $("#hide_pending").attr("style", $hover_button_style)}, function() {
100
+ $("#hide_pending").attr("style", $button_style);
91
101
  });
92
102
 
93
103
  $("#hide_pending").click(function() {
@@ -97,24 +107,24 @@ require 'cucumber/formatter/html'
97
107
  $this.text('Hide Pending');
98
108
  $(PENDING_SCENARIOS).siblings().show();
99
109
  $this.hover(function() {
100
- $this.attr("style", "margin-right: 1em; border: 0 none; border-radius: 6px 6px 6px 6px; color: #FFFFFF; cursor: pointer; display: inline-block; font-family: Arial,sans-serif; font-size: 12px; font-weight: bold; line-height: 20px; margin-bottom: 0; margin-top: 10px; padding: 7px 10px; text-transform: none; transition: all 0.3s ease 0s; -moz-transition: all 0.3s ease 0s; -webkit-transition: all 0.3s ease 0s; width: auto; text-align: center; background: none repeat scroll 0 0 #46b98a;")}, function() {
101
- $this.attr("style", "margin-right: 1em; border: 0 none; border-radius: 6px 6px 6px 6px; color: #FFFFFF; cursor: pointer; display: inline-block; font-family: Arial,sans-serif; font-size: 12px; font-weight: bold; line-height: 20px; margin-bottom: 0; margin-top: 10px; padding: 7px 10px; text-transform: none; transition: all 0.3s ease 0s; -moz-transition: all 0.3s ease 0s; -webkit-transition: all 0.3s ease 0s; width: auto; text-align: center; background: none repeat scroll 0 0 #2DB6CF;");
110
+ $this.attr("style", $hover_button_style)}, function() {
111
+ $this.attr("style", $button_style);
102
112
  });
103
113
  } else {
104
114
  $this.text('Show Pending');
105
115
  $(PENDING_SCENARIOS).siblings().hide();
106
116
  $this.hover(function() {
107
- $this.attr("style", "margin-right: 1em; border: 0 none; border-radius: 6px 6px 6px 6px; color: #FFFFFF; cursor: pointer; display: inline-block; font-family: Arial,sans-serif; font-size: 12px; font-weight: bold; line-height: 20px; margin-bottom: 0; margin-top: 10px; padding: 7px 10px; text-transform: none; transition: all 0.3s ease 0s; -moz-transition: all 0.3s ease 0s; -webkit-transition: all 0.3s ease 0s; width: auto; text-align: center; background: none repeat scroll 0 0 #46b98a;")}, function() {
108
- $this.attr("style", "margin-right: 1em; border: 0 none; border-radius: 6px 6px 6px 6px; color: #FFFFFF; cursor: pointer; display: inline-block; font-family: Arial,sans-serif; font-size: 12px; font-weight: bold; line-height: 20px; margin-bottom: 0; margin-top: 10px; padding: 7px 10px; text-transform: none; transition: all 0.3s ease 0s; -moz-transition: all 0.3s ease 0s; -webkit-transition: all 0.3s ease 0s; width: auto; text-align: center; background: none repeat scroll 0 0 #294A4F;");
117
+ $this.attr("style", $hover_button_style)}, function() {
118
+ $this.attr("style", $click_button_style);
109
119
  });
110
120
  }
111
121
  });
112
122
 
113
- $("#hide_failing").attr("style", "margin-right: 1em; border: 0 none; border-radius: 6px 6px 6px 6px; color: #FFFFFF; cursor: pointer; display: inline-block; font-family: Arial,sans-serif; font-size: 12px; font-weight: bold; line-height: 20px; margin-bottom: 0; margin-top: 10px; padding: 7px 10px; text-transform: none; transition: all 0.3s ease 0s; -moz-transition: all 0.3s ease 0s; -webkit-transition: all 0.3s ease 0s; width: auto; text-align: center; background: none repeat scroll 0 0 #2DB6CF;");
123
+ $("#hide_failing").attr("style", $button_style);
114
124
 
115
125
  $("#hide_failing").hover(function() {
116
- $("#hide_failing").attr("style", "margin-right: 1em; border: 0 none; border-radius: 6px 6px 6px 6px; color: #FFFFFF; cursor: pointer; display: inline-block; font-family: Arial,sans-serif; font-size: 12px; font-weight: bold; line-height: 20px; margin-bottom: 0; margin-top: 10px; padding: 7px 10px; text-transform: none; transition: all 0.3s ease 0s; -moz-transition: all 0.3s ease 0s; -webkit-transition: all 0.3s ease 0s; width: auto; text-align: center; background: none repeat scroll 0 0 #46b98a;")}, function() {
117
- $("#hide_failing").attr("style", "margin-right: 1em; border: 0 none; border-radius: 6px 6px 6px 6px; color: #FFFFFF; cursor: pointer; display: inline-block; font-family: Arial,sans-serif; font-size: 12px; font-weight: bold; line-height: 20px; margin-bottom: 0; margin-top: 10px; padding: 7px 10px; text-transform: none; transition: all 0.3s ease 0s; -moz-transition: all 0.3s ease 0s; -webkit-transition: all 0.3s ease 0s; width: auto; text-align: center; background: none repeat scroll 0 0 #2DB6CF;");
126
+ $("#hide_failing").attr("style", $hover_button_style)}, function() {
127
+ $("#hide_failing").attr("style", $button_style);
118
128
  });
119
129
 
120
130
  $("#hide_failing").click(function() {
@@ -124,25 +134,24 @@ require 'cucumber/formatter/html'
124
134
  $this.text('Hide Failing');
125
135
  $(FAILED_SCENARIOS).siblings().show();
126
136
  $this.hover(function() {
127
- $this.attr("style", "margin-right: 1em; border: 0 none; border-radius: 6px 6px 6px 6px; color: #FFFFFF; cursor: pointer; display: inline-block; font-family: Arial,sans-serif; font-size: 12px; font-weight: bold; line-height: 20px; margin-bottom: 0; margin-top: 10px; padding: 7px 10px; text-transform: none; transition: all 0.3s ease 0s; -moz-transition: all 0.3s ease 0s; -webkit-transition: all 0.3s ease 0s; width: auto; text-align: center; background: none repeat scroll 0 0 #46b98a;")}, function() {
128
- $this.attr("style", "margin-right: 1em; border: 0 none; border-radius: 6px 6px 6px 6px; color: #FFFFFF; cursor: pointer; display: inline-block; font-family: Arial,sans-serif; font-size: 12px; font-weight: bold; line-height: 20px; margin-bottom: 0; margin-top: 10px; padding: 7px 10px; text-transform: none; transition: all 0.3s ease 0s; -moz-transition: all 0.3s ease 0s; -webkit-transition: all 0.3s ease 0s; width: auto; text-align: center; background: none repeat scroll 0 0 #2DB6CF;");
137
+ $this.attr("style", $hover_button_style)}, function() {
138
+ $this.attr("style", $button_style);
129
139
  });
130
140
  } else {
131
141
  $this.text('Show Failing');
132
- $this.css("background-color", "#46b90a !important");
133
142
  $(FAILED_SCENARIOS).siblings().hide();
134
143
  $this.hover(function() {
135
- $this.attr("style", "margin-right: 1em; border: 0 none; border-radius: 6px 6px 6px 6px; color: #FFFFFF; cursor: pointer; display: inline-block; font-family: Arial,sans-serif; font-size: 12px; font-weight: bold; line-height: 20px; margin-bottom: 0; margin-top: 10px; padding: 7px 10px; text-transform: none; transition: all 0.3s ease 0s; -moz-transition: all 0.3s ease 0s; -webkit-transition: all 0.3s ease 0s; width: auto; text-align: center; background: none repeat scroll 0 0 #46b98a;")}, function() {
136
- $this.attr("style", "margin-right: 1em; border: 0 none; border-radius: 6px 6px 6px 6px; color: #FFFFFF; cursor: pointer; display: inline-block; font-family: Arial,sans-serif; font-size: 12px; font-weight: bold; line-height: 20px; margin-bottom: 0; margin-top: 10px; padding: 7px 10px; text-transform: none; transition: all 0.3s ease 0s; -moz-transition: all 0.3s ease 0s; -webkit-transition: all 0.3s ease 0s; width: auto; text-align: center; background: none repeat scroll 0 0 #294A4F;");
144
+ $this.attr("style", $hover_button_style)}, function() {
145
+ $this.attr("style", $click_button_style);
137
146
  });
138
147
  }
139
148
  });
140
149
 
141
- $("#hide_passing").attr("style", "margin-right: 1em; border: 0 none; border-radius: 6px 6px 6px 6px; color: #FFFFFF; cursor: pointer; display: inline-block; font-family: Arial,sans-serif; font-size: 12px; font-weight: bold; line-height: 20px; margin-bottom: 0; margin-top: 10px; padding: 7px 10px; text-transform: none; transition: all 0.3s ease 0s; -moz-transition: all 0.3s ease 0s; -webkit-transition: all 0.3s ease 0s; width: auto; text-align: center; background: none repeat scroll 0 0 #2DB6CF;");
150
+ $("#hide_passing").attr("style", $button_style);
142
151
 
143
152
  $("#hide_passing").hover(function() {
144
- $("#hide_passing").attr("style", "margin-right: 1em; border: 0 none; border-radius: 6px 6px 6px 6px; color: #FFFFFF; cursor: pointer; display: inline-block; font-family: Arial,sans-serif; font-size: 12px; font-weight: bold; line-height: 20px; margin-bottom: 0; margin-top: 10px; padding: 7px 10px; text-transform: none; transition: all 0.3s ease 0s; -moz-transition: all 0.3s ease 0s; -webkit-transition: all 0.3s ease 0s; width: auto; text-align: center; background: none repeat scroll 0 0 #46b98a;")}, function() {
145
- $("#hide_passing").attr("style", "margin-right: 1em; border: 0 none; border-radius: 6px 6px 6px 6px; color: #FFFFFF; cursor: pointer; display: inline-block; font-family: Arial,sans-serif; font-size: 12px; font-weight: bold; line-height: 20px; margin-bottom: 0; margin-top: 10px; padding: 7px 10px; text-transform: none; transition: all 0.3s ease 0s; -moz-transition: all 0.3s ease 0s; -webkit-transition: all 0.3s ease 0s; width: auto; text-align: center; background: none repeat scroll 0 0 #2DB6CF;");
153
+ $("#hide_passing").attr("style", $hover_button_style)}, function() {
154
+ $("#hide_passing").attr("style", $button_style);
146
155
  });
147
156
 
148
157
  $("#hide_passing").click(function() {
@@ -152,16 +161,15 @@ require 'cucumber/formatter/html'
152
161
  $this.text('Hide Passing');
153
162
  $(PASSED_SCENARIOS).siblings().show();
154
163
  $this.hover(function() {
155
- $this.attr("style", "margin-right: 1em; border: 0 none; border-radius: 6px 6px 6px 6px; color: #FFFFFF; cursor: pointer; display: inline-block; font-family: Arial,sans-serif; font-size: 12px; font-weight: bold; line-height: 20px; margin-bottom: 0; margin-top: 10px; padding: 7px 10px; text-transform: none; transition: all 0.3s ease 0s; -moz-transition: all 0.3s ease 0s; -webkit-transition: all 0.3s ease 0s; width: auto; text-align: center; background: none repeat scroll 0 0 #46b98a;")}, function() {
156
- $this.attr("style", "margin-right: 1em; border: 0 none; border-radius: 6px 6px 6px 6px; color: #FFFFFF; cursor: pointer; display: inline-block; font-family: Arial,sans-serif; font-size: 12px; font-weight: bold; line-height: 20px; margin-bottom: 0; margin-top: 10px; padding: 7px 10px; text-transform: none; transition: all 0.3s ease 0s; -moz-transition: all 0.3s ease 0s; -webkit-transition: all 0.3s ease 0s; width: auto; text-align: center; background: none repeat scroll 0 0 #2DB6CF;");
164
+ $this.attr("style", $hover_button_style)}, function() {
165
+ $this.attr("style", $button_style);
157
166
  });
158
167
  } else {
159
168
  $this.text('Show Passing');
160
- $this.css("background", "#46b90a !important");
161
169
  $(PASSED_SCENARIOS).siblings().hide();
162
170
  $this.hover(function() {
163
- $this.attr("style", "margin-right: 1em; border: 0 none; border-radius: 6px 6px 6px 6px; color: #FFFFFF; cursor: pointer; display: inline-block; font-family: Arial,sans-serif; font-size: 12px; font-weight: bold; line-height: 20px; margin-bottom: 0; margin-top: 10px; padding: 7px 10px; text-transform: none; transition: all 0.3s ease 0s; -moz-transition: all 0.3s ease 0s; -webkit-transition: all 0.3s ease 0s; width: auto; text-align: center; background: none repeat scroll 0 0 #46b98a;")}, function() {
164
- $this.attr("style", "margin-right: 1em; border: 0 none; border-radius: 6px 6px 6px 6px; color: #FFFFFF; cursor: pointer; display: inline-block; font-family: Arial,sans-serif; font-size: 12px; font-weight: bold; line-height: 20px; margin-bottom: 0; margin-top: 10px; padding: 7px 10px; text-transform: none; transition: all 0.3s ease 0s; -moz-transition: all 0.3s ease 0s; -webkit-transition: all 0.3s ease 0s; width: auto; text-align: center; background: none repeat scroll 0 0 #294A4F;");
171
+ $this.attr("style", $hover_button_style)}, function() {
172
+ $this.attr("style", $click_button_style);
165
173
  });
166
174
  }
167
175
  });
@@ -179,9 +187,10 @@ require 'cucumber/formatter/html'
179
187
  $('#'+element_id).css('background', '#FAF834');
180
188
  $('#'+element_id).css('color', '#000000');
181
189
  }
182
-
190
+
183
191
  EOF
184
192
  end
185
193
 
186
194
  end
187
195
  end
196
+ end
@@ -1,3 +1,3 @@
1
1
  module Htmlcuke
2
- VERSION = "2.0.2"
2
+ VERSION = "2.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: htmlcuke
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Ray
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-29 00:00:00.000000000 Z
11
+ date: 2014-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber