htmlcuke 1.0.1 → 2.0.0

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: b0dd338249c184ce5e9b83128b6a176693722d6b
4
- data.tar.gz: caea49f9507cfdfc84bb91135bfda3c84bcca98d
3
+ metadata.gz: 2d30c53a93a003553b985e39b23f6499c9fff5dc
4
+ data.tar.gz: 02b92192b622718b40b31684d2ebaf9b4bf1d537
5
5
  SHA512:
6
- metadata.gz: ebe796fd527841d8f784ea701dc40d35afa35560c616779c163ca0afeb62d8f83ea2a4d238e45e72c060109cbbb6a3e6dd028110b8d211fa4cdb2a1367da640c
7
- data.tar.gz: 775e592f2765dff5d741cd6152f3b29dab6f9818a6e52afc862b454dc5dda34b8bb3e721cdfe519a93cec938df4f32c47b32918916f5fc3f4ca116b73857d868
6
+ metadata.gz: 7e0adfabac986649f0fcc18e54858df4e1a6fee416cc30f16e931b5c3689fb613faa02fab1d80fee3340ac2791826131464e7915199df9b7455b758663ad1f1d
7
+ data.tar.gz: c24999e6966718d33ea0bffec5dd426bf65343af694efa154a7256f09fc5bd9edac4d398adea31d8f454e8bacdeb63f9aa3ecac0bfc7d4cdec40d69086f3e24a
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A custom Html formatter for Cucumber that provides specific functionality.
4
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.
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
 
@@ -2,7 +2,6 @@ require 'cucumber/formatter/html'
2
2
 
3
3
  module Htmlcuke
4
4
  class Formatter < Cucumber::Formatter::Html
5
-
6
5
  def print_messages
7
6
  return if @delayed_messages.empty?
8
7
 
@@ -25,5 +24,134 @@ require 'cucumber/formatter/html'
25
24
  end
26
25
  end
27
26
 
27
+ def before_features(features)
28
+ @step_count = features && features.step_count || 0
29
+
30
+ # <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
31
+ @builder.declare!(
32
+ :DOCTYPE,
33
+ :html,
34
+ :PUBLIC,
35
+ '-//W3C//DTD XHTML 1.0 Strict//EN',
36
+ 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'
37
+ )
38
+
39
+ @builder << '<html xmlns ="http://www.w3.org/1999/xhtml">'
40
+ @builder.head do
41
+ @builder.meta('http-equiv' => 'Content-Type', :content => 'text/html;charset=utf-8')
42
+ @builder.title 'Cucumber'
43
+ inline_css
44
+ inline_js
45
+ end
46
+ @builder << '<body>'
47
+ @builder << "<!-- Step count #{@step_count}-->"
48
+ @builder << '<div class="cucumber">'
49
+ @builder.div(:id => 'cucumber-header') do
50
+ @builder.div(:id => 'label') do
51
+ @builder.h1('Cucumber Features')
52
+ end
53
+ @builder.div(:id => 'summary') do
54
+ @builder.p('',:id => 'totals')
55
+ @builder.p('',:id => 'duration')
56
+ end
57
+ end
58
+ @builder.div(:id => 'expand-collapse') do
59
+ @builder.p('Hide Passing', :id => 'hide_passing', :class => 'hide_passing')
60
+ @builder.p('Hide Failing', :id => 'hide_failing', :class => 'hide_failing')
61
+ @builder.p('Hide Pending', :id=> 'hide_pending', :class => 'hide_pending')
62
+ end
63
+ end
64
+
65
+ def inline_js_content
66
+ <<-EOF
67
+
68
+ SCENARIOS = "h3[id^='scenario_'],h3[id^=background_]";
69
+ FAILED_SCENARIOS = "h3[style*='rgb(196, 13, 13)']";
70
+ PENDING_SCENARIOS = "h3[style*='rgb(250, 248, 52)']";
71
+ PASSED_SCENARIOS = "h3[style^='cursor:']";
72
+ BACKGROUND_SCENARIOS = "h3[id^=background_]";
73
+
74
+ $(document).ready(function() {
75
+ $(SCENARIOS).css('cursor', 'pointer');
76
+ $(SCENARIOS).click(function() {
77
+ $(this).siblings().toggle(250);
78
+ });
79
+
80
+ $("#expand-collapse").attr("style", "text-align: right; padding-bottom: 1em; background-color: #666; background-position: initial initial; background-repeat: initial initial;");
81
+
82
+ $("#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;");
83
+
84
+ $("#hide_pending").hover(function() {
85
+ $("#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() {
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;");
87
+ });
88
+
89
+ $("#hide_pending").click(function() {
90
+ var $this = $(this);
91
+ $this.toggleClass('hide_pending');
92
+ if($this.hasClass('hide_pending')){
93
+ $this.text('Hide Pending');
94
+ $(PENDING_SCENARIOS).siblings().show();
95
+ } else {
96
+ $this.text('Show Pending');
97
+ $(PENDING_SCENARIOS).siblings().hide();
98
+ }
99
+ });
100
+
101
+ $("#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;");
102
+
103
+ $("#hide_failing").hover(function() {
104
+ $("#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() {
105
+ $("#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;");
106
+ });
107
+
108
+ $("#hide_failing").click(function() {
109
+ var $this = $(this);
110
+ $this.toggleClass('hide_failing');
111
+ if($this.hasClass('hide_failing')){
112
+ $this.text('Hide Failing');
113
+ $(FAILED_SCENARIOS).siblings().show();
114
+ } else {
115
+ $this.text('Show Failing');
116
+ $(FAILED_SCENARIOS).siblings().hide();
117
+ }
118
+ });
119
+
120
+ $("#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;");
121
+
122
+ $("#hide_passing").hover(function() {
123
+ $("#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() {
124
+ $("#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;");
125
+ });
126
+
127
+ $("#hide_passing").click(function() {
128
+ var $this = $(this);
129
+ $this.toggleClass('hide_passing');
130
+ if($this.hasClass('hide_passing')){
131
+ $this.text('Hide Passing');
132
+ $(PASSED_SCENARIOS).siblings().show();
133
+ } else {
134
+ $this.text('Show Passing');
135
+ $(PASSED_SCENARIOS).siblings().hide();
136
+ }
137
+ });
138
+
139
+ })
140
+
141
+ function moveProgressBar(percentDone) {
142
+ $("cucumber-header").css('width', percentDone +"%");
143
+ }
144
+ function makeRed(element_id) {
145
+ $('#'+element_id).css('background', '#C40D0D');
146
+ $('#'+element_id).css('color', '#FFFFFF');
147
+ }
148
+ function makeYellow(element_id) {
149
+ $('#'+element_id).css('background', '#FAF834');
150
+ $('#'+element_id).css('color', '#000000');
151
+ }
152
+
153
+ EOF
154
+ end
155
+
28
156
  end
29
157
  end
@@ -1,3 +1,3 @@
1
1
  module Htmlcuke
2
- VERSION = "1.0.1"
2
+ VERSION = "2.0.0"
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: 1.0.1
4
+ version: 2.0.0
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-23 00:00:00.000000000 Z
11
+ date: 2014-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber