diff --git a/tests/acceptance/features/apiGraph/fullSearch.feature b/tests/acceptance/features/apiGraph/fullSearch.feature index 28a991d76f2..cfc8dc78ef1 100644 --- a/tests/acceptance/features/apiGraph/fullSearch.feature +++ b/tests/acceptance/features/apiGraph/fullSearch.feature @@ -108,3 +108,22 @@ Feature: full text search | old | | new | | spaces | + + + Scenario Outline: search files inside the current folder + Given using DAV path + And user "Alice" has uploaded file with content "hello world inside root" to "file1.txt" + And user "Alice" has created folder "/Folder" + And user "Alice" has uploaded file with content "hello world inside Folder" to "/Folder/file2.txt" + And user "Alice" has created folder "/Folder/SubFolder" + And user "Alice" has uploaded file with content "hello world inside SubFolder" to "/Folder/SubFolder/file3.txt" + When user "Alice" searches for "file" inside "/Folder" using the WebDAV API + Then the HTTP status code should be "207" + And the search result of user "Alice" should contain only these entries: + | file2.txt | + | file3.txt | + Examples: + | dav-path-version | + | old | + | new | + | spaces | diff --git a/tests/acceptance/features/bootstrap/SearchContext.php b/tests/acceptance/features/bootstrap/SearchContext.php index a7ba04a84ad..82591e1c713 100644 --- a/tests/acceptance/features/bootstrap/SearchContext.php +++ b/tests/acceptance/features/bootstrap/SearchContext.php @@ -39,10 +39,12 @@ class SearchContext implements Context { * @When user :user searches for :pattern and limits the results to :limit items using the WebDAV API * @When user :user searches for :pattern using the WebDAV API requesting these properties: * @When user :user searches for :pattern and limits the results to :limit items using the WebDAV API requesting these properties: + * @When user :user searches for :pattern inside :scope using the WebDAV API * * @param string $user * @param string $pattern * @param string|null $limit + * @param string|null $scope * @param TableNode|null $properties * * @return void @@ -51,6 +53,7 @@ public function userSearchesUsingWebDavAPI( string $user, string $pattern, ?string $limit = null, + ?string $scope = null, TableNode $properties = null ):void { // Because indexing of newly uploaded files or directories with ocis is decoupled and occurs asynchronously, a short wait is necessary before searching files or folders. @@ -62,8 +65,13 @@ public function userSearchesUsingWebDavAPI( $body = "\n" . " \n" . - " \n" . - " $pattern\n"; + " \n"; + if ($scope !== null) { + $user_id = $this->featureContext->getUserIdByUserName($user); + $body .= " *$pattern* scope:$user_id$scope\n"; + } else { + $body .= " $pattern\n"; + } if ($limit !== null) { $body .= " $limit\n"; }