sapphire 0.7.15 → 0.7.16
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.
- data/bin/sapphire +7 -11
- data/lib/sapphire/Testing/HtmlReporter.rb +97 -6
- data/lib/sapphire/version.rb +1 -1
- metadata +8 -8
data/bin/sapphire
CHANGED
@@ -7,20 +7,16 @@ include Sapphire::Sapphire
|
|
7
7
|
$reporters = []
|
8
8
|
$instances = []
|
9
9
|
|
10
|
-
ARGV.each do |arg|
|
11
|
-
if arg.start_with? "reporter="
|
12
|
-
item = arg.split "reporter="
|
13
|
-
$reporters << item.last
|
14
10
|
|
15
|
-
|
16
|
-
|
11
|
+
if ENV["reporter"]
|
12
|
+
$reporters << ENV["reporter"]
|
13
|
+
end
|
17
14
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
next
|
22
|
-
end
|
15
|
+
if ENV["file"]
|
16
|
+
@file = ENV["file"]
|
17
|
+
end
|
23
18
|
|
19
|
+
ARGV.each do |arg|
|
24
20
|
if !arg.end_with? ".rb"
|
25
21
|
next
|
26
22
|
end
|
@@ -20,7 +20,7 @@ module Sapphire
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def TestStarted(test)
|
23
|
-
|
23
|
+
@test_count = @test_count + 1
|
24
24
|
end
|
25
25
|
|
26
26
|
def Indent(test)
|
@@ -45,6 +45,7 @@ module Sapphire
|
|
45
45
|
|
46
46
|
def TestFailed(test)
|
47
47
|
|
48
|
+
@failing_count = @failing_count + 1
|
48
49
|
failure_style = 'failed'
|
49
50
|
@output.puts " <script type=\"text/javascript\">makeRed('rspec-header');</script>" unless @header_red
|
50
51
|
@header_red = true
|
@@ -83,21 +84,23 @@ module Sapphire
|
|
83
84
|
end
|
84
85
|
|
85
86
|
def TestPending(test)
|
87
|
+
@pending_count = @pending_count + 1
|
86
88
|
@output.puts " <script type=\"text/javascript\">makeYellow('rspec-header');</script>" unless @header_red
|
87
89
|
@output.puts " <script type=\"text/javascript\">makeYellow('example_group_#{@example_group_number}');</script>" unless @example_group_red
|
88
90
|
@output.puts " <dd class=\"spec not_implemented\"><span class=\"not_implemented_spec_name\">#{Indent(test) + test.text} (PENDING: ### Not Yet Implemented ###)</span></dd>"
|
89
91
|
end
|
90
92
|
|
91
93
|
def TestBroken(test)
|
94
|
+
@broken_count = @broken_count + 1
|
92
95
|
@output.puts " <script type=\"text/javascript\">makeOrange('rspec-header');</script>" unless @header_red
|
93
96
|
@output.puts " <script type=\"text/javascript\">makeOrange('example_group_#{@example_group_number}');</script>" unless @example_group_red
|
94
|
-
@output.puts " <dd class=\"spec
|
97
|
+
@output.puts " <dd class=\"spec broken\"><span class=\"broken_spec_name\">#{Indent(test) + test.text} (BROKEN: ### Broken ###)</span></dd>"
|
95
98
|
end
|
96
99
|
|
97
100
|
def TestingComplete
|
98
101
|
@end = Time.now
|
99
102
|
|
100
|
-
totals = "#{@test_count} example#{'s' unless @test_count == 1}, #{@
|
103
|
+
totals = "#{@test_count} example#{'s' unless @test_count == 1}, #{@failing_count} failure#{'s' unless @failing_count == 1}"
|
101
104
|
totals << ", #{@pending_count} pending" if @pending_count > 0
|
102
105
|
totals << ", #{@broken_count} broken" if @broken_count > 0
|
103
106
|
|
@@ -174,7 +177,14 @@ EOF
|
|
174
177
|
|
175
178
|
<div id="rspec-header">
|
176
179
|
<div id="label">
|
177
|
-
<h1>
|
180
|
+
<h1>Sapphire Test Results</h1>
|
181
|
+
</div>
|
182
|
+
|
183
|
+
<div id="display-filters">
|
184
|
+
<input id="passed_checkbox" name="passed_checkbox" type="checkbox" checked="" onchange="apply_filters()" value="1"> <label for="passed_checkbox">Passed</label>
|
185
|
+
<input id="failed_checkbox" name="failed_checkbox" type="checkbox" checked="" onchange="apply_filters()" value="2"> <label for="failed_checkbox">Failed</label>
|
186
|
+
<input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked="" onchange="apply_filters()" value="3"> <label for="pending_checkbox">Pending</label>
|
187
|
+
<input id="broken_checkbox" name="broken_checkbox" type="checkbox" checked="" onchange="apply_filters()" value="4"> <label for="broken_checkbox">Broken</label>
|
178
188
|
</div>
|
179
189
|
|
180
190
|
<div id="summary">
|
@@ -189,12 +199,25 @@ EOF
|
|
189
199
|
|
190
200
|
def global_scripts
|
191
201
|
<<-EOF
|
202
|
+
function addClass(element_id, classname) {
|
203
|
+
document.getElementById(element_id).className += (" " + classname);
|
204
|
+
}
|
205
|
+
|
206
|
+
function removeClass(element_id, classname) {
|
207
|
+
var elem = document.getElementById(element_id);
|
208
|
+
var classlist = elem.className.replace(classname,'');
|
209
|
+
elem.className = classlist;
|
210
|
+
}
|
211
|
+
|
192
212
|
function moveProgressBar(percentDone) {
|
193
213
|
document.getElementById("rspec-header").style.width = percentDone +"%";
|
194
214
|
}
|
215
|
+
|
195
216
|
function makeRed(element_id) {
|
196
|
-
|
197
|
-
|
217
|
+
removeClass(element_id, 'passed');
|
218
|
+
removeClass(element_id, 'not_implemented');
|
219
|
+
removeClass(element_id, 'broken');
|
220
|
+
addClass(element_id,'failed');
|
198
221
|
}
|
199
222
|
|
200
223
|
function makeYellow(element_id) {
|
@@ -209,6 +232,62 @@ function makeYellow(element_id) {
|
|
209
232
|
document.getElementById(element_id).style.color = '#000000';
|
210
233
|
}
|
211
234
|
}
|
235
|
+
|
236
|
+
function makeOrange(element_id) {
|
237
|
+
if (element_id == "rspec-header" && document.getElementById(element_id).style.background != '#C40D0D')
|
238
|
+
{
|
239
|
+
document.getElementById(element_id).style.background = '#FF8000';
|
240
|
+
document.getElementById(element_id).style.color = '#000000';
|
241
|
+
}
|
242
|
+
else
|
243
|
+
{
|
244
|
+
document.getElementById(element_id).style.background = '#FF8000';
|
245
|
+
document.getElementById(element_id).style.color = '#000000';
|
246
|
+
}
|
247
|
+
}
|
248
|
+
|
249
|
+
function apply_filters() {
|
250
|
+
var passed_filter = document.getElementById('passed_checkbox').checked;
|
251
|
+
var failed_filter = document.getElementById('failed_checkbox').checked;
|
252
|
+
var pending_filter = document.getElementById('pending_checkbox').checked;
|
253
|
+
var broken_filter = document.getElementById('broken_checkbox').checked;
|
254
|
+
|
255
|
+
assign_display_style("spec passed", passed_filter);
|
256
|
+
assign_display_style("spec failed", failed_filter);
|
257
|
+
assign_display_style("spec not_implemented", pending_filter);
|
258
|
+
assign_display_style("spec broken", broken_filter);
|
259
|
+
|
260
|
+
}
|
261
|
+
|
262
|
+
function get_display_style(display_flag) {
|
263
|
+
var style_mode = 'none';
|
264
|
+
if (display_flag == true) {
|
265
|
+
style_mode = 'block';
|
266
|
+
}
|
267
|
+
return style_mode;
|
268
|
+
}
|
269
|
+
|
270
|
+
function assign_display_style(classname, display_flag) {
|
271
|
+
var style_mode = get_display_style(display_flag);
|
272
|
+
var elems = document.getElementsByClassName(classname)
|
273
|
+
for (var i=0; i<elems.length;i++) {
|
274
|
+
elems[i].style.display = style_mode;
|
275
|
+
}
|
276
|
+
}
|
277
|
+
|
278
|
+
function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
|
279
|
+
var display_style_mode = get_display_style(display_flag);
|
280
|
+
var subgroup_style_mode = get_display_style(subgroup_flag);
|
281
|
+
var elems = document.getElementsByClassName(classname)
|
282
|
+
for (var i=0; i<elems.length;i++) {
|
283
|
+
var style_mode = display_style_mode;
|
284
|
+
if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
|
285
|
+
elems[i].style.display = subgroup_style_mode;
|
286
|
+
} else {
|
287
|
+
elems[i].style.display = display_style_mode;
|
288
|
+
}
|
289
|
+
}
|
290
|
+
}
|
212
291
|
EOF
|
213
292
|
end
|
214
293
|
|
@@ -283,6 +362,12 @@ dd.spec.not_implemented {
|
|
283
362
|
background: #FCFB98; color: #131313;
|
284
363
|
}
|
285
364
|
|
365
|
+
dd.spec.broken {
|
366
|
+
border-left: 5px solid #FF8000;
|
367
|
+
border-bottom: 1px solid #FF8000;
|
368
|
+
background: #FCFB98; color: #131313;
|
369
|
+
}
|
370
|
+
|
286
371
|
dd.spec.pending_fixed {
|
287
372
|
border-left: 5px solid #0000C2;
|
288
373
|
border-bottom: 1px solid #0000C2;
|
@@ -307,6 +392,12 @@ a {
|
|
307
392
|
padding: 0.1em 0 0.2em 0;
|
308
393
|
}
|
309
394
|
|
395
|
+
#display-filters {
|
396
|
+
float:left;
|
397
|
+
padding: 28px 0 0 40%;
|
398
|
+
font-family: "Lucida Grande", Helvetica, sans-serif;
|
399
|
+
}
|
400
|
+
|
310
401
|
.ruby .keyword { color: #FF6600; }
|
311
402
|
.ruby .constant { color: #339999; }
|
312
403
|
.ruby .attribute { color: white; }
|
data/lib/sapphire/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sapphire
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.16
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-22 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: selenium-webdriver
|
16
|
-
requirement: &
|
16
|
+
requirement: &9892788 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *9892788
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: colorize
|
27
|
-
requirement: &
|
27
|
+
requirement: &9892536 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *9892536
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: Platform
|
38
|
-
requirement: &
|
38
|
+
requirement: &9892284 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *9892284
|
47
47
|
description: An automated web acceptance test framework for non-technical resources
|
48
48
|
using selenium-wedriver.
|
49
49
|
email:
|