Skip to content

api-tests: search for favorites#2487

Open
ScharfViktor wants to merge 1 commit intomainfrom
search-favorites-test
Open

api-tests: search for favorites#2487
ScharfViktor wants to merge 1 commit intomainfrom
search-favorites-test

Conversation

@ScharfViktor
Copy link
Contributor

@ScharfViktor ScharfViktor commented Mar 16, 2026

added test for favoriteSearch.feature:

  • search by favorite files and folders in the Personal space/ project space/Shares
  • search for favorite files by name and media type in the Personal space
  • search for favorite files after unmarking a file as favorite
  • search for favorite files after deleting a file
  • search for favorite files after restoring a file
  • search for favorite files after moving a file
  • search for favorite shared files after removing the access to the shared file

added test for favorites.feature:

  • add a file to favorites after unmarking it as favorite in the personal space
  • add a file to favorites twice

@ScharfViktor
Copy link
Contributor Author

@aduffeck one test is failed due this issue:

Scenario: search for favorite shared files and folders
    Given user "Brian" has been created with default attributes
    And user "Alice" has created folder "parent"
    And user "Alice" has created folder "parent/sub"
    And user "Alice" has created folder "parent/sub/sub2"
    And user "Alice" has uploaded file with content "OpenCloud test text file" to "parent/sub/sub2/textfile.txt"
    And user "Alice" has sent the following resource share invitation:
      | resource        | parent   |        ---> trigger
      | space           | Personal |
      | sharee          | Brian    | 
      | shareType       | user     |
      | permissionsRole | Viewer   |
   And user "Alice" has sent the following resource share invitation:
      | resource        | parent/sub/sub2/textfile.txt |
      | space           | Personal                     |
      | sharee          | Brian                        |
      | shareType       | user                         |
      | permissionsRole | Viewer                       |
    And user "Brian" has a share "textfile.txt" synced
    And user "Brian" has a share "parent" synced
    And user "Brian" has marked file "textfile.txt" as favorite from space "Shares"
    When user "Brian" searches for 'is:favorite' using the WebDAV API
    Then the HTTP status code should be "207"   
    And the search result should contain "1" entries     -----> expect 1 item  but get 2
    And the search result of user "Brian" should contain these entries:
      | textfile.txt |
    But the search result of user "Brian" should not contain these entries:
      | parent |
      | sub    |
      | sub2   |
    When user "Alice" searches for 'is:favorite' using the WebDAV API
    Then the HTTP status code should be "207"
    And the search result should contain "0" entries


result: 

<d:multistatus xmlns:s="http://sabredav.org/ns" xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">
    <d:response>
        <d:href>/remote.php/dav/spaces/a0ca6a90-a365-4782-871e-d44447bbc668%210c6b6c58-6106-443d-850e-fa4b54b72b28:fd8a8c79-a110-4806-a359-04cfdf0e8b04:f5659dff-da1f-4c19-8344-9cfdfaea6c36/sub/sub2/textfile.txt</d:href>
        <d:propstat>
            <d:prop>
                <oc:fileid>0c6b6c58-6106-443d-850e-fa4b54b72b28$fd8a8c79-a110-4806-a359-04cfdf0e8b04!40a331a6-e941-4be4-ad70-9404e2948b06</oc:fileid>
                <oc:file-parent>0c6b6c58-6106-443d-850e-fa4b54b72b28$fd8a8c79-a110-4806-a359-04cfdf0e8b04!4129f716-1ea2-4f88-9964-36c2ec93e322</oc:file-parent>
                <oc:shareid>0c6b6c58-6106-443d-850e-fa4b54b72b28:fd8a8c79-a110-4806-a359-04cfdf0e8b04:f5659dff-da1f-4c19-8344-9cfdfaea6c36</oc:shareid>
                <oc:shareroot>/parent</oc:shareroot>
                <oc:remote-item-id>0c6b6c58-6106-443d-850e-fa4b54b72b28$fd8a8c79-a110-4806-a359-04cfdf0e8b04!eaeea479-f361-4ca8-b6cf-f69bf4bfafa2</oc:remote-item-id>
                <oc:name>textfile.txt</oc:name>
                <d:getlastmodified>Mon, 16 Mar 2026 15:59:40 GMT</d:getlastmodified>
                <oc:permissions>S</oc:permissions>
                <oc:highlights></oc:highlights>
                <d:getcontenttype>text/plain</d:getcontenttype>
                <oc:has-preview>1</oc:has-preview>
                <oc:tags></oc:tags>
                <d:getetag></d:getetag>
                <d:resourcetype></d:resourcetype>
                <d:getcontentlength>24</d:getcontentlength>
                <oc:score>6.549938678741455</oc:score>
                <oc:privatelink>https://localhost:9200/f/0c6b6c58-6106-443d-850e-fa4b54b72b28$fd8a8c79-a110-4806-a359-04cfdf0e8b04%2140a331a6-e941-4be4-ad70-9404e2948b06</oc:privatelink>
            </d:prop>
            <d:status>HTTP/1.1 200 OK</d:status>
        </d:propstat>
    </d:response>
    <d:response>
        <d:href>/remote.php/dav/spaces/a0ca6a90-a365-4782-871e-d44447bbc668%210c6b6c58-6106-443d-850e-fa4b54b72b28:fd8a8c79-a110-4806-a359-04cfdf0e8b04:79c2f37f-5615-461b-95e7-64944ad2e917</d:href>
        <d:propstat>
            <d:prop>
                <oc:fileid>0c6b6c58-6106-443d-850e-fa4b54b72b28$fd8a8c79-a110-4806-a359-04cfdf0e8b04!40a331a6-e941-4be4-ad70-9404e2948b06</oc:fileid>
                <oc:file-parent>0c6b6c58-6106-443d-850e-fa4b54b72b28$fd8a8c79-a110-4806-a359-04cfdf0e8b04!4129f716-1ea2-4f88-9964-36c2ec93e322</oc:file-parent>
                <oc:shareid>0c6b6c58-6106-443d-850e-fa4b54b72b28:fd8a8c79-a110-4806-a359-04cfdf0e8b04:79c2f37f-5615-461b-95e7-64944ad2e917</oc:shareid>
                <oc:shareroot>/parent/sub/sub2/textfile.txt</oc:shareroot>
                <oc:remote-item-id>0c6b6c58-6106-443d-850e-fa4b54b72b28$fd8a8c79-a110-4806-a359-04cfdf0e8b04!40a331a6-e941-4be4-ad70-9404e2948b06</oc:remote-item-id>
                <oc:name>textfile.txt</oc:name>
                <d:getlastmodified>Mon, 16 Mar 2026 15:59:40 GMT</d:getlastmodified>
                <oc:permissions>SM</oc:permissions>
                <oc:highlights></oc:highlights>
                <d:getcontenttype>text/plain</d:getcontenttype>
                <oc:has-preview>1</oc:has-preview>
                <oc:tags></oc:tags>
                <d:getetag></d:getetag>
                <d:resourcetype></d:resourcetype>
                <d:getcontentlength>24</d:getcontentlength>
                <oc:score>6.549938678741455</oc:score>
                <oc:privatelink>https://localhost:9200/f/0c6b6c58-6106-443d-850e-fa4b54b72b28$fd8a8c79-a110-4806-a359-04cfdf0e8b04%2140a331a6-e941-4be4-ad70-9404e2948b06</oc:privatelink>
            </d:prop>
            <d:status>HTTP/1.1 200 OK</d:status>
        </d:propstat>
    </d:response>
</d:multistatus>

@ScharfViktor
Copy link
Contributor Author

ScharfViktor commented Mar 16, 2026

@aduffeck one test is failed due this issue:

it's not related your change
here is bug #2488

@aduffeck
Copy link
Member

@ScharfViktor We could maybe also add tests that search within the favorite, e.g. using a search term like "foo is:favorite". Wdyt?

@ScharfViktor
Copy link
Contributor Author

@ScharfViktor We could maybe also add tests that search within the favorite, e.g. using a search term like "foo is:favorite". Wdyt?

a good proposal, thank you

@ScharfViktor ScharfViktor marked this pull request as ready for review March 17, 2026 14:18
@ScharfViktor ScharfViktor force-pushed the search-favorites-test branch from 23ce625 to 53bddee Compare March 17, 2026 14:24
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants