forked from maqetta/maqetta
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add server startup test, using PhantomJS.
Add console port, so server can be remotely killed.
- Loading branch information
1 parent
cf75e5b
commit 1b88a7c
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); |