This repository has been archived by the owner on Mar 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
report.html
228 lines (198 loc) · 8.52 KB
/
report.html
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<!DOCTYPE html>
<html lang="en" ng-app="jasmineResults">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Title</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/angular-material/1.1.3/angular-material.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
.status {
width: 85px;
padding: 7px;
border-radius: 3px;
text-align: center;
}
.failed .status {
background-color: rgb(255, 87, 34);
}
.passed .status {
background-color: rgb(76, 175, 80);
}
.pending .status {
background-color: rgb(255, 255, 0);
}
/* stack traces */
pre {
margin:0;
}
.stack.highlight {
background-color: yellow;
}
/* console logs */
.console-logs {
font-size: 12px;
}
.console-logs.SEVERE {
color: rgb(255, 87, 34);
}
</style>
</head>
<body ng-controller="ResultsCtrl">
<div ng-cloak layout="column">
<md-toolbar ng-class="{'md-warn': results.counts.failed}">
<div class="md-toolbar-tools">
<h2 flex md-truncate>Results <small ng-if="results.timer.duration"> - executed in {{ results.timer.duration / 1000 }} seconds</small></h2>
<h6>
<span ng-if="results.counts.passed">Passed: {{ results.counts.passed }}</span>
<br ng-if="results.counts.passed"/>
<span ng-if="results.counts.pending">Pending: {{ results.counts.pending }}</span>
<br ng-if="results.counts.pending"/>
<span ng-if="results.counts.failed">Failed: {{ results.counts.failed }}</span>
<br ng-if="results.counts.failed"/>
<span ng-if="results.counts.disabled">Disabled: {{ results.counts.disabled }}</span>
</h6>
</div>
</md-toolbar>
<md-content flex>
<md-list>
<md-list-item ng-class="result.status" ng-repeat="result in results.sequence" ng-click="showDetail(result)">
<div layout="row" flex layout-padding>
<div flex="none">
<div class="status">{{ result.status }}</div>
</div>
<div ng-if="results.options.showBrowser" flex="none">
<i ng-class="getBrowserClass(result)" class="fa"></i>
</div>
<div flex>
<span>{{ result.prefix }}</span><strong>{{ result.description }}</strong>
<div ng-if="result.pendingReason != ''">
<small>{{ result.pendingReason }}</small>
</div>
<div ng-repeat="failure in result.failedExpectations">
<small>{{ failure.message }}</small>
</div>
<!--<div ng-if="result.suspectLine">-->
<!--<small>{{result.suspectLine}}</small>-->
<!--</div>-->
</div>
<div flex="none" style="width: 80px; text-align:right;">
<small>{{ result.duration }}</small>
</div>
<div flex="none" style="width: 150px">
<img width="100%" ng-if="result.screenshotPath" ng-src="{{result.screenshotPath}}"/>
</div>
</div>
<md-divider inset></md-divider>
</md-list-item>
</md-list>
</md-content>
</div>
<!-- Dialog template -->
<script type="text/ng-template" id="dialog.html">
<md-dialog aria-label="" flex="90">
<md-toolbar ng-class="getCss(activeItem)">
<div layout="row" layout-padding class="md-toolbar-tools">
<div flex="none">
<h1>Test Information:</h1>
</div>
<div flex>
<small>
<span>{{ activeItem.prefix }}</span>
<strong>{{ activeItem.description }}</strong>
</small>
</div>
</div>
</md-toolbar>
<md-dialog-content>
<md-content>
<img width="100%" ng-if="activeItem.screenshotPath" ng-src="{{activeItem.screenshotPath}}">
<!-- failed -->
<md-subheader ng-if="activeItem.failedExpectations.length > 0">Stack Traces</md-subheader>
<div flex layout="column" layout-padding ng-repeat="failure in activeItem.failedExpectations">
<div flex>
<p>{{failure.message}}</p>
<small>
<pre class="stack" ng-class="{'highlight': (results.options.highlightSuspectLine && line === failure.suspectLine) }" ng-repeat="line in failure.stack.split('\n')">{{line}}</pre>
</small>
</div>
</div>
<!-- passed -->
<md-subheader ng-if="activeItem.passedExpectations.length > 0">Passed Expectations</md-subheader>
<div layout-padding ng-if="activeItem.passedExpectations.length > 0">
<pre ng-repeat="pass in activeItem.passedExpectations">{{ pass | json }}</pre>
</div>
<!-- console logs -->
<md-subheader>Console Logs</md-subheader>
<div class="console-logs" ng-class="log.level" flex layout="row" layout-padding ng-repeat="log in activeItem.browserLogs">
<div style="width: 75px;">
<strong>{{ log.level }}</strong>
</div>
<div style="width: 150px">
{{ log.timestamp | date:'yyyy-MM-dd HH:mm:ss.sss' }}
</div>
<div flex>
{{ log.message }}
</div>
</div>
<div layout-padding ng-if="activeItem.browserLogs.length === 0">
<em>No logs</em>
</div>
</md-content>
</md-dialog-content>
</md-dialog>
</script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-animate.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-aria.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-messages.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-material/1.1.3/angular-material.js"></script>
<script>
var RESULTS = [];
</script>
<!-- inject::scripts -->
<script>
angular.module('jasmineResults', ['ngMaterial']).config(function ($mdThemingProvider) {
$mdThemingProvider.theme('default').primaryPalette('green').accentPalette('yellow');
}).controller('ResultsCtrl', function ($scope, $mdDialog, RESULTS) {
var classes = {
'passed': 'md-primary',
'pending': 'md-accent',
'failed': 'md-warn'
};
$scope.results = RESULTS.reduce(function(combined, result) {
combined.options = combined.options || result.options;
combined.timer = combined.timer || result.timer;
combined.sequence = combined.sequence.concat(result.sequence);
// sum the counts
Object.keys(result.counts).forEach(function(key) {
combined.counts[key] = (combined.counts[key] || 0) + result.counts[key];
});
return combined;
}, {
options: null,
timer: null,
counts: {},
sequence: []
});
$scope.showDetail = function (item) {
$scope.activeItem = item;
$mdDialog.show({
controller: function () {
},
scope: $scope.$new(false, $scope),
templateUrl: 'dialog.html',
parent: angular.element(document.body),
clickOutsideToClose: true
})
};
$scope.getBrowserClass = function (item) {
return 'fa-' + item.browserName.replace(' ', '-');
};
$scope.getCss = function (item) {
return classes[item.status];
};
}).constant('RESULTS', RESULTS);
</script>
</body>
</html>