From f4a64051b64d9f9fd4a3202e9386a8ac35de927e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Tue, 15 May 2018 16:51:12 +0200 Subject: [PATCH 1/3] Extract path to configuration dir to its own variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel Calviño Sánchez --- tests/acceptance/run-local.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/acceptance/run-local.sh b/tests/acceptance/run-local.sh index fcf6155d6f..38e23588b1 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,7 +156,7 @@ 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 if [ "$SELENIUM_SERVER" != "$DEFAULT_SELENIUM_SERVER" ]; then @@ -215,4 +217,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 From 3bdb07320d25034482620258645047b2de1f54e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Tue, 15 May 2018 16:58:03 +0200 Subject: [PATCH 2/3] Add workaround for parameter not available in Mink Extension MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- tests/acceptance/run-local.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/acceptance/run-local.sh b/tests/acceptance/run-local.sh index 38e23588b1..eda119d74c 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". From aedcbb64da3078dff19548d8d3122ac6431c175b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Wed, 16 May 2018 12:28:23 +0200 Subject: [PATCH 3/3] Use "paths.base" parameter for the path to the custom Firefox profile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Although in the case of the acceptance tests for the server it is not strictly needed it was modified for consistency with the configuration used for the acceptance tests in apps. Signed-off-by: Daniel Calviño Sánchez --- tests/acceptance/config/behat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml index 5f1b27ffe2..965d5f02fc 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