summaryrefslogtreecommitdiffstats
path: root/tests/acceptance
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2018-05-15 16:58:03 +0200
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2018-05-29 20:24:32 +0200
commit3bdb07320d25034482620258645047b2de1f54e3 (patch)
tree6b05790ccdeb5801ad9f4d6cc5d8188852c2d967 /tests/acceptance
parentf4a64051b64d9f9fd4a3202e9386a8ac35de927e (diff)
downloadnextcloud-server-3bdb07320d25034482620258645047b2de1f54e3.tar.gz
nextcloud-server-3bdb07320d25034482620258645047b2de1f54e3.zip
Add workaround for parameter not available in Mink Extension
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. "paths.base" is a special parameter in the Behat configuration that refers to the directory in which "behat.yml" is stored. This comes in very handy to set the path to custom Firefox profiles in the acceptance tests for apps, as even if the "behat.yml" file belongs to an app its paths are relative to the directory in which the tests are run, that is, the "tests/acceptance" directory of the server. Until the bug is fixed, just before the acceptance tests are run the "paths.base" parameter in the path to the custom Firefox profile is replaced by its value in the "behat.yml" file used by the acceptance tests. Note that the file that is modified is the one inside the Docker container used to run the acceptance tests, so the original file is not touched. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'tests/acceptance')
-rwxr-xr-xtests/acceptance/run-local.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/acceptance/run-local.sh b/tests/acceptance/run-local.sh
index 38e23588b18..eda119d74cc 100755
--- a/tests/acceptance/run-local.sh
+++ b/tests/acceptance/run-local.sh
@@ -159,6 +159,18 @@ if [ "$NEXTCLOUD_SERVER_DOMAIN" != "$DEFAULT_NEXTCLOUD_SERVER_DOMAIN" ]; then
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".