diff --git a/.travis.yml b/.travis.yml index 35b3b125a..9846e52fd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: node_js node_js: -- "4" - "stable" sudo: required dist: trusty @@ -22,11 +21,7 @@ before_script: - sh -e /etc/init.d/xvfb start script: - set -x - - scripts/get_geckdriver.sh - - scripts/get_selenium.sh - - scripts/get_chromedriver.sh - - scripts/selenium_connect.sh & - - node tests/jsunit/test_runner.js + - npm test os: - linux diff --git a/package.json b/package.json index 46bc66e26..95a7ea9eb 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,8 @@ "name": "Neil Fraser" }, "scripts": { - "lint": "jshint .", - "preinstall": "scripts/get_geckdriver.sh && scripts/get_selenium.sh && scripts/get_chromedriver.sh && scripts/selenium_connect.sh &", + "lint": "jshint .", + "pretest": "scripts/test_setup.sh", "test": "node tests/jsunit/test_runner.js" }, "license": "Apache-2.0", diff --git a/scripts/.selenium_connect.sh.swp b/scripts/.selenium_connect.sh.swp new file mode 100644 index 000000000..ceaa1343a Binary files /dev/null and b/scripts/.selenium_connect.sh.swp differ diff --git a/scripts/get_chromedriver.sh b/scripts/get_chromedriver.sh index ab24d9bba..e5d44f5a1 100755 --- a/scripts/get_chromedriver.sh +++ b/scripts/get_chromedriver.sh @@ -7,6 +7,10 @@ fi if [[ $os_name == 'Linux' ]]; then cd chromedriver && curl -L https://chromedriver.storage.googleapis.com/2.29/chromedriver_linux64.zip > tmp.zip && unzip -o tmp.zip && rm tmp.zip + # wait until download finish + sleep 5 elif [[ $os_name == 'Darwin' ]]; then cd chromedriver && curl -L https://chromedriver.storage.googleapis.com/2.29/chromedriver_mac64.zip | tar xz + # wait until download finish + sleep 5 fi diff --git a/scripts/get_geckdriver.sh b/scripts/get_geckdriver.sh index 4cc3b8f68..12002b608 100755 --- a/scripts/get_geckdriver.sh +++ b/scripts/get_geckdriver.sh @@ -2,6 +2,8 @@ os_name=`uname` if [[ $os_name == 'Linux' ]]; then cd ../ && curl -L https://github.com/mozilla/geckodriver/releases/download/v0.11.1/geckodriver-v0.11.1-linux64.tar.gz | tar xz + sleep 5 elif [[ $os_name == 'Darwin' ]]; then cd ../ && curl -L https://github.com/mozilla/geckodriver/releases/download/v0.11.1/geckodriver-v0.11.1-macos.tar.gz | tar xz + sleep 5 fi diff --git a/scripts/get_selenium.sh b/scripts/get_selenium.sh index 34a416b60..14287f060 100755 --- a/scripts/get_selenium.sh +++ b/scripts/get_selenium.sh @@ -8,6 +8,7 @@ fi if [ ! -f $DIR/$FILE ]; then cd $DIR && curl -O http://selenium-release.storage.googleapis.com/3.0/selenium-server-standalone-3.0.1.jar + sleep 5 fi diff --git a/scripts/test_setup.sh b/scripts/test_setup.sh new file mode 100755 index 000000000..feae42eeb --- /dev/null +++ b/scripts/test_setup.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +EXIT_STATUS=0 + +function check_command { + "$@" + local STATUS=$? + if [ $STATUS -ne 0 ]; then + echo "error with $1 ($STATUS)" >&2 + EXIT_STATUS=$STATUS + fi + } + +check_command scripts/get_geckdriver.sh +sleep 5 +check_command scripts/get_selenium.sh +sleep 5 +check_command scripts/get_chromedriver.sh +sleep 5 +check_command scripts/selenium_connect.sh +sleep 3 +exit $EXIT_STATUS