Files
YellowLabTools/app/node_views/launchTest.html
T

50 lines
1.4 KiB
HTML

<html>
<head>
<meta charset="utf-8">
<title>Javascript Spaghetti Profiler</title>
<link rel="stylesheet" type="text/css" href="/public/styles/main.css">
<link rel="stylesheet" type="text/css" href="/public/styles/launchTest.css">
<script src="/socket.io/socket.io.js"></script>
</head>
<body>
<h1>Javascript Spaghetti Profiler</h1>
<div id="status"></div>
<div>%%TEST_URL%%</div>
<script>
var testId = '%%TEST_ID%%';
var statusElement = document.getElementById('status');
var socket = io();
function askStatus() {
socket.emit('waiting', testId);
}
socket.on('position', function(position) {
if (position === 0) {
statusElement.innerHTML = 'Running';
} else {
statusElement.innerHTML = 'Waiting behind ' + (position) + ' other tests';
}
});
socket.on('complete', function() {
statusElement.innerHTML = 'Test complete';
window.location.replace('/results/' + testId);
});
socket.on('failed', function() {
statusElement.innerHTML = 'Test failed';
window.location.replace('/results/' + testId);
});
socket.on('404', function() {
statusElement.innerHTML = 'Test not found';
});
askStatus();
</script>
</body>
</html>