diff --git a/tests/acceptance/features/apiWebdavOperations/deleteFolder.feature b/tests/acceptance/features/apiWebdavOperations/deleteFolder.feature index c8fe5cd52da6..65e088bf36fd 100644 --- a/tests/acceptance/features/apiWebdavOperations/deleteFolder.feature +++ b/tests/acceptance/features/apiWebdavOperations/deleteFolder.feature @@ -79,10 +79,10 @@ Feature: delete folder And user "Brian" should be able to delete folder "/Top" Examples: | dav_version | share_folder | - | old | /ReceivedShares | - | new | /ReceivedShares | | old | ReceivedShares | + | old | /ReceivedShares | | new | ReceivedShares | + | new | /ReceivedShares | @files_sharing-app-required @notToImplementOnOCIS Scenario Outline: delete a folder when there is a default folder for received shares that is a multi-level path diff --git a/tests/acceptance/features/apiWebdavOperations/deleteFolderContents.feature b/tests/acceptance/features/apiWebdavOperations/deleteFolderContents.feature index 9657670115a8..3a4f38d08d19 100644 --- a/tests/acceptance/features/apiWebdavOperations/deleteFolderContents.feature +++ b/tests/acceptance/features/apiWebdavOperations/deleteFolderContents.feature @@ -17,7 +17,8 @@ Feature: delete folder contents And user "Alice" has uploaded file "filesForUpload/lorem.txt" to "/FOLDER/fileToDelete.txt" And user "Alice" has uploaded file "filesForUpload/lorem.txt" to "/FOLDER/SUBFOLDER/textfile0.txt" When user "Alice" deletes everything from folder "/FOLDER/" using the WebDAV API - Then user "Alice" should see the following elements + Then the HTTP status code should be "204" + And user "Alice" should see the following elements | /FOLDER/ | | /PARENT/ | | /textfile0.txt | diff --git a/tests/acceptance/features/apiWebdavOperations/downloadFile.feature b/tests/acceptance/features/apiWebdavOperations/downloadFile.feature index 6c94602f7add..45160552506d 100644 --- a/tests/acceptance/features/apiWebdavOperations/downloadFile.feature +++ b/tests/acceptance/features/apiWebdavOperations/downloadFile.feature @@ -13,7 +13,8 @@ Feature: download file Scenario Outline: download a file Given using DAV path When user "Alice" downloads file "/textfile0.txt" using the WebDAV API - Then the downloaded content should be "ownCloud test text file 0" + Then the HTTP status code should be "200" + And the downloaded content should be "ownCloud test text file 0" Examples: | dav_version | | old | @@ -28,7 +29,8 @@ Feature: download file Scenario Outline: download a file with range Given using DAV path When user "Alice" downloads file "/welcome.txt" with range "bytes=24-50" using the WebDAV API - Then the downloaded content should be "example file for developers" + Then the HTTP status code should be "206" + And the downloaded content should be "example file for developers" Examples: | dav_version | | old | @@ -44,7 +46,8 @@ Feature: download file Given using DAV path And user "Alice" has uploaded file "/file9000000.txt" ending with "text at end of file" of size 9000000 bytes When user "Alice" downloads file "/file9000000.txt" using the WebDAV API - Then the size of the downloaded file should be 9000000 bytes + Then the HTTP status code should be "200" + And the size of the downloaded file should be 9000000 bytes And the downloaded content should end with "text at end of file" Examples: | dav_version | @@ -60,7 +63,8 @@ Feature: download file Scenario Outline: Downloading a file should serve security headers Given using DAV path When user "Alice" downloads file "/welcome.txt" using the WebDAV API - Then the following headers should be set + Then the HTTP status code should be "200" + And the following headers should be set | header | value | | Content-Disposition | attachment; filename*=UTF-8''welcome.txt; filename="welcome.txt" | | Content-Security-Policy | default-src 'none'; | @@ -81,8 +85,8 @@ Feature: download file Given using DAV path And user "Alice" has logged in to a web-style session When the client sends a "GET" to "/remote.php/dav/files/%username%/welcome.txt" of user "Alice" without requesttoken - Then the downloaded content should start with "Welcome" - And the HTTP status code should be "200" + Then the HTTP status code should be "200" + And the downloaded content should start with "Welcome" Examples: | dav_version | | old | @@ -93,8 +97,8 @@ Feature: download file Given using DAV path And user "Alice" has logged in to a web-style session When the client sends a "GET" to "/remote.php/dav/files/%username%/welcome.txt" of user "Alice" with requesttoken - Then the downloaded content should start with "Welcome" - And the HTTP status code should be "200" + Then the HTTP status code should be "200" + And the downloaded content should start with "Welcome" Examples: | dav_version | | old | @@ -123,7 +127,8 @@ Feature: download file Given using DAV path And user "Alice" has uploaded file "filesForUpload/simple.pdf" to "/simple.pdf" When user "Alice" downloads file "/simple.pdf" using the WebDAV API - Then the following headers should be set + Then the HTTP status code should be "200" + And the following headers should be set | header | value | | Content-Length | 9622 | Examples: @@ -141,7 +146,8 @@ Feature: download file Given using DAV path And user "Alice" has uploaded file "filesForUpload/testavatar.png" to "/testavatar.png" When user "Alice" downloads file "/testavatar.png" using the WebDAV API - Then the following headers should be set + Then the HTTP status code should be "200" + And the following headers should be set | header | value | | Content-Length | 35323 | Examples: @@ -159,7 +165,8 @@ Feature: download file Given using DAV path And user "Alice" has uploaded file with content "file with comma in filename" to When user "Alice" downloads file using the WebDAV API - Then the downloaded content should be "file with comma in filename" + Then the HTTP status code should be "200" + And the downloaded content should be "file with comma in filename" Examples: | dav_version | filename | | old | "sample,1.txt" | @@ -275,19 +282,22 @@ Feature: download file | spaces | - Scenario Outline: download a hidden file + Scenario Outline: download hidden files Given using DAV path And user "Alice" has created folder "/FOLDER" And user "Alice" has uploaded the following files with content "hidden file" | path | | .hidden_file | | /FOLDER/.hidden_file | - When user "Alice" downloads file ".hidden_file" using the WebDAV API - Then the HTTP status code should be "200" - And the downloaded content should be "hidden file" - When user "Alice" downloads file "./FOLDER/.hidden_file" using the WebDAV API - Then the HTTP status code should be "200" - And the downloaded content should be "hidden file" + When user "Alice" downloads the following files using the WebDAV API + | path | + | .hidden_file | + | /FOLDER/.hidden_file | + Then the HTTP status code of responses on all endpoints should be "200" + And the content of the following files for user "Alice" should be "hidden file" + | path | + | .hidden_file | + | /FOLDER/.hidden_file | Examples: | dav_version | | old | @@ -302,7 +312,8 @@ Feature: download file Scenario Outline: Downloading a file should serve security headers Given using DAV path When user "Alice" downloads file "/welcome.txt" using the WebDAV API - Then the following headers should be set + Then the HTTP status code should be "200" + And the following headers should be set | header | value | | Content-Disposition | attachment; filename*=UTF-8''welcome.txt; filename="welcome.txt" | | Content-Security-Policy | default-src 'none'; | @@ -327,5 +338,5 @@ Feature: download file Scenario: download a zero byte size file Given user "Alice" has uploaded file "filesForUpload/zerobyte.txt" to "/zerobyte.txt" When user "Alice" downloads file "/zerobyte.txt" using the WebDAV API - Then the size of the downloaded file should be 0 bytes - And the HTTP status code should be "200" \ No newline at end of file + Then the HTTP status code should be "200" + And the size of the downloaded file should be 0 bytes \ No newline at end of file diff --git a/tests/acceptance/features/apiWebdavOperations/listFiles.feature b/tests/acceptance/features/apiWebdavOperations/listFiles.feature index 23f68ed415f5..26891b6cc926 100644 --- a/tests/acceptance/features/apiWebdavOperations/listFiles.feature +++ b/tests/acceptance/features/apiWebdavOperations/listFiles.feature @@ -24,7 +24,7 @@ Feature: list files | simple-folder/simple-folder1/simple-folder2/welcome.txt | - Scenario Outline: Get the list of resources in the root folder + Scenario Outline: Get the list of resources in the root folder with depth 0 Given using DAV path When user "Alice" lists the resources in "/" with depth "0" using the WebDAV API Then the HTTP status code should be "207" @@ -37,6 +37,19 @@ Feature: list files | simple-folder/textfile0.txt | | simple-folder/simple-empty-folder | | simple-folder/simple-folder1 | + Examples: + | dav_version | + | old | + | new | + + @skipOnOcV10 @personalSpace + Examples: + | dav_version | + | spaces | + + + Scenario Outline: Get the list of resources in the root folder with depth 1 + Given using DAV path When user "Alice" lists the resources in "/" with depth 1 using the WebDAV API Then the HTTP status code should be "207" And the last DAV response for user "Alice" should contain these nodes @@ -50,6 +63,18 @@ Feature: list files | simple-folder/textfile0.txt | | simple-folder/simple-empty-folder | | simple-folder/simple-folder1 | + Examples: + | dav_version | + | old | + | new | + + @skipOnOcV10 @personalSpace + Examples: + | dav_version | + | spaces | + + Scenario Outline: Get the list of resources in the root folder with depth infinity + Given using DAV path When user "Alice" lists the resources in "/" with depth "infinity" using the WebDAV API Then the HTTP status code should be "207" And the last DAV response for user "Alice" should contain these nodes @@ -77,7 +102,7 @@ Feature: list files | spaces | - Scenario Outline: Get the list of resources in a folder + Scenario Outline: Get the list of resources in a folder with depth 0 Given using DAV path When user "Alice" lists the resources in "/simple-folder" with depth "0" using the WebDAV API Then the HTTP status code should be "207" @@ -90,6 +115,19 @@ Feature: list files | simple-folder/textfile0.txt | | simple-folder/simple-empty-folder | | simple-folder/simple-folder1 | + Examples: + | dav_version | + | old | + | new | + + @skipOnOcV10 @personalSpace + Examples: + | dav_version | + | spaces | + + + Scenario Outline: Get the list of resources in a folder with depth 1 + Given using DAV path When user "Alice" lists the resources in "/simple-folder" with depth 1 using the WebDAV API Then the HTTP status code should be "207" And the last DAV response for user "Alice" should contain these nodes @@ -105,6 +143,19 @@ Feature: list files | simple-folder/simple-folder1/welcome.txt | | simple-folder/simple-folder1/simple-folder2/textfile0.txt | | simple-folder/simple-folder1/simple-folder2/welcome.txt | + Examples: + | dav_version | + | old | + | new | + + @skipOnOcV10 @personalSpace + Examples: + | dav_version | + | spaces | + + + Scenario Outline: Get the list of resources in a folder with depth infinity + Given using DAV path When user "Alice" lists the resources in "/simple-folder" with depth "infinity" using the WebDAV API Then the HTTP status code should be "207" And the last DAV response for user "Alice" should contain these nodes @@ -128,7 +179,7 @@ Feature: list files | spaces | - Scenario Outline: Get the list of resources in a folder shared through public link + Scenario Outline: Get the list of resources in a folder shared through public link with depth 0 Given using DAV path And user "Alice" has created the following folders | path | @@ -149,6 +200,22 @@ Feature: list files | /simple-folder1/simple-folder2/welcome.txt | | /simple-folder1/simple-folder2/simple-folder3 | | /simple-folder1/simple-folder2/simple-folder3/simple-folder4 | + @notToImplementOnOCIS @issue-ocis-2079 + Examples: + | dav_version | + | old | + + Examples: + | dav_version | + | new | + + Scenario Outline: Get the list of resources in a folder shared through public link with depth 1 + Given using DAV path + And user "Alice" has created the following folders + | path | + | /simple-folder/simple-folder1/simple-folder2/simple-folder3 | + | /simple-folder/simple-folder1/simple-folder2/simple-folder3/simple-folder4 | + And user "Alice" has created a public link share of folder "simple-folder" When the public lists the resources in the last created public link with depth 1 using the WebDAV API Then the HTTP status code should be "207" And the last public link DAV response should contain these nodes @@ -165,6 +232,22 @@ Feature: list files | /simple-folder1/simple-folder2 | | /simple-folder1/textfile0.txt | | /simple-folder1/simple-folder2/simple-folder3/simple-folder4 | + @notToImplementOnOCIS @issue-ocis-2079 + Examples: + | dav_version | + | old | + + Examples: + | dav_version | + | new | + + Scenario Outline: Get the list of resources in a folder shared through public link with depth infinity + Given using DAV path + And user "Alice" has created the following folders + | path | + | /simple-folder/simple-folder1/simple-folder2/simple-folder3 | + | /simple-folder/simple-folder1/simple-folder2/simple-folder3/simple-folder4 | + And user "Alice" has created a public link share of folder "simple-folder" When the public lists the resources in the last created public link with depth infinity using the WebDAV API Then the HTTP status code should be "207" And the last public link DAV response should contain these nodes @@ -190,8 +273,8 @@ Feature: list files | new | - Scenario: Get the list of files in a folder in the trashbin - Given using new DAV path + Scenario Outline: Get the list of files in a folder in the trashbin with depth 0 + Given using DAV path And user "Alice" has deleted the following resources | path | | textfile0.txt | @@ -210,6 +293,19 @@ Feature: list files | simple-folder/simple-folder1/welcome.txt | | simple-folder/simple-folder1/simple-folder2/textfile0.txt | | simple-folder/simple-folder1/simple-folder2/welcome.txt | + Examples: + | dav_version | + | old | + | new | + + + Scenario Outline: Get the list of files in a folder in the trashbin with depth 1 + Given using DAV path + And user "Alice" has deleted the following resources + | path | + | textfile0.txt | + | welcome.txt | + | simple-folder/ | When user "Alice" lists the resources in the trashbin path "/" with depth 1 using the WebDAV API Then the HTTP status code should be "207" And the trashbin DAV response should contain these nodes @@ -225,6 +321,19 @@ Feature: list files | simple-folder/simple-folder1/welcome.txt | | simple-folder/simple-folder1/simple-folder2/textfile0.txt | | simple-folder/simple-folder1/simple-folder2/welcome.txt | + Examples: + | dav_version | + | old | + | new | + + + Scenario Outline: Get the list of files in a folder in the trashbin with depth infinity + Given using DAV path + And user "Alice" has deleted the following resources + | path | + | textfile0.txt | + | welcome.txt | + | simple-folder/ | When user "Alice" lists the resources in the trashbin path "/" with depth infinity using the WebDAV API Then the HTTP status code should be "207" And the trashbin DAV response should contain these nodes @@ -238,3 +347,7 @@ Feature: list files | simple-folder/simple-folder1/welcome.txt | | simple-folder/simple-folder1/simple-folder2/textfile0.txt | | simple-folder/simple-folder1/simple-folder2/welcome.txt | + Examples: + | dav_version | + | old | + | new | \ No newline at end of file diff --git a/tests/acceptance/features/bootstrap/WebDav.php b/tests/acceptance/features/bootstrap/WebDav.php index aa3e4bff4e9e..20118889d885 100644 --- a/tests/acceptance/features/bootstrap/WebDav.php +++ b/tests/acceptance/features/bootstrap/WebDav.php @@ -3172,6 +3172,28 @@ public function userHasUploadedFollowingFiles( return $fileIds; } + /** + * @When /^user "([^"]*)" downloads the following files using the WebDAV API$/ + * + * @param string $user + * @param TableNode $table + * + * @return void + * @throws Exception + */ + public function userDownloadsFollowingFiles( + string $user, + TableNode $table + ):void { + $this->verifyTableNodeColumns($table, ["path"]); + $files = $table->getHash(); + $this->emptyLastHTTPStatusCodesArray(); + foreach ($files as $fileName) { + $this->downloadFileAsUserUsingPassword($user, $fileName["path"]); + $this->pushToLastStatusCodesArrays(); + } + } + /** * @When user :user uploads a file with content :content and mtime :mtime to :destination using the WebDAV API *