Browse Source

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>
tags/v14.0.0beta1
Daniel Calviño Sánchez 6 years ago
parent
commit
3bdb07320d
1 changed files with 12 additions and 0 deletions
  1. 12
    0
      tests/acceptance/run-local.sh

+ 12
- 0
tests/acceptance/run-local.sh View File

@@ -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".

Loading…
Cancel
Save