Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests-only][full-ci] Add test coverage for file preview using space dav version #7218

Merged
merged 2 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions tests/acceptance/expected-failures-API-on-OCIS-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,6 @@ cannot share a folder with create permission

- [coreApiSharePublicLink1/createPublicLinkShare.feature:327](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiSharePublicLink1/createPublicLinkShare.feature#L327)

#### [download previews of other users file](https://github.com/owncloud/ocis/issues/2071)

- [coreApiWebdavPreviews/previews.feature:98](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavPreviews/previews.feature#L98)

#### [copying a folder within a public link folder to folder with same name as an already existing file overwrites the parent file](https://github.com/owncloud/ocis/issues/1232)

- [coreApiSharePublicLink2/copyFromPublicLink.feature:65](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiSharePublicLink2/copyFromPublicLink.feature#L65)
Expand Down
4 changes: 3 additions & 1 deletion tests/acceptance/features/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ public function makeDavRequest(
* @param string|null $height
*
* @return void
* @throws GuzzleException
*/
public function downloadPreviews(string $user, ?string $path, ?string $doDavRequestAsUser, ?string $width, ?string $height):void {
$user = $this->getActualUsername($user);
Expand All @@ -473,7 +474,7 @@ public function downloadPreviews(string $user, ?string $path, ?string $doDavRequ
[],
null,
"files",
'2',
null,
false,
null,
$urlParameter,
Expand Down Expand Up @@ -4630,6 +4631,7 @@ public function userHasDeletedEverythingInFolder(string $user, string $folder):v

/**
* @When user :user downloads the preview of :path with width :width and height :height using the WebDAV API
* @When user :user tries to download the preview of nonexistent file :path with width :width and height :height using the WebDAV API
*
* @param string $user
* @param string $path
Expand Down
217 changes: 159 additions & 58 deletions tests/acceptance/features/coreApiWebdavPreviews/previews.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,146 +9,238 @@ Feature: previews of files downloaded through the webdav API


Scenario Outline: download previews with invalid width
Given user "Alice" has uploaded file "filesForUpload/lorem.txt" to "/parent.txt"
Given using <dav-path-version> DAV path
And user "Alice" has uploaded file "filesForUpload/lorem.txt" to "/parent.txt"
When user "Alice" downloads the preview of "/parent.txt" with width "<width>" and height "32" using the WebDAV API
Then the HTTP status code should be "400"
And the value of the item "/d:error/s:message" in the response about user "Alice" should be "Cannot set width of 0 or smaller!"
And the value of the item "/d:error/s:exception" in the response about user "Alice" should be "Sabre\DAV\Exception\BadRequest"
Examples:
| width |
| 0 |
| 0.5 |
| -1 |
| false |
| true |
| A |
| %2F |
| dav-path-version | width |
| old | 0 |
| old | 0.5 |
| old | -1 |
| old | false |
| old | true |
| old | A |
| old | %2F |
| new | 0 |
| new | 0.5 |
| new | -1 |
| new | false |
| new | true |
| new | A |
| new | %2F |
| spaces | 0 |
| spaces | 0.5 |
| spaces | -1 |
| spaces | false |
| spaces | true |
| spaces | A |
| spaces | %2F |


Scenario Outline: download previews with invalid height
Given user "Alice" has uploaded file "filesForUpload/lorem.txt" to "/parent.txt"
Given using <dav-path-version> DAV path
And user "Alice" has uploaded file "filesForUpload/lorem.txt" to "/parent.txt"
When user "Alice" downloads the preview of "/parent.txt" with width "32" and height "<height>" using the WebDAV API
Then the HTTP status code should be "400"
And the value of the item "/d:error/s:message" in the response about user "Alice" should be "Cannot set height of 0 or smaller!"
And the value of the item "/d:error/s:exception" in the response about user "Alice" should be "Sabre\DAV\Exception\BadRequest"
Examples:
| height |
| 0 |
| 0.5 |
| -1 |
| false |
| true |
| A |
| %2F |


Scenario: download previews of files inside sub-folders
Given user "Alice" has created folder "subfolder"
And user "Alice" has uploaded file "filesForUpload/lorem.txt" to "/subfolder/parent.txt"
When user "Alice" downloads the preview of "/subfolder/parent.txt" with width "32" and height "32" using the WebDAV API
| dav-path-version | height |
| old | 0 |
| old | 0.5 |
| old | -1 |
| old | false |
| old | true |
| old | A |
| old | %2F |
| new | 0 |
| new | 0.5 |
| new | -1 |
| new | false |
| new | true |
| new | A |
| new | %2F |
| spaces | 0 |
| spaces | 0.5 |
| spaces | -1 |
| spaces | false |
| spaces | true |
| spaces | A |
| spaces | %2F |


Scenario Outline: download previews of files inside sub-folders
Given using <dav-path-version> DAV path
And user "Alice" has created folder "subfolder"
And user "Alice" has uploaded file "filesForUpload/example.gif" to "subfolder/example.gif"
When user "Alice" downloads the preview of "subfolder/example.gif" with width "32" and height "32" using the WebDAV API
Then the HTTP status code should be "200"
And the downloaded image should be "32" pixels wide and "32" pixels high
Examples:
| dav-path-version |
| old |
| new |
| spaces |


Scenario Outline: download previews of file types that don't support preview
Given user "Alice" has uploaded file "filesForUpload/<filename>" to "/<newfilename>"
When user "Alice" downloads the preview of "/<newfilename>" with width "32" and height "32" using the WebDAV API
Given using <dav-path-version> DAV path
And user "Alice" has uploaded file "filesForUpload/<filename>" to "/<filename>"
When user "Alice" downloads the preview of "/<filename>" with width "32" and height "32" using the WebDAV API
Then the HTTP status code should be "404"
And the value of the item "/d:error/s:exception" in the response about user "Alice" should be "Sabre\DAV\Exception\NotFound"
Examples:
| filename | newfilename |
| simple.pdf | test.pdf |
| simple.odt | test.odt |
| new-data.zip | test.zip |
| dav-path-version | filename |
| old | simple.pdf |
| old | simple.odt |
| old | new-data.zip |
| new | simple.pdf |
| new | simple.odt |
| new | new-data.zip |
| spaces | simple.pdf |
| spaces | simple.odt |
| spaces | new-data.zip |


Scenario Outline: download previews of different image file types
Given user "Alice" has uploaded file "filesForUpload/<imageName>" to "/<newImageName>"
When user "Alice" downloads the preview of "/<newImageName>" with width "32" and height "32" using the WebDAV API
Given using <dav-path-version> DAV path
And user "Alice" has uploaded file "filesForUpload/<imageName>" to "/<imageName>"
When user "Alice" downloads the preview of "/<imageName>" with width "32" and height "32" using the WebDAV API
Then the HTTP status code should be "200"
And the downloaded image should be "32" pixels wide and "32" pixels high
Examples:
| imageName | newImageName |
| testavatar.jpg | testimage.jpg |
| testavatar.png | testimage.png |
| dav-path-version | imageName |
| old | testavatar.jpg |
| old | testavatar.png |
| new | testavatar.jpg |
| new | testavatar.png |
| spaces | testavatar.jpg |
| spaces | testavatar.png |


Scenario: download previews of image after renaming it
Given user "Alice" has uploaded file "filesForUpload/testavatar.jpg" to "/testimage.jpg"
Scenario Outline: download previews of image after renaming it
Given using <dav-path-version> DAV path
And user "Alice" has uploaded file "filesForUpload/testavatar.jpg" to "/testimage.jpg"
And user "Alice" has moved file "/testimage.jpg" to "/testimage.txt"
When user "Alice" downloads the preview of "/testimage.txt" with width "32" and height "32" using the WebDAV API
Then the HTTP status code should be "200"
And the downloaded image should be "32" pixels wide and "32" pixels high
Examples:
| dav-path-version |
| old |
| new |
| spaces |


Scenario Outline: download previews of shared files (to shares folder)
Given user "Brian" has been created with default attributes and without skeleton files
Given using <dav-path-version> DAV path
And user "Brian" has been created with default attributes and without skeleton files
And user "Alice" has uploaded file "filesForUpload/<resource>" to "/<resource>"
And user "Alice" has shared file "/<resource>" with user "Brian"
And user "Brian" has accepted share "/<resource>" offered by user "Alice"
When user "Brian" downloads the preview of "/Shares/<resource>" with width "32" and height "32" using the WebDAV API
Then the HTTP status code should be "200"
And the downloaded image should be "32" pixels wide and "32" pixels high
Examples:
| resource |
| lorem.txt |
| example.gif |
| dav-path-version | resource |
| old | lorem.txt |
| old | example.gif |
| new | lorem.txt |
| new | example.gif |
PrajwolAmatya marked this conversation as resolved.
Show resolved Hide resolved


Scenario: download previews of other users files
Given user "Brian" has been created with default attributes and without skeleton files
Scenario Outline: user tries to download previews of other users files
Given using <dav-path-version> DAV path
And user "Brian" has been created with default attributes and without skeleton files
And user "Alice" has uploaded file "filesForUpload/lorem.txt" to "/parent.txt"
When user "Brian" downloads the preview of "/parent.txt" of "Alice" with width "32" and height "32" using the WebDAV API
Then the HTTP status code should be "404"
And the value of the item "/d:error/s:message" in the response about user "Alice" should be "File not found: parent.txt in '%username%'"
And the value of the item "/d:error/s:message" in the response about user "Alice" should be "File with name parent.txt could not be located"
And the value of the item "/d:error/s:exception" in the response about user "Alice" should be "Sabre\DAV\Exception\NotFound"
Examples:
| dav-path-version |
| new |
| spaces |
SagarGi marked this conversation as resolved.
Show resolved Hide resolved


Scenario: download previews of folders
Given user "Alice" has created folder "subfolder"
Scenario Outline: download previews of folders
Given using <dav-path-version> DAV path
And user "Alice" has created folder "subfolder"
When user "Alice" downloads the preview of "/subfolder/" with width "32" and height "32" using the WebDAV API
Then the HTTP status code should be "400"
And the value of the item "/d:error/s:message" in the response about user "Alice" should be "Unsupported file type"
And the value of the item "/d:error/s:exception" in the response about user "Alice" should be "Sabre\DAV\Exception\BadRequest"
Examples:
| dav-path-version |
| old |
| new |
| spaces |


Scenario: download previews of not-existing files
When user "Alice" downloads the preview of "/parent.txt" with width "32" and height "32" using the WebDAV API
Scenario Outline: user tries to download previews of nonexistent files
Given using <dav-path-version> DAV path
When user "Alice" tries to download the preview of nonexistent file "/parent.txt" with width "32" and height "32" using the WebDAV API
Then the HTTP status code should be "404"
And the value of the item "/d:error/s:message" in the response about user "Alice" should be "File with name parent.txt could not be located"
And the value of the item "/d:error/s:exception" in the response about user "Alice" should be "Sabre\DAV\Exception\NotFound"
Examples:
| dav-path-version |
| old |
| new |
| spaces |


Scenario: preview content changes with the change in file content
Given user "Alice" has uploaded file "filesForUpload/lorem.txt" to "/parent.txt"
Scenario Outline: preview content changes with the change in file content
Given using <dav-path-version> DAV path
And user "Alice" has uploaded file "filesForUpload/lorem.txt" to "/parent.txt"
And user "Alice" has downloaded the preview of "/parent.txt" with width "32" and height "32"
When user "Alice" uploads file with content "this is a file to upload" to "/parent.txt" using the WebDAV API
Then the HTTP status code should be "204"
And as user "Alice" the preview of "/parent.txt" with width "32" and height "32" should have been changed
Examples:
| dav-path-version |
| old |
| new |
| spaces |

@issue-2538
Scenario: when owner updates a shared file, previews for sharee are also updated (to shared folder)
Given user "Brian" has been created with default attributes and without skeleton files
Scenario Outline: when owner updates a shared file, previews for sharee are also updated (to shared folder)
Given using <dav-path-version> DAV path
And user "Brian" has been created with default attributes and without skeleton files
And user "Alice" has uploaded file "filesForUpload/lorem.txt" to "/parent.txt"
And user "Alice" has shared file "/parent.txt" with user "Brian"
And user "Brian" has accepted share "/parent.txt" offered by user "Alice"
And user "Brian" has downloaded the preview of "/Shares/parent.txt" with width "32" and height "32"
When user "Alice" uploads file with content "this is a file to upload" to "/parent.txt" using the WebDAV API
Then the HTTP status code should be "204"
And as user "Brian" the preview of "/Shares/parent.txt" with width "32" and height "32" should have been changed
Examples:
| dav-path-version |
| old |
| new |


Scenario: preview content should be updated if the file content is updated (content with UTF chars)
Given user "Alice" has uploaded file "filesForUpload/lorem.txt" to "/lorem.txt"
Scenario Outline: it should update the preview content if the file content is updated (content with UTF chars)
Given using <dav-path-version> DAV path
And user "Alice" has uploaded file "filesForUpload/lorem.txt" to "/lorem.txt"
And user "Alice" has uploaded file with content "ओनक्लाउड फाएल शेरिङ्ग एन्ड सिन्किङ" to "/lorem.txt"
When user "Alice" downloads the preview of "/lorem.txt" with width "32" and height "32" using the WebDAV API
Then the HTTP status code should be "200"
And the downloaded image should be "32" pixels wide and "32" pixels high
And the downloaded preview content should match with "unicode-fixture.png" fixtures preview content
Examples:
| dav-path-version |
| old |
| new |
| spaces |


Scenario: updates to a file should change the preview for both sharees and sharers
Given user "Brian" has been created with default attributes and without skeleton files
Scenario Outline: updates to a file should change the preview for both sharees and sharers
Given using <dav-path-version> DAV path
And user "Brian" has been created with default attributes and without skeleton files
And user "Alice" has created folder "FOLDER"
And user "Alice" has uploaded file with content "file to upload" to "/FOLDER/lorem.txt"
And user "Alice" has shared folder "FOLDER" with user "Brian"
Expand All @@ -163,10 +255,15 @@ Feature: previews of files downloaded through the webdav API
Then the HTTP status code should be "204"
And as user "Alice" the preview of "/FOLDER/lorem.txt" with width "32" and height "32" should have been changed
And as user "Brian" the preview of "Shares/FOLDER/lorem.txt" with width "32" and height "32" should have been changed
Examples:
| dav-path-version |
| old |
| new |


Scenario: updates to a group shared file should change the preview for both sharees and sharers
Given group "grp1" has been created
Scenario Outline: updates to a group shared file should change the preview for both sharees and sharers
Given using <dav-path-version> DAV path
And group "grp1" has been created
And user "Brian" has been created with default attributes and without skeleton files
And user "Carol" has been created with default attributes and without skeleton files
And user "Brian" has been added to group "grp1"
Expand All @@ -189,3 +286,7 @@ Feature: previews of files downloaded through the webdav API
And as user "Alice" the preview of "/FOLDER/lorem.txt" with width "32" and height "32" should have been changed
And as user "Brian" the preview of "Shares/FOLDER/lorem.txt" with width "32" and height "32" should have been changed
And as user "Carol" the preview of "Shares/FOLDER/lorem.txt" with width "32" and height "32" should have been changed
Examples:
| dav-path-version |
| old |
| new |