Testing socket.io onMessage.
phantomjs ./socket_message_test.js
should return the message emitted on exit.
Testing socket.io onMessage.
phantomjs ./socket_message_test.js
should return the message emitted on exit.
(function(){ | |
'use strict'; | |
page = require('webpage').create(); | |
page.onCallback = function (msg){ | |
console.log(msg); | |
phantom.exit(); | |
}; | |
page.open('./fixture.html', function () { | |
page.includeJS('http://localhost:8080/socket.io/socket.io.js',function(){ | |
socket = io.connect('http://localhost:8080'); | |
socket.on('message', function (data) { | |
phantom.callPhantom(JSON.stringify(data)); | |
}); | |
}); | |
}); | |
}).call(this); |