Skip to content

Commit

Permalink
ENHANCEMENT Allowing JSTestDriver execution in tests/javascript/ by a…
Browse files Browse the repository at this point in the history
…dding bash scripts and new Makefile command ("make jasmine")
  • Loading branch information
chillu committed Mar 22, 2011
1 parent aefc60e commit 7bda1ec
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Makefile
Expand Up @@ -15,3 +15,6 @@ phpunit:

windmill:
functest ../cms/tests/test_windmill url=${URL}dev/tests/startsession browser=firefox

jasmine:
./tests/javascript/server.sh
15 changes: 15 additions & 0 deletions 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
30 changes: 30 additions & 0 deletions 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"
28 changes: 28 additions & 0 deletions 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"

0 comments on commit 7bda1ec

Please sign in to comment.