summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/acceptance/config/behat.yml10
-rwxr-xr-xtests/acceptance/run-local.sh43
2 files changed, 22 insertions, 31 deletions
diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml
index 55d2ff3a6f4..e1248e18a81 100644
--- a/tests/acceptance/config/behat.yml
+++ b/tests/acceptance/config/behat.yml
@@ -27,14 +27,18 @@ default:
Behat\MinkExtension:
sessions:
default:
- selenium2: ~
+ selenium2:
+ wd_host: %selenium.server%
John:
- selenium2: ~
+ selenium2:
+ wd_host: %selenium.server%
Jane:
- selenium2: ~
+ selenium2:
+ wd_host: %selenium.server%
Rubeus:
# Rubeus uses a browser that has CSS grid support.
selenium2:
+ wd_host: %selenium.server%
capabilities:
firefox:
profile: %paths.base%/firefox-profiles/css-grid-enabled.zip
diff --git a/tests/acceptance/run-local.sh b/tests/acceptance/run-local.sh
index eda119d74cc..529026483cf 100755
--- a/tests/acceptance/run-local.sh
+++ b/tests/acceptance/run-local.sh
@@ -160,9 +160,9 @@ if [ "$NEXTCLOUD_SERVER_DOMAIN" != "$DEFAULT_NEXTCLOUD_SERVER_DOMAIN" ]; then
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
+# "paths.base" variable 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.
+# variable 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
@@ -172,32 +172,19 @@ 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".
- 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"
- }
- }
- }
- }
- }
-}'
+ # Set the Selenium server to be used by Mink. Although Mink sessions can be
+ # extended through BEHAT_PARAMS this would require adding here too each new
+ # session added to "behat.yml", including those added in the acceptance
+ # tests of apps. Instead, the default "behat.yml" configuration file is
+ # adjusted to replace the simulated "selenium.server" variable by its value
+ # before the configuration file is parsed by Behat.
+ ORIGINAL="wd_host: %selenium.server%"
+ REPLACEMENT="wd_host: http://$SELENIUM_SERVER/wd/hub"
+ # 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 URL, like "/".
+ FILE_CONTENTS=$(<$ACCEPTANCE_TESTS_CONFIG_DIR/behat.yml)
+ echo "${FILE_CONTENTS//$ORIGINAL/$REPLACEMENT}" > $ACCEPTANCE_TESTS_CONFIG_DIR/behat.yml
fi
composer install