ls -l ${IMAGES}
jsbeautifier jsb indent:
- for i in ./spec*/*.js ./js/*.js ./phantom/*.js; do \
+ for i in package.json ./spec*/*.js ./js/*.js ./phantom/*.js; do \
jsbeautifier -j $$i > $@.tmp && mv -f $@.tmp $$i; \
done
-node-modules: node_modules
-node_modules:
- npm install ${NPM_INSTALL_FLAGS} jQuery xmlhttprequest jsdom request jasmine-node phantomjs
+node_modules node-modules:
+ npm install ${NPM_INSTALL_FLAGS}
help:
@echo "make [ all | check | clean | distclean ]"
@echo " [ phantomjs | screenshot ]"
@echo " [ jsbeautifier | node-modules ]"
+ @echo ""
+ @echo "DEBUG=1 make phantomjs PHANTOMJS_TIMEOUT=8 PHANTOM_URL=https://mkws-dev.indexdata.com/jasmine-popup.html"
+
To install (some) prerequisites, run:
$ sudo apt-get install npm
-$ sudo npm install jasmine-node -g
+$ sudo npm install -g
To run the tests, run:
39 tests, 194 assertions, 0 failures, 0 skipped
+$ make phantomjs
+[ headless jasmine test with console.log() messages
+
+$ DEBUG=1 make phantomjs PHANTOM_URL=https://mkws-dev.indexdata.com/jasmine-popup.html
+[ less debug noise ]
+
To get a basic help, run:
$ make help
--------------------------------------
./spec contains *spec.js files
./js jasmine runtime JS lib
-
-README.txt this file
+./phantom scripts for phantomjs tests
Documentation
---------------------------------------
http://pivotal.github.io/jasmine/
https://github.com/pivotal/jasmine
+http://phantomjs.org/
Installation
$ make node-modules
--
-Copyright (c) 2013 IndexData ApS. http://indexdata.com
-Dec 2013, Wolfram
+Copyright (c) 2013-2014 IndexData ApS. http://indexdata.com
+Feb 2014, Wolfram
--- /dev/null
+{
+ "name": "MKWS",
+ "version": "0.9.1",
+ "license": "IndexData ApS, Copyright (c) 2013-2014",
+ "contributors": [{
+ "name": "Mike Taylor",
+ "email": "mike@indexdata.com"
+ }, {
+ "name": "Wolfram Schneider",
+ "email": "wosch@indexdata.com"
+ }],
+ "devDependencies": {
+ "jQuery": "*",
+ "xmlhttprequest": "*",
+ "jsdom": "*",
+ "request": "*",
+ "jasmine-node": "*",
+ "phantomjs": "*"
+ },
+ "dummy": "EOF"
+}
console.log("Alert: " + msg);
};
+// display HTTP errors
+page.onResourceError = function (resourceError) {
+ // console.log('phantomjs error code: ' + resourceError.errorCode);
+ console.log(resourceError.errorString);
+ phantom.exit(3);
+};
page.open(url, function (status) {
if (debug >= 1) console.log("fetch " + url + " with status: " + status);
if (status != 'success') {
- console.log("Failed to fetch page, give up");
+ console.log("Failed to fetch page, give up. Network error?");
phantom.exit(1);
}
if (!window || !window.$ || !window.mkws) {
return false;
} else {
+ var passing = window.$(".passingAlert").text() || window.$(".failingAlert").text();
+
return {
mkws: window.mkws,
html: window.$("html").html(),
duration: window.$(".duration").text(),
- passing: window.$(".passingAlert").text()
+ passing: passing
};
}
})
phantom.exit();
}, 200);
});
-