use pretest instead of preinstall in package.json (#1043)

* cherry pick for pretest fix

* put pretest target to test_setup.sh

* fix conflict

* cherry pick for get_chromedriver.sh

* add some sleep to wait download to finish

* use node.js stable

* use npm test target
This commit is contained in:
shirletan
2017-04-13 15:23:48 -07:00
committed by RoboErikG
parent 606adccf38
commit 23e5728ff4
7 changed files with 32 additions and 8 deletions

View File

@@ -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

View File

@@ -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",

Binary file not shown.

View File

@@ -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

View File

@@ -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

View File

@@ -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

22
scripts/test_setup.sh Executable file
View File

@@ -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