forked from google/end-to-end
-
Notifications
You must be signed in to change notification settings - Fork 1
/
all_tests.html
141 lines (128 loc) · 3.56 KB
/
all_tests.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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>End-to-End - All JsUnit Tests</title>
<script src="javascript/closure/base.js"></script>
<script src="test_js_deps-runfiles.js"></script>
<script src="build/all_tests.js"></script>
<script>
goog.require('goog.testing.MultiTestRunner');
</script>
<link rel="stylesheet" href="javascript/closure/css/multitestrunner.css" type="text/css">
<style>
h1 {
font: normal x-large arial, helvetica, sans-serif;
margin: 0;
}
p, form {
font: normal small sans-serif;
}
#form {
margin-top: 8px;
}
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
.warning {
font-family: sans-serif;
font-size: 14px;
font-weight: bold;
padding-right: 8em;
padding-left: 8em;
padding-top: 1em;
padding-bottom: 1em;
background: #eef;
border: 1px solid #ccc
}
</style>
</head>
<body>
<h1>End-to-End - All JsUnit Tests</h1>
<div id="runner"></div>
<!-- Use a form so browser persists input values -->
<form id="form">
Settings:<br>
<input type="checkbox" name="showpasses" id="showpasses">
<label for="showpasses">Show passes</label><br>
<label for="filter">Only run tests that match:</label><br>
<input type="text" name="filter" id="filter" value="">
<small>(use regexp, e.g. "structs.*")</small>
</form>
<p>Tests:</p>
<pre id="all_tests"></pre>
<script>
var params = {};
var q = location.search.replace(/^\?/, '').split('&').map(function(item) {
var param = item.split('=').map(decodeURIComponent);
params[param[0]] = param[1];
});
if (params.showpasses) {
document.getElementById('showpasses').checked = true;
}
if (params.filter) {
document.getElementById('filter').value = params.filter;
}
if (typeof _allTests == 'undefined') {
document.write(
'<p>No test files detected. Ensure you have generated the ' +
'test dependencies</p>');
} else {
for (var i = 0; i < _allTests.length; i++) {
document.getElementById('all_tests').innerText += _allTests[i] + '\n';
}
var showPassesInput = document.getElementById('showpasses');
var filterInput = document.getElementById('filter');
function setFilterFunction() {
var matchValue = filterInput.value || '.*';
var re;
try {
re = new RegExp(matchValue);
} catch (e) {
alert(e.message);
setTimeout(function() {
filterInput.select();
}, 0);
return;
}
testRunner.setFilterFunction(function(testPath) {
return re.test(testPath);
});
}
goog.testing.MultiTestRunner.prototype.setOnTestLoadCallback = function(fn) {
this.onTestLoadCallback = fn;
};
goog.testing.MultiTestRunner.prototype.getOnTestLoadCallback = function(fn) {
return this.onTestLoadCallback;
};
// setting a hook for polyfill
goog.testing.MultiTestRunner.TestFrame.prototype.onIframeLoaded_ = function(e) {
this.iframeLoaded_ = true;
if (this.getParent().onTestLoadCallback) {
this.getParent().onTestLoadCallback.apply(e.target);
}
};
// Create a test runner and render it.
var testRunner = new goog.testing.MultiTestRunner()
.setName(document.title)
.setBasePath('')
.setPoolSize(1)
.setStatsBucketSizes(5, 500)
.setHidePasses(!showPassesInput.checked)
.addTests(_allTests);
testRunner.render(document.getElementById('runner'));
goog.events.listen(showPassesInput, 'click', function(e) {
testRunner.setHidePasses(!e.target.checked);
});
goog.events.listen(filterInput, 'blur', setFilterFunction);
setFilterFunction();
if (params.autostart) {
testRunner.start();
}
}
</script>
</body>
</html>