From d5fb570d3a05ae8c813130b33729975998d4b6cc Mon Sep 17 00:00:00 2001 From: Kiran Parajuli Date: Mon, 22 Aug 2022 11:55:10 +0545 Subject: [PATCH] Update expected to failures to include more incoming tests Signed-off-by: Kiran Parajuli --- .drone.env | 2 +- .../expected-failures-API-on-OCIS-storage.md | 23 ++------- ...ected-failures-localAPI-on-OCIS-storage.md | 4 ++ .../apiSpaces/changingFilesShare.feature | 23 ++------- .../features/bootstrap/SpacesContext.php | 49 +++++++------------ 5 files changed, 32 insertions(+), 69 deletions(-) diff --git a/.drone.env b/.drone.env index 0c394ff4935..bf41b89dff6 100644 --- a/.drone.env +++ b/.drone.env @@ -1,5 +1,5 @@ # The test runner source for API tests -CORE_COMMITID=809f7256bdea4cd3dee45dfd5cd078542f4c55cf +CORE_COMMITID=f79fbff0a0d129df7b6ec20bc202665c4fda5fad CORE_BRANCH=master # The test runner source for UI tests diff --git a/tests/acceptance/expected-failures-API-on-OCIS-storage.md b/tests/acceptance/expected-failures-API-on-OCIS-storage.md index d379bcbc63c..d697781f841 100644 --- a/tests/acceptance/expected-failures-API-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-API-on-OCIS-storage.md @@ -447,12 +447,6 @@ File and sync features in a shared scenario - [apiShareManagementToShares/mergeShare.feature:105](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareManagementToShares/mergeShare.feature#L105) -#### [not possible to move file into a received folder](https://github.com/owncloud/ocis/issues/764) - -- [apiShareManagementBasicToShares/createShareToSharesFolder.feature:500](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareManagementBasicToShares/createShareToSharesFolder.feature#L500) -- [apiSpaces/changingFilesShare.feature:12](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSpaces/changingFilesShare.feature#L12) -- [apiSpaces/changingFilesShare.feature:67](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSpaces/changingFilesShare.feature#L67) - #### [File deletion using dav gives unique string in filename in the trashbin](https://github.com/owncloud/product/issues/178) - [apiShareManagementBasicToShares/deleteShareFromShares.feature:67](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareManagementBasicToShares/deleteShareFromShares.feature#L67) @@ -587,18 +581,13 @@ cannot share a folder with create permission - [apiShareOperationsToShares2/uploadToShare.feature:211](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares2/uploadToShare.feature#L211) #### [not possible to move file into a received folder](https://github.com/owncloud/ocis/issues/764) - +- [apiShareManagementBasicToShares/createShareToSharesFolder.feature:500](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareManagementBasicToShares/createShareToSharesFolder.feature#L500) - [apiShareOperationsToShares1/changingFilesShare.feature:25](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L25) - [apiShareOperationsToShares1/changingFilesShare.feature:26](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L26) -- [apiShareOperationsToShares1/changingFilesShare.feature:31](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L31) -- [apiShareOperationsToShares1/changingFilesShare.feature:119](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L119) -- [apiShareOperationsToShares1/changingFilesShare.feature:120](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L120) -- [apiShareOperationsToShares1/changingFilesShare.feature:125](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L125) -- [apiShareOperationsToShares1/changingFilesShare.feature:146](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L146) -- [apiShareOperationsToShares1/changingFilesShare.feature:147](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L147) -- [apiShareOperationsToShares1/changingFilesShare.feature:152](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L152) -- [apiVersions/fileVersionsSharingToShares.feature:220](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersionsSharingToShares.feature#L220) -- [apiVersions/fileVersionsSharingToShares.feature:221](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersionsSharingToShares.feature#L221) +- [apiShareOperationsToShares1/changingFilesShare.feature:110](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L110) +- [apiShareOperationsToShares1/changingFilesShare.feature:111](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L111) +- [apiShareOperationsToShares1/changingFilesShare.feature:131](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L131) +- [apiShareOperationsToShares1/changingFilesShare.feature:132](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L132) Scenario Outline: Moving a file into a shared folder as the sharee and as the sharer @@ -970,8 +959,6 @@ And other missing implementation of favorites - [apiWebdavLocks2/setTimeoutSharesToShares.feature:82](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L82) - [apiWebdavLocks2/setTimeoutSharesToShares.feature:83](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L83) - [apiWebdavLocks2/setTimeoutSharesToShares.feature:84](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/setTimeoutSharesToShares.feature#L84) -- [apiShareOperationsToShares1/changingFilesShare.feature:98](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L98) -- [apiShareOperationsToShares1/changingFilesShare.feature:173](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/changingFilesShare.feature#L173) - [apiWebdavMove2/moveShareOnOcis.feature:38](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove2/moveShareOnOcis.feature#L38) - [apiWebdavMove2/moveShareOnOcis.feature:39](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove2/moveShareOnOcis.feature#L39) - [apiWebdavMove2/moveShareOnOcis.feature:68](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove2/moveShareOnOcis.feature#L68) diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md index a636c8ba43b..e6fdc690c2d 100644 --- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md @@ -21,3 +21,7 @@ The expected failures in this file are from features in the owncloud/ocis repo. ### [Search by shares jail works incorrect](https://github.com/owncloud/ocis/issues/4014) - [apiSpaces/search.feature:43](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/search.feature#L43) + +#### [not possible to move file into a received folder](https://github.com/owncloud/ocis/issues/764) +- [apiSpaces/changingFilesShare.feature:33](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/changingFilesShare.feature#L33) +- [apiSpaces/changingFilesShare.feature:54](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/changingFilesShare.feature#L54) diff --git a/tests/acceptance/features/apiSpaces/changingFilesShare.feature b/tests/acceptance/features/apiSpaces/changingFilesShare.feature index 782c4861ebb..723125a8ad7 100644 --- a/tests/acceptance/features/apiSpaces/changingFilesShare.feature +++ b/tests/acceptance/features/apiSpaces/changingFilesShare.feature @@ -2,24 +2,11 @@ Feature: Background: - Given these users have been created with default attributes and without skeleton files: + Given using spaces DAV path + And these users have been created with default attributes and without skeleton files: | username | | Alice | | Brian | - And using spaces DAV path - - @issue-764 - Scenario: Moving a file into a share as recipient - Given user "Alice" has created folder "/shared" - And user "Alice" has shared folder "/shared" with user "Brian" - And user "Brian" has accepted share "/shared" offered by user "Alice" - And user "Brian" has uploaded file with content "some data" to "/textfile0.txt" - When user "Brian" moves file "textfile0.txt" from space "Personal" to "shared/shared_file.txt" inside space "Shares Jail" using the WebDAV API - Then the HTTP status code should be "201" - And for user "Brian" folder "shared" of the space "Shares Jail" should contain these entries: - | shared_file.txt | - And for user "Alice" the space "Personal" should contain these entries: - | shared_file.txt | Scenario: Moving files between shares by same user @@ -63,7 +50,7 @@ Feature: And for user "Alice" the space "Personal" should contain these entries: | share2/shared_file.txt | - @issue-4421 + @issue-764 @issue-4421 Scenario: Move files between shares by different users Given user "Carol" has been created with default attributes and without skeleton files And user "Alice" has uploaded file with content "some data" to "/textfile0.txt" @@ -93,5 +80,5 @@ Feature: Then the HTTP status code should be "204" And for user "Brian" the space "Shares Jail" should contain these entries: | textfile1.txt | - And the content of file "textfile1.txt" inside space "Shares Jail" for user "Brian" should be "this is a new content" - And the content of file "textfile1.txt" inside space "Personal" for user "Alice" should be "this is a new content" + And for user "Brian" the content of the file "/textfile1.txt" of the space "Shares Jail" should be "this is a new content" + And for user "Alice" the content of the file "/textfile1.txt" of the space "Personal" should be "this is a new content" diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index 86778f9780f..14ed154c35d 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -1342,6 +1342,20 @@ public function verifyTableNodeColumnsCount( } } + /** + * Escapes the given string for + * 1. Space --> %20 + * 2. Opening Small Bracket --> %28 + * 3. Closing Small Bracket --> %29 + * + * @param string $path - File path to parse + * + * @return string + */ + public function escapePath(string $path): string { + return \str_replace([" ", "(", ")"], ["%20", "%28", "%29"], $path); + } + /** * parses a PROPFIND response from $this->response into xml * and returns found search results if found else returns false @@ -1372,7 +1386,7 @@ public function findEntryFromPropfindResponse( $trimmedEntryNameToSearch = \trim($entryNameToSearch, "/"); // url encode for spaces and brackets that may appear in the filePath - $folderPath = \str_replace([" ", "(", ")"], ["%20", "%28", "%29"], $folderPath); + $folderPath = $this->escapePath($folderPath); // topWebDavPath should be something like /remote.php/webdav/ or // /remote.php/dav/files/alice/ @@ -1864,8 +1878,7 @@ public function userMovesFileWithinSpaceUsingTheWebDAVAPI( $spaceName ); - $fileSource = \trim($fileSource, "/"); - $fileSource = \str_replace([" ", "(", ")"], ["%20", "%28", "%29"], $fileSource); + $fileSource = $this->escapePath(\trim($fileSource, "/")); $fullUrl = $space["root"]["webDavUrl"] . '/' . $fileSource; $this->moveFilesAndFoldersRequest($user, $fullUrl, $headers); } @@ -1990,8 +2003,7 @@ public function userMovesFileFromAndToSpaceBetweenSpaces( public function destinationHeaderValueWithSpaceName(string $user, string $fileDestination, string $spaceName):string { $space = $this->getSpaceByName($user, $spaceName); - $fileDestination = \ltrim($fileDestination, "/"); - $fileDestination = \str_replace([" ", "(", ")"], ["%20", "%28", "%29"], $fileDestination); + $fileDestination = $this->escapePath(\ltrim($fileDestination, "/")); return $space["root"]["webDavUrl"] . '/' . $fileDestination; } @@ -3186,31 +3198,4 @@ public function asUserFileInsideSpaceShouldContainAPropertyWithValue( $expectedValue ); } - - /** - * @Given /^the content of file "([^"]*)" inside space "([^"]*)" for user "([^"]*)" should be "([^"]*)"$/ - * @throws GuzzleException - */ - public function theContentOfFileInsideSpaceForUserShouldBe($fileSource, $spaceName, $user, $expectedContent) { - $user = $this->featureContext->getActualUsername($user); - $space = $this->getSpaceByName($user, $spaceName); - $fullUrl = $space["root"]["webDavUrl"] . '/' . ltrim($fileSource, "/"); - $this->featureContext->setResponse( - HttpRequestHelper::get( - $fullUrl, - $this->featureContext->getStepLineRef(), - $user, - $this->featureContext->getPasswordForUser($user), - ) - ); - $this->featureContext->theHttpStatusCodeShouldBe(200); - $actualContent = (string) $this->featureContext->getResponse()->getBody(); - Assert::assertEquals( - $expectedContent, - $actualContent, - __METHOD__ . " Downloaded content mis-match for resource at '$fileSource' inside space '$spaceName'" . - "\n- Expected content: $expectedContent" . - "\n+ Actual content: $actualContent" - ); - } }