new target phantomjs
authorWolfram Schneider <wosch@indexdata.dk>
Thu, 30 Jan 2014 22:36:10 +0000 (22:36 +0000)
committerWolfram Schneider <wosch@indexdata.dk>
Thu, 30 Jan 2014 22:36:10 +0000 (22:36 +0000)
test/Makefile
test/phantom/evaluate.js [new file with mode: 0644]
test/spec-dev/evaluate.js [deleted file]

index 09f3555..b9ea996 100644 (file)
@@ -3,6 +3,7 @@
 # For running on Mike's local install of node.js
 MIKE = PATH=$$PATH:/usr/local/lib/node-v0.10.24-linux-x64/bin
 NPM_INSTALL_FLAGS=-q
+PHANTOMJS=     ./node_modules/phantomjs/bin/phantomjs
 
 all: check
 
@@ -23,6 +24,10 @@ test: check
 terse:
        $(MIKE) jasmine-node --noColor --captureExceptions --forceexit spec
 
+phantomjs:
+       @# ${PHANTOMJS} phantom/evaluate.js https://mkws-dev.indexdata.com/jasmine-local-popup.html     
+       ${PHANTOMJS} phantom/evaluate.js https://mkws-dev.indexdata.com/jasmine-popup.html      
+
 jsbeautifier jsb indent:
        for i in ./spec*/*.js ./js/*.js; do \
          jsbeautifier -j $$i > $@.tmp && mv -f $@.tmp $$i; \
@@ -33,5 +38,5 @@ node_modules:
        npm install ${NPM_INSTALL_FLAGS} jQuery xmlhttprequest jsdom request jasmine-node phantomjs
 
 help:
-       @echo "make [ all | check | clean | distclean ]"
+       @echo "make [ all | check | phantomjs | clean | distclean ]"
        @echo "     [ jsbeautifier | node-modules ]"
diff --git a/test/phantom/evaluate.js b/test/phantom/evaluate.js
new file mode 100644 (file)
index 0000000..be26202
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+    Fetch a mkws/jasmine based page into node.js, evaluate the page and check if test status
+    This should make it possible to run the test on the command line in jenkins.  e.g.:
+    
+      phantomjs evaluate.js https://mkws-dev.indexdata.com/jasmine-local-popup.html
+*/
+
+var page = require('webpage').create(),
+    system = require('system');
+
+if (system.args.length === 1) {
+    console.log('Usage: screenshot.js <some URL>');
+    phantom.exit();
+}
+var url = system.args[1];
+
+page.viewportSize = {
+    width: 1200,
+    height: 1000
+};
+
+var run_time = 12; // poll up to seconds
+page.open(url, function (status) {
+    console.log("fetch " + url + " with status: " + status);
+    console.log("polling MKWS test status...");
+
+    var r;
+    for (var i = 1; i <= run_time; i++) {
+        setTimeout(function () {
+            var result = page.evaluate(function (s) {
+                // return document.querySelector(s).innerText;
+                return {
+                    mkws: window.mkws,
+                    string: "foo"
+                };
+            }, 'title');
+
+            console.log(".");
+            if (result.mkws.jasmine_done) {
+                console.log("MKWS tests are successfully done. Hooray!");
+                phantom.exit(0);
+            }
+            r = result;
+        }, i * 1000);
+    }
+
+
+    setTimeout(function () {
+        var error_png = "./mkws-error.png";
+        console.log("MKWS tests failed after " + run_time + " seconds");
+        console.log("keep screenshot in '" + error_png + "'");
+
+        page.render(error_png);
+        phantom.exit(1);
+    }, (run_time + 1) * 1000);
+});
diff --git a/test/spec-dev/evaluate.js b/test/spec-dev/evaluate.js
deleted file mode 100644 (file)
index be26202..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-    Fetch a mkws/jasmine based page into node.js, evaluate the page and check if test status
-    This should make it possible to run the test on the command line in jenkins.  e.g.:
-    
-      phantomjs evaluate.js https://mkws-dev.indexdata.com/jasmine-local-popup.html
-*/
-
-var page = require('webpage').create(),
-    system = require('system');
-
-if (system.args.length === 1) {
-    console.log('Usage: screenshot.js <some URL>');
-    phantom.exit();
-}
-var url = system.args[1];
-
-page.viewportSize = {
-    width: 1200,
-    height: 1000
-};
-
-var run_time = 12; // poll up to seconds
-page.open(url, function (status) {
-    console.log("fetch " + url + " with status: " + status);
-    console.log("polling MKWS test status...");
-
-    var r;
-    for (var i = 1; i <= run_time; i++) {
-        setTimeout(function () {
-            var result = page.evaluate(function (s) {
-                // return document.querySelector(s).innerText;
-                return {
-                    mkws: window.mkws,
-                    string: "foo"
-                };
-            }, 'title');
-
-            console.log(".");
-            if (result.mkws.jasmine_done) {
-                console.log("MKWS tests are successfully done. Hooray!");
-                phantom.exit(0);
-            }
-            r = result;
-        }, i * 1000);
-    }
-
-
-    setTimeout(function () {
-        var error_png = "./mkws-error.png";
-        console.log("MKWS tests failed after " + run_time + " seconds");
-        console.log("keep screenshot in '" + error_png + "'");
-
-        page.render(error_png);
-        phantom.exit(1);
-    }, (run_time + 1) * 1000);
-});