Skip to content

Commit

Permalink
add api test for search files using tag in project spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
nabim777 committed Aug 4, 2023
1 parent 43ee37d commit ad808ee
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tests/TestHelpers/WebDavHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ public static function getDavPath(
if ($type === "trash-bin") {
return "/remote.php/dav/spaces/trash-bin/" . $spaceId . '/';
}
return "dav/spaces/" . $spaceId . '/';
return "/remote.php/dav/spaces/" . $spaceId . '/';
} else {
if ($davPathVersionToUse === self::DAV_VERSION_OLD) {
if ($type === "trash-bin") {
Expand Down
55 changes: 47 additions & 8 deletions tests/acceptance/features/apiGraph/fullSearch.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,58 @@ 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-version> 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 the following folders
| path |
| folderWithFile |
| folderWithFile/subFolder/ |
And user "Alice" has uploaded the following files with content "some data"
| path |
| fileInRootLevel.txt |
| folderWithFile/fileInsideFolder.txt |
| folderWithFile/subFolder/fileInsideSubFolder.txt |
And user "Alice" has created the following tags for file "fileInRootLevel.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 |
| fileInRootLevel.txt |
| fileInsideFolder.txt |
| fileInsideSubFolder.txt |
Examples:
| dav-path-version |
| old |
| new |
| spaces |


Scenario Outline: search project space files by tag
Given using spaces DAV path
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 "untagged 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-version> 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:
| spacesFile.txt |
| spacesFileInsideFolder.txt |
| spacesFileInsideSubFolder.txt |
Examples:
| dav-path-version |
| old |
Expand Down Expand Up @@ -72,6 +110,7 @@ Feature: full text search
| dav-path-version |
| old |
| new |
| spaces |


Scenario Outline: search files using a deleted tag
Expand Down
1 change: 1 addition & 0 deletions tests/acceptance/features/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ public function usingOldDavPath():void {
$this->davPath = $this->getOldDavPath();
$this->usingOldDavPath = true;
$this->customDavPath = null;
$this->usingSpacesDavPath = false;
}

/**
Expand Down

0 comments on commit ad808ee

Please sign in to comment.