summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-05-29 20:59:46 +0200
committerGitHub <noreply@github.com>2018-05-29 20:59:46 +0200
commit8376ca3eb76f22709ca7c96b49663eb420f7096c (patch)
treee5f8002bffb931b377c9193d145ec495d17e0d20
parentc0ed6f91a8217c9a1cbb720167bfd0d85bd467bc (diff)
parentaedcbb64da3078dff19548d8d3122ac6431c175b (diff)
downloadnextcloud-server-8376ca3eb76f22709ca7c96b49663eb420f7096c.tar.gz
nextcloud-server-8376ca3eb76f22709ca7c96b49663eb420f7096c.zip
Merge pull request #9665 from nextcloud/add-workaround-for-parameter-not-available-in-mink-extension
Add workaround for parameter not available in Mink Extension
-rw-r--r--tests/acceptance/config/behat.yml2
-rwxr-xr-xtests/acceptance/run-local.sh20
2 files changed, 18 insertions, 4 deletions
diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml
index 5f1b27ffe2d..965d5f02fcc 100644
--- a/tests/acceptance/config/behat.yml
+++ b/tests/acceptance/config/behat.yml
@@ -36,4 +36,4 @@ default:
selenium2:
capabilities:
firefox:
- profile: config/firefox-profiles/css-grid-enabled.zip
+ profile: %paths.base%/firefox-profiles/css-grid-enabled.zip
diff --git a/tests/acceptance/run-local.sh b/tests/acceptance/run-local.sh
index fcf6155d6f7..eda119d74cc 100755
--- a/tests/acceptance/run-local.sh
+++ b/tests/acceptance/run-local.sh
@@ -63,6 +63,8 @@ if [ "$1" = "--acceptance-tests-dir" ]; then
shift 2
fi
+ACCEPTANCE_TESTS_CONFIG_DIR="../../$ACCEPTANCE_TESTS_DIR/config"
+
# "--timeout-multiplier N" option can be provided to set the timeout multiplier
# to be used in ActorContext.
TIMEOUT_MULTIPLIER=""
@@ -133,7 +135,7 @@ if [ "$TIMEOUT_MULTIPLIER" != "" ]; then
REPLACEMENT="\
- ActorContext:\n\
actorTimeoutMultiplier: $TIMEOUT_MULTIPLIER"
- sed --in-place "s/$ORIGINAL/$REPLACEMENT/" ../../$ACCEPTANCE_TESTS_DIR/config/behat.yml
+ sed --in-place "s/$ORIGINAL/$REPLACEMENT/" $ACCEPTANCE_TESTS_CONFIG_DIR/behat.yml
fi
if [ "$NEXTCLOUD_SERVER_DOMAIN" != "$DEFAULT_NEXTCLOUD_SERVER_DOMAIN" ]; then
@@ -154,9 +156,21 @@ if [ "$NEXTCLOUD_SERVER_DOMAIN" != "$DEFAULT_NEXTCLOUD_SERVER_DOMAIN" ]; then
- NextcloudTestServerContext:\n\
nextcloudTestServerHelperParameters:\n\
- $NEXTCLOUD_SERVER_DOMAIN"
- sed --in-place "s/$ORIGINAL/$REPLACEMENT/" ../../$ACCEPTANCE_TESTS_DIR/config/behat.yml
+ sed --in-place "s/$ORIGINAL/$REPLACEMENT/" $ACCEPTANCE_TESTS_CONFIG_DIR/behat.yml
fi
+# Due to a bug in the Mink Extension for Behat it is not possible to use the
+# "paths.base" parameter in the path to the custom Firefox profile. Thus, the
+# default "behat.yml" configuration file has to be adjusted to replace the
+# parameter by its value before the configuration file is parsed by Behat.
+ORIGINAL="profile: %paths.base%"
+REPLACEMENT="profile: $ACCEPTANCE_TESTS_CONFIG_DIR"
+# As the substitution does not involve regular expressions or multilines it can
+# be done just with Bash. Moreover, this does not require escaping the regular
+# expression characters that may appear in the path, like "/".
+FILE_CONTENTS=$(<$ACCEPTANCE_TESTS_CONFIG_DIR/behat.yml)
+echo "${FILE_CONTENTS//$ORIGINAL/$REPLACEMENT}" > $ACCEPTANCE_TESTS_CONFIG_DIR/behat.yml
+
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".
@@ -215,4 +229,4 @@ cd tests/acceptance
echo "Waiting for Selenium"
timeout 60s bash -c "while ! curl $SELENIUM_SERVER >/dev/null 2>&1; do sleep 1; done"
-vendor/bin/behat --config=../../$ACCEPTANCE_TESTS_DIR/config/behat.yml $SCENARIO_TO_RUN
+vendor/bin/behat --config=$ACCEPTANCE_TESTS_CONFIG_DIR/behat.yml $SCENARIO_TO_RUN