Corrected (a little bit) sponza, add load.js to generate load in db
This commit is contained in:
parent
4060b427f0
commit
29029ce33a
|
@ -4,9 +4,10 @@ block title
|
||||||
title #{title} - Prototype - Arrows
|
title #{title} - Prototype - Arrows
|
||||||
|
|
||||||
block mainjs
|
block mainjs
|
||||||
script L3D.BD.disable();
|
script locked = false;
|
||||||
script initMainScene = L3D.initSponza
|
|
||||||
script(src="/static/js/prototypeinteractive.min.js")
|
script(src="/static/js/prototypeinteractive.min.js")
|
||||||
|
script initMainScene = L3D.initSponza
|
||||||
|
script L3D.BD.disable();
|
||||||
|
|
||||||
block configjs
|
block configjs
|
||||||
script Recommendation = L3D.ArrowRecommendation;
|
script Recommendation = L3D.ArrowRecommendation;
|
||||||
|
|
|
@ -54,7 +54,7 @@ function main() {
|
||||||
// Set the good size of cameras
|
// Set the good size of cameras
|
||||||
onWindowResize();
|
onWindowResize();
|
||||||
|
|
||||||
if (locked)
|
if (locked !== undefined && locked)
|
||||||
startCanvas.render();
|
startCanvas.render();
|
||||||
|
|
||||||
// Some config
|
// Some config
|
||||||
|
|
|
@ -29,11 +29,12 @@ Log.ready = function(msg) {
|
||||||
log('[RDY] ' + new Date() + ' ' + msg, Colors.GREEN);
|
log('[RDY] ' + new Date() + ' ' + msg, Colors.GREEN);
|
||||||
};
|
};
|
||||||
|
|
||||||
Log.request = function(req, res) {
|
Log.request = function(req, res, time) {
|
||||||
if (req.headers['x-forwarded-for'] !== undefined || isDev) {
|
if (req.headers['x-forwarded-for'] !== undefined || isDev) {
|
||||||
log(
|
log(
|
||||||
'[REQ] ' + new Date() + ' ' +
|
'[REQ] ' + new Date() + ' ' +
|
||||||
(req.headers['x-forwarded-for'] || req.connection.remoteAddress) +
|
(req.headers['x-forwarded-for'] || req.connection.remoteAddress) +
|
||||||
|
(time !== undefined ? (' in ' + (" " + time).slice(-6) + ' ms') : '') +
|
||||||
' : ' + req.url ,
|
' : ' + req.url ,
|
||||||
Colors.CYAN
|
Colors.CYAN
|
||||||
);
|
);
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
function makeId()
|
||||||
|
{
|
||||||
|
var text = "";
|
||||||
|
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||||
|
|
||||||
|
for( var i=0; i < 5; i++ )
|
||||||
|
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
||||||
|
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
var fs = require('fs');
|
||||||
|
|
||||||
|
var casper = require('casper').create({
|
||||||
|
stepTimeout: 100000,
|
||||||
|
waitTimeout: 100000
|
||||||
|
});
|
||||||
|
|
||||||
|
var limit = 100;
|
||||||
|
|
||||||
|
casper.start('http://localhost:4000/');
|
||||||
|
|
||||||
|
for (var i = 0; i < limit; i++) {
|
||||||
|
|
||||||
|
(function(i) {
|
||||||
|
|
||||||
|
casper.thenOpen('http://localhost:4000/user-study', function() {
|
||||||
|
|
||||||
|
console.log(i);
|
||||||
|
|
||||||
|
this.getHTML();
|
||||||
|
|
||||||
|
// this.waitForSelector('form#form', function() {
|
||||||
|
|
||||||
|
this.fillSelectors(
|
||||||
|
'form#form', {
|
||||||
|
'#inputId': makeId(),
|
||||||
|
'#sel1': '-15',
|
||||||
|
'#sel2': '3'
|
||||||
|
}, true
|
||||||
|
);
|
||||||
|
|
||||||
|
// }, true);
|
||||||
|
|
||||||
|
this.thenOpen('http://localhost:4000/prototype/game');
|
||||||
|
this.thenOpen('http://localhost:4000/prototype/game');
|
||||||
|
this.thenOpen('http://localhost:4000/prototype/game');
|
||||||
|
this.thenOpen('http://localhost:4000/prototype/game');
|
||||||
|
|
||||||
|
this.thenOpen('http://localhost:4000/logout');
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
})(i);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
casper.run();
|
|
@ -37,8 +37,13 @@ app.use(bodyParser.json());
|
||||||
|
|
||||||
app.use(function(req, res, next) {
|
app.use(function(req, res, next) {
|
||||||
|
|
||||||
|
var start = Date.now();
|
||||||
|
|
||||||
|
res.on('finish', function() {
|
||||||
// Log connection
|
// Log connection
|
||||||
Log.request(req, res);
|
Log.request(req, res, Date.now() - start);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
res.locals.title = "3DUI";
|
res.locals.title = "3DUI";
|
||||||
res.locals.urls = urls;
|
res.locals.urls = urls;
|
||||||
|
|
Loading…
Reference in New Issue