Permalink
Browse files

Update load_phantom.js to run the new tests on Travis CI

  • Loading branch information...
1 parent b6556d9 commit ccac5f1151aa5e47676ea7d4eca8b2e2c74df516 @juhovh juhovh committed May 14, 2012
Showing with 27 additions and 21 deletions.
  1. +27 −21 tests/lib/load_phantom.js
@@ -1,26 +1,32 @@
var fs = require('fs')
- , page = new WebPage()
- , file = fs.absolute('tests/test.html');
+ , pages = [ new WebPage(), new WebPage() ]
+ , files = [ fs.absolute('tests/test.html'), fs.absolute('tests/test2.html') ]
+ , i, page, file;
-page.onConsoleMessage = function(msg) {
- console.log(msg);
- if (msg === "success")
- phantom.exit(0);
- else
+for (i in pages) {
+ page = pages[i];
+ file = files[i];
+
+ page.onConsoleMessage = function(msg) {
+ console.log(msg);
+ if (msg === "success")
+ phantom.exit(0);
+ else
+ phantom.exit(1);
+ };
+
+ page.onError = function (msg, trace) {
+ console.log(msg);
+ trace.forEach(function(item) {
+ console.log(' ', item.file, ':', item.line);
+ });
phantom.exit(1);
-};
+ };
-page.onError = function (msg, trace) {
- console.log(msg);
- trace.forEach(function(item) {
- console.log(' ', item.file, ':', item.line);
+ page.open('file://' + file, function (status) {
+ if (status !== 'success') {
+ console.log('Failed to load the address');
+ return phantom.exit(1);
+ }
});
- phantom.exit(1);
-};
-
-page.open('file://' + file, function (status) {
- if (status !== 'success') {
- console.log('Failed to load the address');
- return phantom.exit(1);
- }
-});
+}

0 comments on commit ccac5f1

Please sign in to comment.