From: Mike Taylor Date: Thu, 9 Oct 2014 15:12:11 +0000 (+0100) Subject: Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/mkws X-Git-Tag: 1.0.0~258 X-Git-Url: http://sru.miketaylor.org.uk/?a=commitdiff_plain;h=c0fa14a68f3d3136d29b58fdd2d8b3f32dd7555a;hp=971b92b8520f10dd47abe7cb80f9fd0cb3af8784;p=mkws-moved-to-github.git Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/mkws --- diff --git a/test/Makefile b/test/Makefile index 65fbc3e..d4597df 100644 --- a/test/Makefile +++ b/test/Makefile @@ -29,6 +29,7 @@ distclean: clean clean-tmp clean-error rm -rf node_modules rm -f ${TMP_DIR}/jasmine-dev rm -f libexec + make -C./widgets $@ clean-error: rm -f mkws-error.png.* mkws-error.html.* @@ -80,6 +81,9 @@ screenshot-indexdata: done; wait ls -l ${IMAGES} +screenshots: + make -C ./widgets $@ + jsbeautifier jsb indent: for i in package.json ./spec*/*.js ./js/*.js ./phantom/*.js; do \ jsbeautifier -j $$i > $@.tmp && mv -f $@.tmp $$i; \ @@ -110,6 +114,7 @@ help: @echo "make [ all | check | clean | distclean ]" @echo " [ phantomjs | phantomjs-all ]" @echo " [ jsbeautifier | perltidy | screenshot ]" + @echo " [ screenshots ]" @echo " [ node-modules ]" @echo " [ apache-stop apache-start ]" @echo "" diff --git a/test/phantom/screenshot.js b/test/phantom/screenshot.js index ac4de3b..40f9937 100644 --- a/test/phantom/screenshot.js +++ b/test/phantom/screenshot.js @@ -3,6 +3,7 @@ var page = require('webpage').create(), var url = system.args[1] || 'http://www.indexdata.com/'; var file_png = system.args[2] || 'indexdata.png'; +var timeout = system.args[5] ? system.args[5] : 0.2; if (system.args.length === 1) { console.log('Usage: screenshot.js '); @@ -25,5 +26,5 @@ page.open(url, function () { setTimeout(function () { var ret = page.render(file_png); phantom.exit(); - }, 200); + }, timeout * 1000); }); diff --git a/test/widgets/Makefile b/test/widgets/Makefile new file mode 100644 index 0000000..dbd9bbf --- /dev/null +++ b/test/widgets/Makefile @@ -0,0 +1,45 @@ +# Copyright (c) 2013-2014 Index Data ApS. http://indexdata.com + +PHANTOMJS_TIMEOUT=18 +PHANTOMJS= ../node_modules/phantomjs/bin/phantomjs +IMAGES= ./images +SCREENSHOT_WIDTH_HEIGHT= 1000 1200 +PERL_SCRIPTS= ../bin/bomb.pl +PROG= ../phantom/screenshot.js +MD5= $(shell which md5 md5sum) +TIMEOUT=5 + +PHANTOMJS_URL= http://cph.koha.indexdata.com/cgi-bin/koha/opac-search.pl?q=sushi +PHANTOMJS_URL= http://www.indexdata.com/ + +all: help + +clean: + rm -f mkws-error.png mkws-error.html + rm -f ${IMAGES}/*.png ${IMAGES}/*.png.tmp + rm -f ${IMAGES}/index.html + +distclean: clean + +test: check + +screenshot: + file=$$(echo "${PHANTOMJS_URL}" | perl -npe 's,(\W),-,g'); \ + ${PHANTOMJS} ${PROG} ${PHANTOMJS_URL} ${IMAGES}/tmp.$$file.png ${SCREENSHOT_WIDTH_HEIGHT} ${TIMEOUT}; \ + mv -f ${IMAGES}/tmp.$$file.png ${IMAGES}/$$file.png + +screenshots: clean + for i in $$(cat url.txt); do \ + make PHANTOMJS_URL="$$i" TIMEOUT=4 screenshot; \ + done; wait + make index + +index: + cd ${IMAGES}; ls -tr *.png | perl -ne 'chomp; print qq{

$$_



\n}' > index.html + +help: + @echo "make [ all | clean | distclean ]" + @echo " [ screenshots ]" + @echo " [ screenshot | index ]" + @echo "" + diff --git a/test/widgets/images/.gitkeep b/test/widgets/images/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/widgets/url.txt b/test/widgets/url.txt new file mode 100644 index 0000000..c5b8207 --- /dev/null +++ b/test/widgets/url.txt @@ -0,0 +1,7 @@ +http://cph.koha.indexdata.com/cgi-bin/koha/opac-search.pl?q=sushi +http://demo.koha.indexdata.com/cgi-bin/koha/opac-search.pl?q=sushi +http://demo.koha.indexdata.com/cgi-bin/koha/opac-search.pl?q=sushi2 +http://boston.koha.indexdata.com/cgi-bin/koha/opac-search.pl?q=sushi +http://example.indexdata.com/topic.html?q=sushi +http://example.indexdata.com/simple.html +