fix acceptance tests

This commit is contained in:
Hayden Faulds 2017-11-21 17:04:09 +00:00
parent 5cdddc7d0e
commit e54e2c8328
3 changed files with 29 additions and 15 deletions

View file

@ -124,7 +124,7 @@ pipeline {
stage('Acceptance Tests') { stage('Acceptance Tests') {
steps { steps {
sh 'docker pull sharelatex/acceptance-test-runner' sh 'docker pull sharelatex/acceptance-test-runner'
sh 'docker run --rm -v $(pwd):/app --env SHARELATEX_ALLOW_PUBLIC_ACCESS=true sharelatex/acceptance-test-runner || (cat forever/app.log && false)' sh 'docker run --rm -v $(pwd):/app --env SHARELATEX_ALLOW_PUBLIC_ACCESS=true fauldsh/sl-acceptance-test-runner:node-6.9 || (cat forever/app.log && false)'
} }
} }

View file

@ -163,7 +163,7 @@ class User
@request.get { @request.get {
url: "/register" url: "/register"
}, (err, response, body) => }, (err, response, body) =>
return callback(error) if error? return callback(err) if err?
csrfMatches = body.match("window.csrfToken = \"(.*?)\";") csrfMatches = body.match("window.csrfToken = \"(.*?)\";")
if !csrfMatches? if !csrfMatches?
return callback(new Error("no csrf token found")) return callback(new Error("no csrf token found"))

View file

@ -1,26 +1,40 @@
#! /usr/bin/env bash #! /usr/bin/env bash
# If you're running on OS X, you probably need to manually # If you're running on OS X, you probably need to rebuild
# 'rm -r node_modules/bcrypt; npm install bcrypt' inside # some dependencies in the docker container, before it will start.
# the docker container, before it will start. #
# npm rebuild bcrypt # npm rebuild --update-binary
echo ">> Starting server..." echo ">> Starting server..."
grunt --no-color forever:app:start grunt --no-color forever:app:start
echo ">> Server started" echo ">> Waiting for Server"
sleep 5 count=1
max_wait=60
echo ">> Running acceptance tests..." while [ $count -le $max_wait ]
grunt --no-color mochaTest:acceptance do
_test_exit_code=$? if nc -z localhost 3000
then
echo ">> Server Started"
echo ">> Killing server" echo ">> Running acceptance tests..."
grunt --no-color mochaTest:acceptance
_test_exit_code=$?
grunt --no-color forever:app:stop echo ">> Killing server"
echo ">> Done" grunt --no-color forever:app:stop
exit $_test_exit_code echo ">> Done"
exit $_test_exit_code
fi
sleep 1
echo -n "."
count=$((count+1))
done
exit 1