From 2bd81a2557f5b279f0f579fa334e2d5d670012dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Sun, 28 Oct 2018 19:48:27 +0100 Subject: [PATCH 1/3] Extract acceptance tests for tags to their own feature file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel Calviño Sánchez --- .drone.yml | 9 ++ .../features/app-files-tags.feature | 89 +++++++++++++++++++ tests/acceptance/features/app-files.feature | 88 ------------------ 3 files changed, 98 insertions(+), 88 deletions(-) create mode 100644 tests/acceptance/features/app-files-tags.feature diff --git a/.drone.yml b/.drone.yml index 5768f9bbf34fe..5eb61a28781b4 100644 --- a/.drone.yml +++ b/.drone.yml @@ -678,6 +678,13 @@ pipeline: when: matrix: TESTS-ACCEPTANCE: app-files + acceptance-app-files-tags: + image: nextcloudci/acceptance-php7.1:acceptance-php7.1-2 + commands: + - tests/acceptance/run-local.sh --timeout-multiplier 10 --nextcloud-server-domain acceptance-app-files-tags --selenium-server selenium:4444 allow-git-repository-modifications features/app-files-tags.feature + when: + matrix: + TESTS-ACCEPTANCE: app-files-tags acceptance-app-theming: image: nextcloudci/acceptance-php7.1:acceptance-php7.1-2 commands: @@ -921,6 +928,8 @@ matrix: TESTS-ACCEPTANCE: app-comments - TESTS: acceptance TESTS-ACCEPTANCE: app-files + - TESTS: acceptance + TESTS-ACCEPTANCE: app-files-tags - TESTS: acceptance TESTS-ACCEPTANCE: app-theming - TESTS: acceptance diff --git a/tests/acceptance/features/app-files-tags.feature b/tests/acceptance/features/app-files-tags.feature new file mode 100644 index 0000000000000..993c505b73900 --- /dev/null +++ b/tests/acceptance/features/app-files-tags.feature @@ -0,0 +1,89 @@ +Feature: app-files-tags + + Scenario: show the input field for tags in the details view + Given I am logged in + And I open the details view for "welcome.txt" + And I see that the details view is open + When I open the input field for tags in the details view + Then I see that the input field for tags in the details view is shown + + Scenario: show the input field for tags in the details view after the sharing tab has loaded + Given I am logged in + And I open the details view for "welcome.txt" + And I see that the details view is open + And I open the "Sharing" tab in the details view + And I see that the "Sharing" tab in the details view is eventually loaded + When I open the input field for tags in the details view + Then I see that the input field for tags in the details view is shown + + Scenario: create tags using the Administration settings + Given I am logged in as the admin + And I visit the settings page + And I open the "Workflow" section + # The "create" button does nothing before JavaScript was initialized, and + # the only way to detect that is waiting for the button to select tags to be + # shown. + And I see that the button to select tags is shown + When I create the tag "tag1" in the settings + Then I see that the dropdown for tags in the settings eventually contains the tag "tag1" + + Scenario: add tags using the dropdown in the details view + Given I am logged in as the admin + And I visit the settings page + And I open the "Workflow" section + # The "create" button does nothing before JavaScript was initialized, and + # the only way to detect that is waiting for the button to select tags to be + # shown. + And I see that the button to select tags is shown + And I create the tag "tag1" in the settings + And I create the tag "tag2" in the settings + And I create the tag "tag3" in the settings + And I create the tag "tag4" in the settings + And I see that the dropdown for tags in the settings eventually contains the tag "tag1" + And I see that the dropdown for tags in the settings eventually contains the tag "tag2" + And I see that the dropdown for tags in the settings eventually contains the tag "tag3" + And I see that the dropdown for tags in the settings eventually contains the tag "tag4" + And I log out + And I am logged in + And I open the details view for "welcome.txt" + And I open the input field for tags in the details view + # When the input field is opened the dropdown is also opened automatically. + When I check the tag "tag2" in the dropdown for tags in the details view + And I check the tag "tag4" in the dropdown for tags in the details view + Then I see that the tag "tag2" in the dropdown for tags in the details view is checked + And I see that the tag "tag4" in the dropdown for tags in the details view is checked + And I see that the input field for tags in the details view contains the tag "tag2" + And I see that the input field for tags in the details view contains the tag "tag4" + + Scenario: remove tags using the dropdown in the details view + Given I am logged in as the admin + And I visit the settings page + And I open the "Workflow" section + # The "create" button does nothing before JavaScript was initialized, and + # the only way to detect that is waiting for the button to select tags to be + # shown. + And I see that the button to select tags is shown + And I create the tag "tag1" in the settings + And I create the tag "tag2" in the settings + And I create the tag "tag3" in the settings + And I create the tag "tag4" in the settings + And I see that the dropdown for tags in the settings eventually contains the tag "tag1" + And I see that the dropdown for tags in the settings eventually contains the tag "tag2" + And I see that the dropdown for tags in the settings eventually contains the tag "tag3" + And I see that the dropdown for tags in the settings eventually contains the tag "tag4" + And I log out + And I am logged in + And I open the details view for "welcome.txt" + And I open the input field for tags in the details view + # When the input field is opened the dropdown is also opened automatically. + And I check the tag "tag2" in the dropdown for tags in the details view + And I check the tag "tag4" in the dropdown for tags in the details view + And I check the tag "tag3" in the dropdown for tags in the details view + When I uncheck the tag "tag2" in the dropdown for tags in the details view + And I uncheck the tag "tag4" in the dropdown for tags in the details view + Then I see that the tag "tag2" in the dropdown for tags in the details view is not checked + And I see that the tag "tag4" in the dropdown for tags in the details view is not checked + And I see that the tag "tag3" in the dropdown for tags in the details view is checked + And I see that the input field for tags in the details view does not contain the tag "tag2" + And I see that the input field for tags in the details view does not contain the tag "tag4" + And I see that the input field for tags in the details view contains the tag "tag3" diff --git a/tests/acceptance/features/app-files.feature b/tests/acceptance/features/app-files.feature index 3bded3fef11e8..74490180ad35c 100644 --- a/tests/acceptance/features/app-files.feature +++ b/tests/acceptance/features/app-files.feature @@ -228,94 +228,6 @@ Feature: app-files # download starts no page redirection And I see that the current page is the Authenticate page for the direct download shared link I wrote down - Scenario: show the input field for tags in the details view - Given I am logged in - And I open the details view for "welcome.txt" - And I see that the details view is open - When I open the input field for tags in the details view - Then I see that the input field for tags in the details view is shown - - Scenario: show the input field for tags in the details view after the sharing tab has loaded - Given I am logged in - And I open the details view for "welcome.txt" - And I see that the details view is open - And I open the "Sharing" tab in the details view - And I see that the "Sharing" tab in the details view is eventually loaded - When I open the input field for tags in the details view - Then I see that the input field for tags in the details view is shown - - Scenario: create tags using the Administration settings - Given I am logged in as the admin - And I visit the settings page - And I open the "Workflow" section - # The "create" button does nothing before JavaScript was initialized, and - # the only way to detect that is waiting for the button to select tags to be - # shown. - And I see that the button to select tags is shown - When I create the tag "tag1" in the settings - Then I see that the dropdown for tags in the settings eventually contains the tag "tag1" - - Scenario: add tags using the dropdown in the details view - Given I am logged in as the admin - And I visit the settings page - And I open the "Workflow" section - # The "create" button does nothing before JavaScript was initialized, and - # the only way to detect that is waiting for the button to select tags to be - # shown. - And I see that the button to select tags is shown - And I create the tag "tag1" in the settings - And I create the tag "tag2" in the settings - And I create the tag "tag3" in the settings - And I create the tag "tag4" in the settings - And I see that the dropdown for tags in the settings eventually contains the tag "tag1" - And I see that the dropdown for tags in the settings eventually contains the tag "tag2" - And I see that the dropdown for tags in the settings eventually contains the tag "tag3" - And I see that the dropdown for tags in the settings eventually contains the tag "tag4" - And I log out - And I am logged in - And I open the details view for "welcome.txt" - And I open the input field for tags in the details view - # When the input field is opened the dropdown is also opened automatically. - When I check the tag "tag2" in the dropdown for tags in the details view - And I check the tag "tag4" in the dropdown for tags in the details view - Then I see that the tag "tag2" in the dropdown for tags in the details view is checked - And I see that the tag "tag4" in the dropdown for tags in the details view is checked - And I see that the input field for tags in the details view contains the tag "tag2" - And I see that the input field for tags in the details view contains the tag "tag4" - - Scenario: remove tags using the dropdown in the details view - Given I am logged in as the admin - And I visit the settings page - And I open the "Workflow" section - # The "create" button does nothing before JavaScript was initialized, and - # the only way to detect that is waiting for the button to select tags to be - # shown. - And I see that the button to select tags is shown - And I create the tag "tag1" in the settings - And I create the tag "tag2" in the settings - And I create the tag "tag3" in the settings - And I create the tag "tag4" in the settings - And I see that the dropdown for tags in the settings eventually contains the tag "tag1" - And I see that the dropdown for tags in the settings eventually contains the tag "tag2" - And I see that the dropdown for tags in the settings eventually contains the tag "tag3" - And I see that the dropdown for tags in the settings eventually contains the tag "tag4" - And I log out - And I am logged in - And I open the details view for "welcome.txt" - And I open the input field for tags in the details view - # When the input field is opened the dropdown is also opened automatically. - And I check the tag "tag2" in the dropdown for tags in the details view - And I check the tag "tag4" in the dropdown for tags in the details view - And I check the tag "tag3" in the dropdown for tags in the details view - When I uncheck the tag "tag2" in the dropdown for tags in the details view - And I uncheck the tag "tag4" in the dropdown for tags in the details view - Then I see that the tag "tag2" in the dropdown for tags in the details view is not checked - And I see that the tag "tag4" in the dropdown for tags in the details view is not checked - And I see that the tag "tag3" in the dropdown for tags in the details view is checked - And I see that the input field for tags in the details view does not contain the tag "tag2" - And I see that the input field for tags in the details view does not contain the tag "tag4" - And I see that the input field for tags in the details view contains the tag "tag3" - Scenario: marking a file as favorite causes the file list to be sorted again Given I am logged in And I create a new folder named "A name alphabetically lower than welcome.txt" From b321e47e5de6b6564195f5d3b26dfa4c465235f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Mon, 29 Oct 2018 12:23:01 +0100 Subject: [PATCH 2/3] Link the default Apache directory to the Nextcloud server in all runners MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In order to run the acceptance tests in Apache "/var/www/html" has to be linked to the root directory of the Nextcloud server. Before this was automatically done when launching the acceptance tests through "./run.sh", but an explicit command was needed when run in Drone. Now the linking was moved from "run.sh" to "run-local.sh", so it is automatically done when run through "./run.sh" and in Drone, including when running the tests for an app instead of for the server. Signed-off-by: Daniel Calviño Sánchez --- tests/acceptance/run-local.sh | 4 ++++ tests/acceptance/run.sh | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/acceptance/run-local.sh b/tests/acceptance/run-local.sh index 7ae6705000c66..548e9e9ceae69 100755 --- a/tests/acceptance/run-local.sh +++ b/tests/acceptance/run-local.sh @@ -189,6 +189,10 @@ composer install cd ../../ +# Link the default Apache directory to the root directory of the Nextcloud +# server to make possible to run the Nextcloud server on Apache if needed. +ln --symbolic $(pwd) /var/www/html + INSTALL_AND_CONFIGURE_SERVER_PARAMETERS="" if [ "$NEXTCLOUD_SERVER_DOMAIN" != "$DEFAULT_NEXTCLOUD_SERVER_DOMAIN" ]; then INSTALL_AND_CONFIGURE_SERVER_PARAMETERS+="--nextcloud-server-domain $NEXTCLOUD_SERVER_DOMAIN" diff --git a/tests/acceptance/run.sh b/tests/acceptance/run.sh index 3ed1207e3799e..366e7a67bf521 100755 --- a/tests/acceptance/run.sh +++ b/tests/acceptance/run.sh @@ -153,10 +153,6 @@ function prepareDocker() { docker exec $NEXTCLOUD_LOCAL_CONTAINER mkdir /nextcloud docker cp - $NEXTCLOUD_LOCAL_CONTAINER:/nextcloud/ < "$NEXTCLOUD_LOCAL_TAR" - # Link the default Apache directory to the root directory of the Nextcloud - # server to make possible to run the Nextcloud server on Apache if needed. - docker exec $NEXTCLOUD_LOCAL_CONTAINER ln --symbolic /nextcloud /var/www/html - # run-local.sh expects a Git repository to be available in the root of the # Nextcloud server, but it was excluded when the Git working directory was # copied to the container to avoid copying the large and unneeded history of From 021c153886ff3a5a63aaaf36b1c4e30bdcb2a70c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Sun, 28 Oct 2018 19:51:13 +0100 Subject: [PATCH 3/3] Move acceptance tests that crash the PHP built-in server to Apache MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The PHP built-in server can crash when certain actions are performed in Nextcloud (but although the crash is triggered by Nextcloud it does not seem to be a Nextcloud bug), which can lead to failures in the acceptance tests that would have otherwise passed. A crash of the PHP built-in server during an acceptance test can be identified by the message "sh: 1: kill: No such process" in the acceptance tests output; as the PHP built-in server crashed its process does no longer exist when it is tried to be killed when the scenario ends. Although the crash has been observed in other tests too it is more prevalent in the tests for tags and the theming app. In order to reduce the false positives those tests are now run on Apache instead of on the PHP built-in sever. However, the rest of tests are still run on the PHP built-in server due to its lower resource consumption. In order to run a feature or just a scenario using Apache it has to be tagged with "@apache"; features or scenarios without that tag (the default) will run on the PHP built-in server instead. Signed-off-by: Daniel Calviño Sánchez --- tests/acceptance/config/behat.yml | 28 +++++++++++++++++++ .../features/app-files-tags.feature | 1 + tests/acceptance/features/app-theming.feature | 1 + 3 files changed, 30 insertions(+) diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml index e1248e18a812c..d1489a00864a0 100644 --- a/tests/acceptance/config/behat.yml +++ b/tests/acceptance/config/behat.yml @@ -23,6 +23,34 @@ default: - SettingsMenuContext - ThemingAppContext - UsersSettingsContext + filters: + tags: "~@apache" + apache: + paths: + - %paths.base%/../features + contexts: + - ActorContext + - NextcloudTestServerContext: + nextcloudTestServerHelper: NextcloudTestServerLocalApacheHelper + + - AppNavigationContext + - AppSettingsContext + - AppsManagementContext + - CommentsAppContext + - ContactsMenuContext + - DialogContext + - FeatureContext + - FileListContext + - FilesAppContext + - FilesSharingAppContext + - LoginPageContext + - NotificationContext + - SettingsContext + - SettingsMenuContext + - ThemingAppContext + - UsersSettingsContext + filters: + tags: "@apache" extensions: Behat\MinkExtension: sessions: diff --git a/tests/acceptance/features/app-files-tags.feature b/tests/acceptance/features/app-files-tags.feature index 993c505b73900..3da24b7e1c25c 100644 --- a/tests/acceptance/features/app-files-tags.feature +++ b/tests/acceptance/features/app-files-tags.feature @@ -1,3 +1,4 @@ +@apache Feature: app-files-tags Scenario: show the input field for tags in the details view diff --git a/tests/acceptance/features/app-theming.feature b/tests/acceptance/features/app-theming.feature index 268b9a04a2f9d..01c7d8df8dd0d 100644 --- a/tests/acceptance/features/app-theming.feature +++ b/tests/acceptance/features/app-theming.feature @@ -1,3 +1,4 @@ +@apache Feature: app-theming Scenario: changing the color updates the header color