+
+for (var i = 0; i < tasks.length; i++) {
+ var url = 'file://' + fs.absolute('tests/' + tasks[i]);
+ pages.push(function(path, url) {
+ var page = require('webpage').create();
+ page.success = false;
+ page.hasErrors = false;
+ page.onError = function (msg, trace) {
+ console.log(path + ': ' + msg);
+ page.hasErrors = true;
+ trace.forEach(function(item) {
+ console.log(' ', item.file, ':', item.line);
+ });
+ };
+ page.onLoadFinished = function(status) {
+ if (status == 'success') {
+ page.success = true;
+ }
+ if (!page.done) loaded_page();
+ page.done = true;
+ };
+ page.open(url);
+ return page;
+ }(tasks[i], url));
+}
+
+};
+
+
+// First run all auto_tests.
+// If they all pass, load the manual tests.
+RunAllAutoTests(function(num_failing, num_passing) {
+ if (num_failing !== 0) {