Merge pull request #9665 from nextcloud/add-workaround-for-parameter-not-available-in-mink-extension

Add workaround for parameter not available in Mink Extension
This commit is contained in:
Morris Jobke 2018-05-29 20:59:46 +02:00 committed by GitHub
commit 8376ca3eb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 4 deletions

View File

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

View File

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