add osx travis test run job (#1074)

This commit is contained in:
shirletan
2017-05-05 13:12:53 -07:00
committed by Rachel Fenichel
parent 920422196f
commit f8fa9748e9
6 changed files with 47 additions and 23 deletions

View File

@@ -1,14 +1,17 @@
language: node_js
node_js:
- "stable"
sudo: required
dist: trusty
addons:
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
matrix:
include:
- os: linux
dist: trusty
node_js: stable
sudo: required
addons:
apt:
packages:
- google-chrome-stable
- os: osx
node_js: stable
osx_image: xcode8.3
before_install:
- npm install google-closure-library
@@ -16,12 +19,11 @@ before_install:
- ln -s $(npm root)/google-closure-library ../closure-library
before_script:
- export CHROME_BIN=/usr/bin/google-chrome
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then ( scripts/setup_linux_env.sh ) fi
- if [ "${TRAVIS_OS_NAME}" == "osx" ]; then ( scripts/setup_osx_env.sh ) fi
- sleep 2
script:
- set -x
- npm test
os:
- linux

View File

@@ -5,12 +5,13 @@ if [ ! -d $chromedriver_dir ]; then
mkdir $chromedriver_dir
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
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' ]]; then
cd chromedriver && curl -L https://chromedriver.storage.googleapis.com/2.29/chromedriver_mac64.zip | tar xz
# wait until download finish
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

View File

@@ -1,5 +1,11 @@
#!/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

View File

@@ -6,10 +6,9 @@ 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

8
scripts/setup_linux_env.sh Executable file
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
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