diff --git a/tests/acceptance/bootstrap/SharingNgContext.php b/tests/acceptance/bootstrap/SharingNgContext.php index 929920acbec..c7e1d19ee77 100644 --- a/tests/acceptance/bootstrap/SharingNgContext.php +++ b/tests/acceptance/bootstrap/SharingNgContext.php @@ -1229,14 +1229,24 @@ class SharingNgContext implements Context { * @param string $sharee * @param string $shareID * @param bool $hide + * @param bool $federatedShare * * @return ResponseInterface * @throws GuzzleException * @throws JsonException */ - public function hideOrUnhideSharedResource(string $sharee, string $shareID, bool $hide = true): ResponseInterface { + public function hideOrUnhideSharedResource( + string $sharee, + string $shareID, + bool $hide = true, + bool $federatedShare = false + ): ResponseInterface { $shareSpaceId = GraphHelper::SHARES_SPACE_ID; - $itemId = $shareSpaceId . '!' . $shareID; + if ($federatedShare) { + $itemId = $shareID; + } else { + $itemId = $shareSpaceId . '!' . $shareID; + } $body['@UI.Hidden'] = $hide; return GraphHelper::hideOrUnhideShare( $this->featureContext->getBaseUrl(), @@ -1318,6 +1328,22 @@ class SharingNgContext implements Context { $this->featureContext->setResponse($response); } + /** + * @When user :user hides the federated share :share using the Graph API + * + * @param string $user + * @param string $share + * + * @return void + * @throws Exception + * @throws GuzzleException + */ + public function userHidesTheFederatedShareUsingTheGraphApi(string $user, string $share): void { + $remoteItemId = $this->spacesContext->getSharesRemoteItemId($user, $share); + $response = $this->hideOrUnhideSharedResource($user, $remoteItemId, true, true); + $this->featureContext->setResponse($response); + } + /** * @Given user :user has hidden the share :sharedResource * diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md index 51fecc17897..1cfe5af8ee7 100644 --- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md @@ -332,5 +332,9 @@ The expected failures in this file are from features in the owncloud/ocis repo. - [apiOcm/share.feature:1154](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiOcm/share.feature#L1154) - [apiOcm/share.feature:1174](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiOcm/share.feature#L1174) +#### [[OCM] Hide & Enable Sync fail with received federated shares](https://github.com/owncloud/ocis/issues/10719) +- [apiOcm/share.feature:1194](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiOcm/share.feature#L1194) +- [apiOcm/share.feature:1218](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiOcm/share.feature#L1218) + Note: always have an empty line at the end of this file. The bash script that processes this file requires that the last line has a newline on the end. diff --git a/tests/acceptance/features/apiOcm/share.feature b/tests/acceptance/features/apiOcm/share.feature index 564ae02169a..3e4ef70f5ad 100755 --- a/tests/acceptance/features/apiOcm/share.feature +++ b/tests/acceptance/features/apiOcm/share.feature @@ -1189,3 +1189,51 @@ Feature: an user shares resources using ScienceMesh application And user "Brian" should not have a federated share "folderToShare" shared by user "Alice" from space "Personal" And using server "LOCAL" And as "Alice" file "folderToShare/file.txt" should not exist + + @issue-10719 + Scenario: federated user hides the file shared by local user + Given using server "LOCAL" + And user "Alice" has uploaded file with content "hello world" to "testfile.txt" + And user "Alice" has sent the following resource share invitation to federated user: + | resource | testfile.txt | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + And using server "REMOTE" + When user "Brian" hides the federated share "testfile.txt" using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": ["@UI.Hidden"], + "properties": { + "@UI.Hidden": { "const": true } + } + } + """ + + @issue-10719 + Scenario: federated user hides the folder shared by local user + Given using server "LOCAL" + And user "Alice" has created folder "folderToShare" + And user "Alice" has sent the following resource share invitation to federated user: + | resource | folderToShare | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + And using server "REMOTE" + When user "Brian" hides the federated share "folderToShare" using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": ["@UI.Hidden"], + "properties": { + "@UI.Hidden": { "const": true } + } + } + """