Corrected (a little bit) sponza, add load.js to generate load in db

This commit is contained in:
Thomas FORGIONE 2015-09-14 10:39:15 +02:00
parent 4060b427f0
commit 29029ce33a
5 changed files with 72 additions and 7 deletions

View File

@ -4,9 +4,10 @@ block title
title #{title} - Prototype - Arrows
block mainjs
script L3D.BD.disable();
script initMainScene = L3D.initSponza
script locked = false;
script(src="/static/js/prototypeinteractive.min.js")
script initMainScene = L3D.initSponza
script L3D.BD.disable();
block configjs
script Recommendation = L3D.ArrowRecommendation;

View File

@ -54,7 +54,7 @@ function main() {
// Set the good size of cameras
onWindowResize();
if (locked)
if (locked !== undefined && locked)
startCanvas.render();
// Some config

View File

@ -29,12 +29,13 @@ Log.ready = function(msg) {
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) {
log(
'[REQ] ' + new Date() + ' ' +
(req.headers['x-forwarded-for'] || req.connection.remoteAddress) +
' : ' + req.url,
(time !== undefined ? (' in ' + (" " + time).slice(-6) + ' ms') : '') +
' : ' + req.url ,
Colors.CYAN
);
}

58
load.js Normal file
View File

@ -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();

View File

@ -37,8 +37,13 @@ app.use(bodyParser.json());
app.use(function(req, res, next) {
// Log connection
Log.request(req, res);
var start = Date.now();
res.on('finish', function() {
// Log connection
Log.request(req, res, Date.now() - start);
});
res.locals.title = "3DUI";
res.locals.urls = urls;