diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md index ff27fa8edcf..5330a6acb7f 100644 --- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md @@ -34,3 +34,6 @@ The expected failures in this file are from features in the owncloud/ocis repo. ### [copy to overwrite (file and folder) from Personal to Shares Jail behaves differently](https://github.com/owncloud/ocis/issues/4393) - [apiSpaces/copySpaces.feature:487](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/copySpaces.feature#L487) - [apiSpaces/copySpaces.feature:501](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/copySpaces.feature#L501) + +### [search doesn't find the project space by name](https://github.com/owncloud/ocis/issues/4506) +- [apiSpaces/search.feature:95](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/search.feature#L95) diff --git a/tests/acceptance/features/apiSpaces/search.feature b/tests/acceptance/features/apiSpaces/search.feature index da8daf06298..ade0b35c12f 100644 --- a/tests/acceptance/features/apiSpaces/search.feature +++ b/tests/acceptance/features/apiSpaces/search.feature @@ -50,3 +50,51 @@ Feature: Search | /SubFolder1 | | /SubFolder1/subFOLDER2 | | /SubFolder1/subFOLDER2/insideTheFolder.txt | + And for user "Brian" the search result should contain space "mountpoint/folder" + + + Scenario: User can find hidden file + Given user "Alice" has created a folder ".space" in space "find data" + When user "Alice" searches for ".sp" using the WebDAV API + Then the HTTP status code should be "207" + And the search result should contain "1" entries + And the search result of user "Alice" should contain these entries: + | /.space | + + + Scenario: User cannot find pending folder + Given user "Alice" shares the following entity "folder" inside of space "find data" with user "Brian" with role "viewer" + When user "Brian" searches for "folder" using the WebDAV API + Then the HTTP status code should be "207" + And the search result should contain "0" entries + And the search result of user "Brian" should not contain these entries: + | /SubFolder1 | + | /SubFolder1/subFOLDER2 | + | /SubFolder1/subFOLDER2/insideTheFolder.txt | + + + Scenario: User cannot find declined folder + Given user "Alice" shares the following entity "folder" inside of space "find data" with user "Brian" with role "viewer" + And user "Brian" has declined share "/folder" offered by user "Alice" + When user "Brian" searches for "folder" using the WebDAV API + Then the HTTP status code should be "207" + And the search result should contain "0" entries + And the search result of user "Brian" should not contain these entries: + | /SubFolder1 | + | /SubFolder1/subFOLDER2 | + | /SubFolder1/subFOLDER2/insideTheFolder.txt | + + + Scenario: User cannot find deleted folder + Given user "Alice" has removed the folder "folder" from space "find data" + When user "Alice" searches for "folder" using the WebDAV API + Then the HTTP status code should be "207" + And the search result should contain "0" entries + + + Scenario: User can find project space by name + When user "Alice" searches for "find data" using the WebDAV API + Then the HTTP status code should be "207" + And the search result should contain "1" entries + And for user "Alice" the search result should contain space "find data" + diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index 47eb867fa9e..61bcfa885cf 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -3211,4 +3211,38 @@ class SpacesContext implements Context { $this->setSpaceIDByName($user, $spaceName); $this->featureContext->userFileShouldHaveStoredId($user, $fileOrFolder, $path); } + + /** + * @Then /^for user "([^"]*)" the search result should contain space "([^"]*)"$/ + * + * @param string $user + * @param string $spaceName + * + * @return void + * @throws GuzzleException + */ + public function searchResultShouldContainSpace(string $user, string $spaceName): void { + // get a response after a Report request (called in the core) + $responseArray = json_decode(json_encode($this->featureContext->getResponseXml()->xpath("//d:response/d:href")), true, 512, JSON_THROW_ON_ERROR); + Assert::assertNotEmpty($responseArray, "search result is empty"); + + // for mountpoint, id looks a little different than for project space + if (str_contains($spaceName, 'mountpoint')) { + $splitSpaceName = explode("/", $spaceName); + $space = $this->getSpaceByName($user, $splitSpaceName[1]); + $splitSpaceId = explode("$", $space['id']); + $topWebDavPath = "/remote.php/dav/spaces/" . str_replace('!', '%21', $splitSpaceId[1]); + } else { + $space = $this->getSpaceByName($user, $spaceName); + $topWebDavPath = "/remote.php/dav/spaces/" . $space['id']; + } + + $spaceFound = false; + foreach ($responseArray as $value) { + if ($topWebDavPath === $value[0]) { + $spaceFound = true; + } + } + Assert::assertTrue($spaceFound, "response does not contain the space '$spaceName'"); + } }