diff --git a/Makefile b/Makefile index 52f3a8b08..a23b0e65b 100644 --- a/Makefile +++ b/Makefile @@ -15,3 +15,6 @@ phpunit: windmill: functest ../cms/tests/test_windmill url=${URL}dev/tests/startsession browser=firefox + +jasmine: + ./tests/javascript/server.sh \ No newline at end of file diff --git a/tests/javascript/jstestdriver.conf b/tests/javascript/jstestdriver.conf new file mode 100644 index 000000000..119e44093 --- /dev/null +++ b/tests/javascript/jstestdriver.conf @@ -0,0 +1,15 @@ +server: http://localhost:9876 + +load: + - ../../thirdparty/jasmine/lib/jasmine.js + - ../../thirdparty/jasmine/lib/jasmine-html.js + - ../../thirdparty/jasmine-jstd-adapter/src/JasmineAdapter.js + - ../../thirdparty/jasmine-jquery/lib/jasmine-jquery.js + - ../../thirdparty/jasmine-dom/lib/jasmine-dom-fixtures.js + - ../../thirdparty/jasmine-ajax/lib/mock-ajax.js + - ../../thirdparty/jasmine-ajax/lib/spec-helper.js + - ../../thirdparty/jquery/jquery.js + - ../../thirdparty/jquery-entwine/dist/* + - ../../thirdparty/jstree/jquery.jstree.js + - ../../javascript/TreeDropdownField.js + - TreeDropdownField/TreeDropdownField.js diff --git a/tests/javascript/server.sh b/tests/javascript/server.sh new file mode 100755 index 000000000..fe942c633 --- /dev/null +++ b/tests/javascript/server.sh @@ -0,0 +1,30 @@ +#!/bin/bash +while getopts "j:p:" flag +do + if [ $flag == "j" ]; then + JSTD=$OPTARG + elif [ $flag == "p" ]; then + PORT=$OPTARG + fi +done + +TESTPATH=`dirname $0` + +if [ -z "$PORT" ]; then + PORT=9876 +fi + +if [ -z "$JSTD" ]; then + # Download test driver dependency if required (too large to include in core) + JSTD="$TESTPATH/JsTestDriver-1.3.1.jar" + if [ ! -f $JSTD ]; then + wget -O $JSTD http://js-test-driver.googlecode.com/files/JsTestDriver-1.3.1.jar + fi +fi + +echo "####################################################" +echo "Please capture a browser by visiting http://localhost:$PORT" +echo "Run tests by executing ./tests/javascript/test.sh" +echo "####################################################" + +java -jar $JSTD --port $PORT --config "$TESTPATH/jstestdriver.conf" \ No newline at end of file diff --git a/tests/javascript/test.sh b/tests/javascript/test.sh new file mode 100755 index 000000000..6f789a624 --- /dev/null +++ b/tests/javascript/test.sh @@ -0,0 +1,28 @@ +#!/bin/bash +while getopts "j:t:" flag +do + if [ $flag == "j" ]; then + JSTD=$OPTARG + elif [ $flag == "t" ]; then + TESTS=$OPTARG + fi +done + +TESTPATH=`dirname $0` + +if [ -z "$JSTD" ]; then + # Download test driver dependency if required (too large to include in core) + JSTD="$TESTPATH/JsTestDriver-1.3.1.jar" + if [ ! -f $JSTD ]; then + wget -O $JSTD http://js-test-driver.googlecode.com/files/JsTestDriver-1.3.1.jar + fi +fi + +if [ -z "$TESTS" ]; then + TESTS="all" + echo "Running all tests" +else + echo "Running '$TESTS'" +fi + +java -jar $JSTD --reset --config "$TESTPATH/jstestdriver.conf" --tests "$TESTS"