diff --git a/.drone.star b/.drone.star index a1cb11d14d3..7b4581738fb 100644 --- a/.drone.star +++ b/.drone.star @@ -93,6 +93,7 @@ config = { "apiSharingNgLinkSharePermission", "apiSharingNgLinkShareRoot", "apiActivities", + "apiVersions", ], "skip": False, }, diff --git a/tests/acceptance/bootstrap/SpacesContext.php b/tests/acceptance/bootstrap/SpacesContext.php index 9cf94d8608c..f15b519b427 100644 --- a/tests/acceptance/bootstrap/SpacesContext.php +++ b/tests/acceptance/bootstrap/SpacesContext.php @@ -4131,4 +4131,30 @@ public function userGetsTheDriveItemInSpace(string $user, string $file, string $ ) ); } + + /** + * @When user :user gets the number of versions of file :file inside space :space + * @When user :user tries to get the number of versions of file :file inside space :space + * + * @param string $user + * @param string $file + * @param string $space + * + * @return void + */ + public function userGetsTheNumberOfVersionsOfFileInsideSpace(string $user, string $file, string $space): void { + $fileId = $this->getFileId($user, $space, $file); + var_dump($fileId); + $response = $this->featureContext->makeDavRequest( + $user, + "PROPFIND", + "/meta/$fileId/v", + null, + null, + null, + '2' + ); + $this->featureContext->setResponse($response); + } + } diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml index 77adc1a097e..0566ddeb877 100644 --- a/tests/acceptance/config/behat.yml +++ b/tests/acceptance/config/behat.yml @@ -414,6 +414,16 @@ default: - CollaborationContext: - TrashbinContext: + apiVersions: + paths: + - "%paths.base%/../features/apiVersions" + context: *common_ldap_suite_context + contexts: + - FeatureContext: *common_feature_context_params + - SharingNgContext: + - FilesVersionsContext: + - OcisConfigContext: + cliCommands: paths: diff --git a/tests/acceptance/features/apiSpacesDavOperation/fileVersionByFileID.feature b/tests/acceptance/features/apiSpacesDavOperation/fileVersionByFileID.feature index c7f3e969007..c26d3734ccd 100644 --- a/tests/acceptance/features/apiSpacesDavOperation/fileVersionByFileID.feature +++ b/tests/acceptance/features/apiSpacesDavOperation/fileVersionByFileID.feature @@ -1,7 +1,7 @@ Feature: checking file versions using file id As a user - I want to share file outside of the space - So that other users can access the file + I want the versions of files to be available + So that I can manage the changes made to the files Background: Given these users have been created with default attributes and without skeleton files: diff --git a/tests/acceptance/features/apiVersions/fileVersion.feature b/tests/acceptance/features/apiVersions/fileVersion.feature new file mode 100644 index 00000000000..13ff405ac6f --- /dev/null +++ b/tests/acceptance/features/apiVersions/fileVersion.feature @@ -0,0 +1,92 @@ +@env-config +Feature: checking file versions + As a user + I want the versions of files to be available + So that I can manage the changes made to the files + + Background: + Given these users have been created with default attributes and without skeleton files: + | username | + | Alice | + | Brian | + And using spaces DAV path + + + Scenario: check version of a file when versioning is disabled + Given the config "OCIS_DISABLE_VERSIONING" has been set to "true" + And user "Alice" has uploaded file with content "test file version 1" to "/testfile.txt" + And user "Alice" has uploaded file with content "test file version 2" to "/testfile.txt" + When user "Alice" gets the number of versions of file "/testfile.txt" + Then the HTTP status code should be "207" + And the number of versions should be "0" + + + Scenario: first disable versioning and create version of a file, then enabling versioning to check file version + Given the config "OCIS_DISABLE_VERSIONING" has been set to "true" + And user "Alice" has uploaded file with content "test file version 1" to "/testfile.txt" + And user "Alice" has uploaded file with content "test file version 2" to "/testfile.txt" + And the config "OCIS_DISABLE_VERSIONING" has been set to "false" + And user "Alice" has uploaded file with content "test file version 3" to "/testfile.txt" + And user "Alice" has uploaded file with content "test file version 4" to "/testfile.txt" + When user "Alice" gets the number of versions of file "/testfile.txt" + Then the HTTP status code should be "207" + And the number of versions should be "2" + + + Scenario: file version should npt updated after versioning disabled + Given user "Alice" has uploaded file with content "test file version 1" to "/testfile.txt" + And user "Alice" has uploaded file with content "test file version 2" to "/testfile.txt" + When user "Alice" gets the number of versions of file "/testfile.txt" + Then the HTTP status code should be "207" + And the number of versions should be "1" + And the config "OCIS_DISABLE_VERSIONING" has been set to "true" + And user "Alice" has uploaded file with content "test file version 3" to "/testfile.txt" + And user "Alice" has uploaded file with content "test file version 4" to "/testfile.txt" + When user "Alice" gets the number of versions of file "/testfile.txt" + Then the HTTP status code should be "207" + And the number of versions should be "1" + + + Scenario Outline: check version of a file shared from project space when versioning is disabled + Given the config "OCIS_DISABLE_VERSIONING" has been set to "true" + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "Project1" with the default quota using the Graph API + And user "Alice" has uploaded a file inside space "Project1" with content "hello world version 1" to "text.txt" + And user "Alice" has uploaded a file inside space "Project1" with content "hello world version 1.1" to "text.txt" + And user "Alice" has sent the following resource share invitation: + | resource | text.txt | + | space | Project1 | + | sharee | Brian | + | shareType | user | + | permissionsRole | | + And user "Brian" has a share "text.txt" synced + When user "Alice" gets the number of versions of file "/text.txt" inside space "Project1" + Then the HTTP status code should be "207" + And the number of versions should be "0" + When user "Brian" tries to get the number of versions of file "/text.txt" inside space "Shares" + Then the HTTP status code should be "403" + Examples: + | role | + | File Editor | + | Viewer | + + + Scenario Outline: check version of a file shared from personal space when versioning is disabled + Given the config "OCIS_DISABLE_VERSIONING" has been set to "true" + And user "Alice" has uploaded file with content "test file version 2" to "/text.txt" + And user "Alice" has sent the following resource share invitation: + | resource | text.txt | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | | + And user "Brian" has a share "text.txt" synced + When user "Alice" gets the number of versions of file "/text.txt" inside space "Project1" + Then the HTTP status code should be "207" + And the number of versions should be "0" + When user "Brian" tries to get the number of versions of file "/text.txt" inside space "Shares" + Then the HTTP status code should be "403" + Examples: + | permissionsRole | + | Editor | + | Viewer |