From f6f0e073287977f6947102a3df219b3fa734e2ae Mon Sep 17 00:00:00 2001 From: nabim777 Date: Thu, 20 Jul 2023 10:03:41 +0545 Subject: [PATCH] add api test for search files using tag in project spaces --- .../features/apiGraph/fullSearch.feature | 64 ++++++++++++++++--- .../acceptance/features/bootstrap/WebDav.php | 1 + 2 files changed, 57 insertions(+), 8 deletions(-) diff --git a/tests/acceptance/features/apiGraph/fullSearch.feature b/tests/acceptance/features/apiGraph/fullSearch.feature index 28a991d76f2..35ebb5338a2 100644 --- a/tests/acceptance/features/apiGraph/fullSearch.feature +++ b/tests/acceptance/features/apiGraph/fullSearch.feature @@ -8,20 +8,25 @@ Feature: full text search Given user "Alice" has been created with default attributes and without skeleton files - Scenario Outline: search files using a tag + Scenario Outline: search files by tag Given using DAV path - And user "Alice" has uploaded file with content "hello world" to "file1.txt" - And user "Alice" has uploaded file with content "Namaste nepal" to "file2.txt" - And user "Alice" has uploaded file with content "hello nepal" to "file3.txt" - And user "Alice" has created the following tags for file "file1.txt" of the space "Personal": + And user "Alice" has created folder "folderWithFile" + And user "Alice" has created folder "folderWithFile/subFolder/" + And user "Alice" has uploaded file with content "hello world" to "test.txt" + And user "Alice" has uploaded file with content "Namaste nepal" to "folderWithFile/fileInsideFolder.txt" + And user "Alice" has uploaded file with content "hello nepal" to "folderWithFile/subFolder/fileInsideSubFolder.txt" + And user "Alice" has created the following tags for file "test.txt" of the space "Personal": | tag1 | - And user "Alice" has created the following tags for file "file2.txt" of the space "Personal": + And user "Alice" has created the following tags for file "folderWithFile/fileInsideFolder.txt" of the space "Personal": + | tag1 | + And user "Alice" has created the following tags for file "folderWithFile/subFolder/fileInsideSubFolder.txt" of the space "Personal": | tag1 | When user "Alice" searches for "Tags:tag1" using the WebDAV API Then the HTTP status code should be "207" And the search result of user "Alice" should contain only these files: - | file1.txt | - | file2.txt | + | test.txt | + | fileInsideFolder.txt | + | fileInsideSubFolder.txt | Examples: | dav-path-version | | old | @@ -29,6 +34,49 @@ Feature: full text search | spaces | + Scenario Outline: search files by tag using new DAV path + Given using spaces DAV path + And user "Alice" has created folder "personalFolderWithFile" + And user "Alice" has created folder "personalFolderWithFile/subFolder" + And user "Alice" has uploaded file with content "tagged file" to "personalFile.txt" + And user "Alice" has uploaded file with content "non-tagged file" to "fileWithoutTag.txt" + And user "Alice" has uploaded file with content "tagged file in folder" to "personalFolderWithFile/personalFileInsideFolder.txt" + And user "Alice" has uploaded file with content "tagged file in subfolder" to "personalFolderWithFile/subFolder/personalFileInsideSubFolder.txt" + And user "Alice" has created the following tags for file "personalFile.txt" of the space "Personal": + | tag1 | + And user "Alice" has created the following tags for file "personalFolderWithFile/personalFileInsideFolder.txt" of the space "Personal": + | tag1 | + And user "Alice" has created the following tags for file "personalFolderWithFile/subFolder/personalFileInsideSubFolder.txt" of the space "Personal": + | tag1 | + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "tag-space" with the default quota using the GraphApi + And user "Alice" has created a folder "spacesFolderWithFile/spacesSubFolder" in space "tag-space" + And user "Alice" has uploaded a file inside space "tag-space" with content "tagged file" to "spacesFile.txt" + And user "Alice" has uploaded a file inside space "tag-space" with content "non-tagged file" to "spacesFileWithoutTag.txt" + And user "Alice" has uploaded a file inside space "tag-space" with content "tagged file in folder" to "spacesFolderWithFile/spacesFileInsideFolder.txt" + And user "Alice" has uploaded a file inside space "tag-space" with content "tagged file in subfolder" to "spacesFolderWithFile/spacesSubFolder/spacesFileInsideSubFolder.txt" + And user "Alice" has created the following tags for file "spacesFile.txt" of the space "tag-space": + | tag1 | + And user "Alice" has created the following tags for file "spacesFolderWithFile/spacesFileInsideFolder.txt" of the space "tag-space": + | tag1 | + And user "Alice" has created the following tags for file "spacesFolderWithFile/spacesSubFolder/spacesFileInsideSubFolder.txt" of the space "tag-space": + | tag1 | + And using DAV path + When user "Alice" searches for "Tags:tag1" using the WebDAV API + Then the HTTP status code should be "207" + And the search result of user "Alice" should contain only these files: + | personalFile.txt | + | personalFileInsideFolder.txt | + | personalFileInsideSubFolder.txt | + | spacesFile.txt | + | spacesFileInsideFolder.txt | + | spacesFileInsideSubFolder.txt | + Examples: + | dav-path-version | + | old | + | new | + + Scenario Outline: search folders using a tag Given using DAV path And user "Alice" has created folder "uploadFolder1" diff --git a/tests/acceptance/features/bootstrap/WebDav.php b/tests/acceptance/features/bootstrap/WebDav.php index 5088a8ef5f5..6f3f43a89ab 100644 --- a/tests/acceptance/features/bootstrap/WebDav.php +++ b/tests/acceptance/features/bootstrap/WebDav.php @@ -259,6 +259,7 @@ public function usingOldDavPath():void { $this->davPath = $this->getOldDavPath(); $this->usingOldDavPath = true; $this->customDavPath = null; + $this->usingSpacesDavPath = false; } /**