-
Notifications
You must be signed in to change notification settings - Fork 6
/
html-reporter.hbs
149 lines (124 loc) · 4.04 KB
/
html-reporter.hbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<!DOCTYPE html>
<html>
<head>
<title>Test Results - {{browser}}</title>
<style>
html, body {
font-family: Arial,sans-serif;
margin: 0;
padding: 0;
}
body { padding: 10px 40px; }
table { width: 100%; margin-bottom: 20px; }
td {
padding: 7px;
border-top: none;
border-left: 1px black solid;
border-bottom: 1px black solid;
border-right: none;
}
td.pass { color: #003b07; background: #86e191; }
td.skip { color: #7d3a00; background: #ffd24a; }
td.fail { color: #5e0e00; background: #ff9c8a; }
tr:last-child { border-top: 1px black solid; }
tr:last-child td { border-top: 1px black solid; }
tr:first-child td { border-top: 1px black solid; }
td:last-child { border-right: 1px black solid; }
tr.overview td { padding-bottom: 0px; border-bottom: none; }
tr.overview.last td { padding-bottom: 3px; }
ul.assertions { list-style-type: none; }
span.error { color: #AD2B2B; }
span.success { color: #53891E; }
.stacktrace { display: inline; }
.stacktrace code { display: none; }
#nightwatch-logo {
position: absolute;
top: 20px;
right: 33px;
width: 70px;
height: 75px;
background: transparent url('http://nightwatchjs.org/img/logo-nightwatch.png') no-repeat;
background-size: 70px 75px;
}
</style>
</head>
<body>
<h1>Test Results</h1>
<table border="0" cellpadding="0" cellspacing="0">
<tr class="overview">
<td colspan="3" title="{{browser}}"><strong>Browser:</strong> {{browser}}</td>
</tr>
<tr class="overview">
<td colspan="3"><strong>Timestamp:</strong> {{timestamp}}</td>
</tr>
<tr class="overview last">
<td colspan="3"><strong>Tests:</strong> {{results.tests}}<br></td>
</tr>
<tr>
<td class="pass"><strong>{{results.passed}}</strong> passed</td>
<td class="skip"><strong>{{results.errors}}</strong> errors</td>
<td class="fail"><strong>{{results.failed}}</strong> failures</td>
</tr>
</table>
{{#each results.modules}}
<h2>{{@key}}</h2>
{{#each this.completed}}
<h3>{{@key}}</h3>
<ul class="assertions">
{{#each this.assertions}}
<li>
{{#if failure}}
<span class="error">✖</span>
{{else}}
<span class="success">✔</span>
{{/if}}
{{this.message}}
{{#if this.failure}}
{{this.failure}}
{{/if}}
{{#if this.stacktrace}}
<div class="stacktrace">
<a href="#">view stacktrace</a>
<code><pre>{{this.stacktrace}}</pre></code>
</div>
{{/if}}
</li>
{{/each}}
</ul>
<p>
{{#if this.failed}}
<span class="error"><strong>FAILED:</strong></span>
<span class="error"><strong>{{this.failed}}</strong></span> assertions failed and
<span class="success"><strong>{{this.passed}}</span></strong> passed. ({{this.time}}s)
{{else}}
<span class="success"><strong>OK.</strong></span>
<span class="success"><strong>{{this.passed}}</strong></span> assertions passed. ({{this.time}}s)
{{/if}}
</p>
{{/each}}
{{#if this.skipped}}
<h4>skipped</h4>
<ul>
{{#each this.skipped}}
<li>{{this}}</li>
{{/each}}
</ul>
{{/if}}
<hr>
{{/each}}
<div id="nightwatch-logo"></div>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script>
$(function() {
$('div.stacktrace').on('click', 'a', function(evt) {
evt.preventDefault();
var $link = $(this);
var $code = $link.parent().find('code');
$code.is(':visible') ? $link.text('hide stacktrace'):
$link.text('view stacktrace');
$code.toggle();
});
});
</script>
</body>
</html>