From 13f8e55dce70227534a99b0f2601f78d3694e915 Mon Sep 17 00:00:00 2001 From: Denis Date: Tue, 18 Feb 2014 20:43:22 +0200 Subject: [PATCH 1/2] fix(tests): set a proper environment for tests --- test/run_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/run_tests.sh b/test/run_tests.sh index d024d35d71..1e47bd79b0 100755 --- a/test/run_tests.sh +++ b/test/run_tests.sh @@ -29,4 +29,4 @@ until nc -z localhost 4444; do let 'WAITED+=1' done -mocha && grunt karma:continuous && ./node_modules/protractor/bin/protractor protractor.conf.js +NODE_ENV=testing mocha && grunt karma:continuous && ./node_modules/protractor/bin/protractor protractor.conf.js From 7d17752fa8dcc10bc52fc45912367017b485c335 Mon Sep 17 00:00:00 2001 From: Denis Date: Tue, 18 Feb 2014 20:14:34 +0200 Subject: [PATCH 2/2] fix(travis): disable selenium tests on Travis --- test/run_tests.sh | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/test/run_tests.sh b/test/run_tests.sh index 1e47bd79b0..1e8f2a3e25 100755 --- a/test/run_tests.sh +++ b/test/run_tests.sh @@ -10,23 +10,32 @@ grunt build:dev # Launch Node server and Selenium echo "Recreating test database" mongo "$TEST_DB" --eval "db.dropDatabase()" -./node_modules/protractor/bin/webdriver-manager update -./node_modules/protractor/bin/webdriver-manager start > /dev/null & + +if [ -z "$TRAVIS" ]; then + ./node_modules/protractor/bin/webdriver-manager update + ./node_modules/protractor/bin/webdriver-manager start > /dev/null & + trap "curl http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer" EXIT + + # Wait for selenium + MAX_WAIT=30 + WAITED=0 + until nc -z localhost 4444; do + if [ $WAITED -ge $MAX_WAIT ]; then + echo "Waited $MAX_WAIT seconds, but Selenium never responded" >&2 + kill $NODE_PID + exit 1 + fi + sleep 1 + let 'WAITED+=1' + done +fi + NODE_DB_URI="$TEST_DB_URI" PORT=$TEST_SERVER_PORT node ./src/server.js > /dev/null & NODE_PID=$! -trap "kill $NODE_PID && curl http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer" EXIT +trap "kill $NODE_PID" EXIT -# Wait for selenium -MAX_WAIT=30 -WAITED=0 -until nc -z localhost 4444; do - if [ $WAITED -ge $MAX_WAIT ]; then - echo "Waited $MAX_WAIT seconds, but Selenium never responded" >&2 - kill $NODE_PID - exit 1 - fi - sleep 1 - let 'WAITED+=1' -done +NODE_ENV=testing mocha -NODE_ENV=testing mocha && grunt karma:continuous && ./node_modules/protractor/bin/protractor protractor.conf.js +if [ $? -eq 0 ] && [ -z "$TRAVIS" ]; then + NODE_ENV=testing grunt karma:continuous && ./node_modules/protractor/bin/protractor protractor.conf.js +fi