diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2017-07-20 08:56:51 +0300 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2017-07-20 08:56:51 +0300 |
commit | c37329005e88e53533612012d5b09305ae303595 (patch) | |
tree | df14a9f7fcfab28ebfdef4feb05b5b63a2869e89 /tests/acceptance/run-local.sh | |
parent | 2fe8cad710a92eed6e463d1b5b67d44ca9197f87 (diff) |
Add option to acceptance test runner to set the Selenium server
By default "127.0.0.1:4444" is used, so nothing needs to be set when the
acceptance tests and the Selenium server share the same network (like
when called by "run.sh").
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'tests/acceptance/run-local.sh')
-rwxr-xr-x | tests/acceptance/run-local.sh | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/tests/acceptance/run-local.sh b/tests/acceptance/run-local.sh index 1e4c3224287..e2270be3854 100755 --- a/tests/acceptance/run-local.sh +++ b/tests/acceptance/run-local.sh @@ -64,6 +64,16 @@ if [ "$1" = "--nextcloud-server-domain" ]; then shift 2 fi +# "--selenium-server XXX" option can be provided to set the domain and port used +# by the acceptance tests to access the Selenium server. +DEFAULT_SELENIUM_SERVER="127.0.0.1:4444" +SELENIUM_SERVER="$DEFAULT_SELENIUM_SERVER" +if [ "$1" = "--selenium-server" ]; then + SELENIUM_SERVER=$2 + + shift 2 +fi + # Safety parameter to prevent executing this script by mistake and messing with # the Git repository. if [ "$1" != "allow-git-repository-modifications" ]; then @@ -107,6 +117,35 @@ if [ "$NEXTCLOUD_SERVER_DOMAIN" != "$DEFAULT_NEXTCLOUD_SERVER_DOMAIN" ]; then sed --in-place "s/$ORIGINAL/$REPLACEMENT/" config/behat.yml fi +if [ "$SELENIUM_SERVER" != "$DEFAULT_SELENIUM_SERVER" ]; then + # Set the Selenium server to be used by Mink; this extends the default + # configuration from "config/behat.yml". + export BEHAT_PARAMS=' +{ + "extensions": { + "Behat\\MinkExtension": { + "sessions": { + "default": { + "selenium2": { + "wd_host": "http://'"$SELENIUM_SERVER"'/wd/hub" + } + }, + "John": { + "selenium2": { + "wd_host": "http://'"$SELENIUM_SERVER"'/wd/hub" + } + }, + "Jane": { + "selenium2": { + "wd_host": "http://'"$SELENIUM_SERVER"'/wd/hub" + } + } + } + } + } +}' +fi + composer install cd ../../ @@ -127,6 +166,6 @@ cd tests/acceptance # Ensure that the Selenium server is ready before running the tests. echo "Waiting for Selenium" -timeout 60s bash -c "while ! curl 127.0.0.1:4444 >/dev/null 2>&1; do sleep 1; done" +timeout 60s bash -c "while ! curl $SELENIUM_SERVER >/dev/null 2>&1; do sleep 1; done" vendor/bin/behat $SCENARIO_TO_RUN |