Convert compile demo into a unit test. (#1360)

* Intentionally break Travis.

* Alphabetize tests, remove orphaned test, and add fail to test that's running.

* Unbreak test, disable OS X, move scripts, list compiler directory.

* Test Java, break test.

* Unbreak test, call compile script.

* Compile main_compressed.js

* Run test command using bash.

* Fix path.

* Exclude node modules.

* Be more specific about JS files to compile.

* Test failure.

* Restore OSX, undo Blockly failure, remove compilation demo, add compilation test.

* Delete manual test files.

* Ignore downloaded/generated files.

* Whitespace cleanup.
This commit is contained in:
Neil Fraser
2017-10-12 14:54:57 -07:00
committed by Rachel Fenichel
parent 4df6f11f8a
commit 82705923cb
24 changed files with 97 additions and 206 deletions

Binary file not shown.

View File

@@ -0,0 +1,17 @@
#!/bin/bash
os_name=`uname`
chromedriver_dir="chromedriver"
if [ ! -d $chromedriver_dir ]; then
mkdir $chromedriver_dir
fi
echo "downloading chromedriver"
if [[ $os_name == 'Linux' && ! -f $chromedriver_dir/chromedriver ]]; 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' && ! -f $chromedriver_dir/chromedriver ]]; then
cd chromedriver && curl -L https://chromedriver.storage.googleapis.com/2.29/chromedriver_mac64.zip | tar xz
sleep 5
fi

15
tests/scripts/get_geckdriver.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/bash
os_name=`uname`
if [ -f geckodriver ]; then
exit 0
fi
echo "downloading gechdriver"
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

14
tests/scripts/get_selenium.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
DIR="../webdriverio-test"
FILE=selenium-server-standalone-3.0.1.jar
if [ ! -d $DIR ]; then
mkdir $DIR
fi
echo "downloading selenium jar"
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

View File

@@ -0,0 +1,10 @@
#!/bin/bash
#check if selenium server is up running
pid=`lsof -ti tcp:4444`
if [ $? -eq 0 ]
then
kill -9 $pid
fi
java -jar -Dwebdriver.gecko.driver=../geckodriver -Dwebdriver.chrome.driver="chromedriver/chromedriver" ../webdriverio-test/selenium-server-standalone-3.0.1.jar &

View File

@@ -0,0 +1,8 @@
#!/bin/bash
if [ "${TRAVIS_OS_NAME}" == "linux" ]
then
export CHROME_BIN="/usr/bin/google-chrome"
export DISPLAY=:99.0
sh -e /etc/init.d/xvfb start &
fi

8
tests/scripts/setup_osx_env.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
if [ "${TRAVIS_OS_NAME}" == "osx" ]
then
brew cask install google-chrome
sudo Xvfb :99 -ac -screen 0 1024x768x8 &
export CHROME_BIN="/Applications/Google Chrome.app"
fi

23
tests/scripts/test_setup.sh Executable file
View File

@@ -0,0 +1,23 @@
#!/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 tests/scripts/get_geckdriver.sh
sleep 5
check_command tests/scripts/get_selenium.sh
sleep 5
check_command tests/scripts/get_chromedriver.sh
sleep 10
check_command tests/scripts/selenium_connect.sh
sleep 10
exit $EXIT_STATUS