forked from splunk/splunk-sdk-javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.browser.html
More file actions
204 lines (189 loc) · 7.47 KB
/
Copy pathtests.browser.html
File metadata and controls
204 lines (189 loc) · 7.47 KB
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
<!DOCTYPE html>
<html>
<head>
<title>Splunk SDK Browser Tests</title>
<script>
// What is this?
i18n_register = function(){}
</script>
<link rel="stylesheet" type="text/css" href="../contrib/nodeunit/nodeunit.css">
<script type="text/javascript" src="../contrib/nodeunit/nodeunit.browser.js"></script>
<script type="text/javascript" src="../client/splunk.js"></script>
<script type="text/javascript" src="../client/splunk.test.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js"></script>
<style>
#server-info-form {
width: 100%;
margin: 0px auto;
padding-left: 15px;
}
#server-info-form div.server-info-field {
border: 0;
margin: 0;
padding: 0em;
float: left;
padding-bottom: 10px;
padding-right: 10px;
background-color: #06b;
}
#server-info-form div.server-info-field h3 {
text-transform:uppercase;
font-size: 0.7em;
width: 100%;
color: white;
font-family: 'trebuchet ms', verdana, arial;
display: inline;
}
#server-info-form div.server-info-field input {
font-size: 0.8em;
height: 1.4em;
width: 95%;
margin: 0px auto;
margin-top: 5px;
display: inline;
}
.clearfix {
clear: both;
}
.header {
background-color: #06b;
}
#run-button {
display: block;
margin-top: 1px;
}
/* Following Two Styles "borrowed" from Twitter Bootstrap*/
.btn {
cursor: pointer;
display: inline-block;
background-color: #e6e6e6;
background-repeat: no-repeat;
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), color-stop(25%, #ffffff), to(#e6e6e6));
background-image: -webkit-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);
background-image: -moz-linear-gradient(top, #ffffff, #ffffff 25%, #e6e6e6);
background-image: -ms-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);
background-image: -o-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);
background-image: linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#e6e6e6', GradientType=0);
padding: 5px 14px 6px;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
color: #333;
font-size: 13px;
line-height: normal;
border: 1px solid #ccc;
border-bottom-color: #bbb;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
-moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
-webkit-transition: 0.1s linear all;
-moz-transition: 0.1s linear all;
-ms-transition: 0.1s linear all;
-o-transition: 0.1s linear all;
transition: 0.1s linear all;
color: white;
text-decoration: none;
}
.btn.success, .alert-message.success {
background-color: #57a957;
background-repeat: repeat-x;
background-image: -khtml-gradient(linear, left top, left bottom, from(#62c462), to(#57a957));
background-image: -moz-linear-gradient(top, #62c462, #57a957);
background-image: -ms-linear-gradient(top, #62c462, #57a957);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #62c462), color-stop(100%, #57a957));
background-image: -webkit-linear-gradient(top, #62c462, #57a957);
background-image: -o-linear-gradient(top, #62c462, #57a957);
background-image: linear-gradient(top, #62c462, #57a957);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462', endColorstr='#57a957', GradientType=0);
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
border-color: #57a957 #57a957 #3d773d;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
}
</style>
<script>
$(function() {
$("#run-button").click(function(e) {
e.preventDefault();
var scheme = $("#server-scheme").val() || "https";
var host = $("#server-host").val() || "localhost";
var port = $("#server-port").val() || "8089";
var username = $("#server-username").val() || "admin";
var password = $("#server-password").val() || "changeme";
var version = $("#server-version").val() || "5.0";
var options = {
scheme: scheme,
host: host,
port: port,
username: username,
password: password,
version: version
};
var http = new splunkjs.ProxyHttp("/proxy");
var loggedOutSvc = new splunkjs.Service(http, {
scheme: options.scheme,
host: options.host,
port: options.port,
username: options.username,
password: options.password + 'wrong',
version: options.version
});
var svc = new splunkjs.Service(http, options);
svc.login(function(err, success) {
if (err || !success) {
if (err) throw err;
alert("Cannot run tests - login failed");
}
nodeunit.run([{
// Note that we cannot run the following tests in the browser,
// as they depend on capabilities of node.js:
// - HTTP tests (require cross-domain)
// - Examples Tests (require command line and process capabilities)
"Utils Tests": SplunkTest.Utils.setup(svc),
"Async Tests": SplunkTest.Async.setup(svc),
"Context Tests": SplunkTest.Context.setup(svc),
"Service Tests": SplunkTest.Service.setup(svc, loggedOutSvc)
}]);
});
});
});
</script>
</head>
<body>
<div class="header">
<h1 id="nodeunit-header">Splunk SDK Browser Test Suite</h1>
<div id="server-info-form">
<div class="server-info-field">
<h3>Scheme</h3>
<input id="server-scheme" value="https"/>
</div>
<div class="server-info-field">
<h3>Host</h3>
<input id="server-host" value="localhost"/>
</div>
<div class="server-info-field">
<h3>Port</h3>
<input id="server-port" value="8089"/>
</div>
<div class="server-info-field">
<h3>Username</h3>
<input id="server-username" value="admin"/>
</div>
<div class="server-info-field">
<h3>Password</h3>
<input type="password" id="server-password" value="changeme"/>
</div>
<div class="server-info-field">
<h3>Version</h3>
<input type="text" id="server-version" value="5.0"/>
</div>
<div class="server-info-field">
<h3> </h3>
<a class="btn success" id="run-button" href="">Run</a>
</div>
</div>
<div class="clearfix"></div>
</div>
</body>
</html>