diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2020-05-28 20:53:36 +0200 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2020-05-29 16:56:56 +0200 |
commit | b5ffa2ea3d3d38dcf68b1ba3cd65998621256512 (patch) | |
tree | bad9290390d58e8fcc5f94148cd8ee51f271c175 | |
parent | f5eb93e29adf97bbbcbff976bed29ef353abbff5 (diff) | |
download | nextcloud-server-b5ffa2ea3d3d38dcf68b1ba3cd65998621256512.tar.gz nextcloud-server-b5ffa2ea3d3d38dcf68b1ba3cd65998621256512.zip |
Add integration tests for video verification
Enabling the "send password by Talk" property of shares require that
Talk is installed and enabled, so the Drone step that runs them has to
first clone the Talk repository.
When the integration tests are run on a local development instance,
however, it is not guaranteed that Talk is installed. Due to this the
"@Talk" tag was added, which ensures that any feature or scenario marked
with it will first check if Talk is installed and, if not, skip the
scenario (instead of failing).
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
-rw-r--r-- | .drone.yml | 31 | ||||
-rw-r--r-- | build/integration/config/behat.yml | 1 | ||||
-rw-r--r-- | build/integration/features/bootstrap/TalkContext.php | 72 | ||||
-rw-r--r-- | build/integration/sharing_features/sharing-v1-video-verification.feature | 504 |
4 files changed, 608 insertions, 0 deletions
diff --git a/.drone.yml b/.drone.yml index 2e2e9e8f959..e0671a050a5 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1419,6 +1419,37 @@ trigger: --- kind: pipeline +name: integration-sharing-v1-video-verification + +steps: +- name: submodules + image: docker:git + commands: + - git submodule update --init +- name: install-talk + image: docker:git + commands: + # JavaScript files are not used in integration tests so it is not needed to + # build them. + - git clone --branch stable18 --depth 1 https://github.com/nextcloud/spreed apps/spreed +- name: integration-sharing-v1-video-verification + image: nextcloudci/integration-php7.3:integration-php7.3-2 + commands: + - bash tests/drone-run-integration-tests.sh || exit 0 + - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int + - cd build/integration + - ./run.sh sharing_features/sharing-v1-video-verification.feature + +trigger: + branch: + - master + - stable* + event: + - pull_request + - push + +--- +kind: pipeline name: integration-setup-features steps: diff --git a/build/integration/config/behat.yml b/build/integration/config/behat.yml index 27d7daa4818..79ffe58f6b6 100644 --- a/build/integration/config/behat.yml +++ b/build/integration/config/behat.yml @@ -65,6 +65,7 @@ default: - admin - admin regular_user_password: 123456 + - TalkContext setup: paths: - "%paths.base%/../setup_features" diff --git a/build/integration/features/bootstrap/TalkContext.php b/build/integration/features/bootstrap/TalkContext.php new file mode 100644 index 00000000000..bc61c87ebab --- /dev/null +++ b/build/integration/features/bootstrap/TalkContext.php @@ -0,0 +1,72 @@ +<?php +/** + * @copyright Copyright (c) 2020, Daniel Calviño Sánchez (danxuliu@gmail.com) + * + * @author Daniel Calviño Sánchez <danxuliu@gmail.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +use Behat\Behat\Context\Context; + +class TalkContext implements Context { + + /** + * @BeforeFeature @Talk + * @BeforeScenario @Talk + */ + public static function skipTestsIfTalkIsNotInstalled() { + if (!TalkContext::isTalkInstalled()) { + throw new Exception('Talk needs to be installed to run features or scenarios tagged with @Talk'); + } + } + + /** + * @AfterScenario @Talk + */ + public static function disableTalk() { + TalkContext::runOcc(['app:disable', 'spreed']); + } + + private static function isTalkInstalled(): bool { + $appList = TalkContext::runOcc(['app:list']); + + return strpos($appList, 'spreed') !== false; + } + + private static function runOcc(array $args): string { + // Based on "runOcc" from CommandLine trait (which can not be used due + // to not being static and being already used in other sibling + // contexts). + $args = array_map(function ($arg) { + return escapeshellarg($arg); + }, $args); + $args[] = '--no-ansi --no-warnings'; + $args = implode(' ', $args); + + $descriptor = [ + 0 => ['pipe', 'r'], + 1 => ['pipe', 'w'], + 2 => ['pipe', 'w'], + ]; + $process = proc_open('php console.php ' . $args, $descriptor, $pipes, $ocPath = '../..'); + $lastStdOut = stream_get_contents($pipes[1]); + proc_close($process); + + return $lastStdOut; + } +} diff --git a/build/integration/sharing_features/sharing-v1-video-verification.feature b/build/integration/sharing_features/sharing-v1-video-verification.feature new file mode 100644 index 00000000000..e57ec9a9f98 --- /dev/null +++ b/build/integration/sharing_features/sharing-v1-video-verification.feature @@ -0,0 +1,504 @@ +@Talk +Feature: sharing + Background: + Given using api version "1" + Given using old dav path + Given invoking occ with "app:enable spreed" + + Scenario: Creating a link share with send password by Talk + Given user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + | password | secret | + | sendPasswordByTalk | true | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Enabling send password by Talk in a link share + Given user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + And Updating last share with + | password | secret | + | sendPasswordByTalk | true | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Enabling send password by Talk with different password in a link share + Given user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + | password | secret | + And Updating last share with + | password | another secret | + | sendPasswordByTalk | true | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "another secret" can be downloaded + + Scenario: Enabling send password by Talk with different password set after creation in a link share + Given user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + And Updating last share with + | password | secret | + And Updating last share with + | password | another secret | + | sendPasswordByTalk | true | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "another secret" can be downloaded + + Scenario: Enabling send password by Talk with same password in a link share + Given user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + | password | secret | + And Updating last share with + | password | secret | + | sendPasswordByTalk | true | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Enabling send password by Talk with same password set after creation in a link share + Given user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + And Updating last share with + | password | secret | + And Updating last share with + | password | secret | + | sendPasswordByTalk | true | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Enabling send password by Talk without updating password in a link share + Given user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + | password | secret | + And Updating last share with + | sendPasswordByTalk | true | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Enabling send password by Talk without updating password set after creation in a link share + Given user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + And Updating last share with + | password | secret | + And Updating last share with + | sendPasswordByTalk | true | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Enabling send password by Talk with no password in a link share + Given user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + And Updating last share with + | sendPasswordByTalk | true | + Then the OCS status code should be "400" + And the HTTP status code should be "200" + And last share can be downloaded + + Scenario: Enabling send password by Talk with no password removed after creation in a link share + Given user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + | password | secret | + And Updating last share with + | password | | + And Updating last share with + | sendPasswordByTalk | true | + Then the OCS status code should be "400" + And the HTTP status code should be "200" + And last share can be downloaded + + Scenario: Disabling send password by Talk without setting new password in a link share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + | password | secret | + | sendPasswordByTalk | true | + And Updating last share with + | sendPasswordByTalk | false | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Disabling send password by Talk without setting new password set after creation in a link share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + And Updating last share with + | password | secret | + | sendPasswordByTalk | true | + And Updating last share with + | sendPasswordByTalk | false | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Disabling send password by Talk setting same password in a link share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + | password | secret | + | sendPasswordByTalk | true | + And Updating last share with + | password | secret | + | sendPasswordByTalk | false | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Disabling send password by Talk setting same password set after creation in a link share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + And Updating last share with + | password | secret | + | sendPasswordByTalk | true | + And Updating last share with + | password | secret | + | sendPasswordByTalk | false | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Disabling send password by Talk setting new password in a link share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + | password | secret | + | sendPasswordByTalk | true | + And Updating last share with + | password | another secret | + | sendPasswordByTalk | false | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "another secret" can be downloaded + + Scenario: Disabling send password by Talk setting new password set after creation in a link share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + And Updating last share with + | password | secret | + | sendPasswordByTalk | true | + And Updating last share with + | password | another secret | + | sendPasswordByTalk | false | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "another secret" can be downloaded + + + + + + Scenario: Creating a mail share with send password by Talk + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + | password | secret | + | sendPasswordByTalk | true | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Enabling send password by Talk in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + And Updating last share with + | password | secret | + | sendPasswordByTalk | true | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Enabling send password by Talk with different password in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + | password | secret | + And Updating last share with + | password | another secret | + | sendPasswordByTalk | true | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "another secret" can be downloaded + + Scenario: Enabling send password by Talk with different password set after creation in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + And Updating last share with + | password | secret | + And Updating last share with + | password | another secret | + | sendPasswordByTalk | true | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "another secret" can be downloaded + + Scenario: Enabling send password by Talk with same password in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + | password | secret | + And Updating last share with + | password | secret | + | sendPasswordByTalk | true | + Then the OCS status code should be "400" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Enabling send password by Talk with same password set after creation in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + And Updating last share with + | password | secret | + And Updating last share with + | password | secret | + | sendPasswordByTalk | true | + Then the OCS status code should be "400" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Enabling send password by Talk without updating password in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + | password | secret | + And Updating last share with + | sendPasswordByTalk | true | + Then the OCS status code should be "400" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Enabling send password by Talk without updating password set after creation in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + And Updating last share with + | password | secret | + And Updating last share with + | sendPasswordByTalk | true | + Then the OCS status code should be "400" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Enabling send password by Talk with no password in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + And Updating last share with + | sendPasswordByTalk | true | + Then the OCS status code should be "400" + And the HTTP status code should be "200" + And last share can be downloaded + + Scenario: Enabling send password by Talk with no password removed after creation in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + | password | secret | + And Updating last share with + | password | | + And Updating last share with + | sendPasswordByTalk | true | + Then the OCS status code should be "400" + And the HTTP status code should be "200" + And last share can be downloaded + + Scenario: Disabling send password by Talk without setting new password in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + | password | secret | + | sendPasswordByTalk | true | + And Updating last share with + | sendPasswordByTalk | false | + Then the OCS status code should be "400" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Disabling send password by Talk without setting new password set after creation in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + And Updating last share with + | password | secret | + | sendPasswordByTalk | true | + And Updating last share with + | sendPasswordByTalk | false | + Then the OCS status code should be "400" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Disabling send password by Talk setting same password in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + | password | secret | + | sendPasswordByTalk | true | + And Updating last share with + | password | secret | + | sendPasswordByTalk | false | + Then the OCS status code should be "400" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Disabling send password by Talk setting same password set after creation in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + And Updating last share with + | password | secret | + | sendPasswordByTalk | true | + And Updating last share with + | password | secret | + | sendPasswordByTalk | false | + Then the OCS status code should be "400" + And the HTTP status code should be "200" + And last share with password "secret" can be downloaded + + Scenario: Disabling send password by Talk setting new password in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + | password | secret | + | sendPasswordByTalk | true | + And Updating last share with + | password | another secret | + | sendPasswordByTalk | false | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "another secret" can be downloaded + + Scenario: Disabling send password by Talk setting new password set after creation in a mail share + Given dummy mail server is listening + And user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dummy@test.com | + And Updating last share with + | password | secret | + | sendPasswordByTalk | true | + And Updating last share with + | password | another secret | + | sendPasswordByTalk | false | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share with password "another secret" can be downloaded |