Welcome to mirror list, hosted at ThFree Co, Russian Federation.

runLocal.sh « cypress - github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 981d8b55fd649b104c38a51433cb789431f2fc93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash

CYPRESS_DIR=$(dirname -- "$(readlink -f "${BASH_SOURCE}")")
CYPRESS_baseUrl=${CYPRESS_baseUrl:-http://localhost:8081/index.php}
APP_SOURCE=$CYPRESS_DIR/..

export CYPRESS_DIR
export CYPRESS_baseUrl
export APP_SOURCE

function finish {
	docker-compose down
}
trap finish EXIT

cd "$CYPRESS_DIR" || exit
if [ ! -f "$(npm bin)/wait-on" ]
then
	npm install --no-save wait-on
fi

# start server if it's not running yet
if "$(npm bin)/wait-on" -i 500 -t 1000 "$CYPRESS_baseUrl" 2> /dev/null
then
	echo Server is up at "$CYPRESS_baseUrl"
else
	echo No server reached at "$CYPRESS_baseUrl" - starting containers.
	DOCKER_BUILDKIT=1 docker-compose up -d
	if ! "$(npm bin)/wait-on" -i 500 -t 240000 "$CYPRESS_baseUrl" 2> /dev/null
	then
		echo Waiting for "$CYPRESS_baseUrl" timed out.
		echo Container logs:
		docker-compose logs
		exit 1
	fi
fi

(cd .. && "$(npm bin)/cypress" "$@")