diff --git a/.travis.yml b/.travis.yml index 82ec939c..c7e97d1f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,7 @@ language: node_js -script: "npm run unit" +script: + - npm run unit + - if [ "${TRAVIS_BRANCH}" == "production" ]; then npm run acceptance-prod fi; + - if [ "${TRAVIS_BRANCH}" == "master" ] && [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then npm run acceptance-stage fi; node_js: - "0.10" \ No newline at end of file diff --git a/package.json b/package.json index 4c4c3411..377c750a 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,9 @@ "ciao": "node node_modules/ciao/bin/ciao -c test/ciao.json test/ciao", "coverage": "node_modules/.bin/istanbul cover test/unit/run.js", "audit": "npm shrinkwrap; node node_modules/nsp/bin/nspCLI.js audit-shrinkwrap; rm npm-shrinkwrap.json;", - "docs": "rm -r docs; cd test/ciao; node ../../node_modules/ciao/bin/ciao -c ../ciao.json . -d ../../docs" + "docs": "rm -r docs; cd test/ciao; node ../../node_modules/ciao/bin/ciao -c ../ciao.json . -d ../../docs", + "acceptance-prod": "sh test/acceptance/remote.sh production", + "acceptance-stage": "sh test/acceptance/remote.sh master" }, "repository": { "type": "git", diff --git a/test/acceptance/remote.sh b/test/acceptance/remote.sh new file mode 100644 index 00000000..c31db69a --- /dev/null +++ b/test/acceptance/remote.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +set -ex + +if [ -d test/acceptance/acceptance-tests ]; then + rm -rf test/acceptance/acceptance-tests +fi + +if [ "$1" == "production" ]; then + git clone -b production --single-branch https://github.com/pelias/acceptance-tests.git test/acceptance/acceptance-tests +else + git clone https://github.com/pelias/acceptance-tests.git test/acceptance/acceptance-tests +fi + +cd test/acceptance/acceptance-tests +npm install + +if [ "$1" == "production" ]; then + node test -e prod +else + node test -e stage +fi + +cd ../../../ && rm -rf test/acceptance/acceptance-tests