Skip to content

Commit

Permalink
Add server startup test, using PhantomJS.
Browse files Browse the repository at this point in the history
Add console port, so server can be remotely killed.
  • Loading branch information
jhpedemonte committed Aug 5, 2011
1 parent cf75e5b commit 1b88a7c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
3 changes: 2 additions & 1 deletion releng/davinci.product/maqetta.local.mac.command
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ echo STOP THE MAQETTA SERVER PROCESS
echo !!!!!!!!!!!!!
echo
port=50000
consolePort=50005
scriptdir=`dirname "$0"`
# usersdir="$HOME/Library/Application Support/maqetta/users"
usersdir="$scriptdir"/users
Expand All @@ -41,4 +42,4 @@ echo Using directory: "$absusersdir"

echo Start your browser at: http://localhost:$port/maqetta
mkdir -p "$absusersdir"
java -Dorg.eclipse.equinox.http.jetty.http.port=$port -Dorg.eclipse.equinox.http.jetty.context.path=/maqetta -Dmaqetta.localInstall=true "-Dmaqetta.baseDirectory=$absusersdir" -DloginUrl="/maqetta/welcome" -jar "$jarFilePath" -console -noExit
java -Dorg.eclipse.equinox.http.jetty.http.port=$port -Dorg.eclipse.equinox.http.jetty.context.path=/maqetta -Dmaqetta.localInstall=true "-Dmaqetta.baseDirectory=$absusersdir" -DloginUrl="/maqetta/welcome" -jar "$jarFilePath" -console 50005 -noExit
34 changes: 34 additions & 0 deletions tests/phantomjs/server_startup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Test that a user can load Maqetta in browser without errors.
*
* This script tests the following:
* 1) That page at server URL loads successfully, and
* 2) that there are no JS errors in the console on initial load.
*/

var SERVER_URL = 'http://localhost:50000/maqetta',

page = new WebPage(),
reErrorMsg = /^[a-zA-Z]*Error:/;


page.onConsoleMessage = function(msg, lineNum, sourceId) {
// Exit if there is an error message
if (reErrorMsg.test(msg)) {
console.error(msg);
phantom.exit(1);
}
console.log(msg);
};

page.open(SERVER_URL, function (status) {
if (status !== 'success') {
console.error('FAILED to load "' + SERVER_URL + '"');
phantom.exit(1);
}
// wait a few seconds to make sure there are no surprises,
// then exit without error
setTimeout(function() {
phantom.exit();
}, 5000);
});

0 comments on commit 1b88a7c

Please sign in to comment.