From 14888f3b7c44f27d7b0835c3c516d8fae4f5437b Mon Sep 17 00:00:00 2001 From: Prarup Gurung Date: Tue, 6 Feb 2024 12:13:54 +0545 Subject: [PATCH 1/3] Added tests to lists file shared with them when sync is disabled --- tests/acceptance/config/behat.yml | 1 + .../apiSharingNg/sharedWithMe.feature | 268 ++++++++++++++++++ .../features/bootstrap/SettingsContext.php | 1 + 3 files changed, 270 insertions(+) diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml index 0420c0ff50f..d052318703a 100644 --- a/tests/acceptance/config/behat.yml +++ b/tests/acceptance/config/behat.yml @@ -316,6 +316,7 @@ default: - SharingNgContext: - PublicWebDavContext: - OcisConfigContext: + - SettingsContext: extensions: rdx\behatvars\BehatVariablesExtension: ~ diff --git a/tests/acceptance/features/apiSharingNg/sharedWithMe.feature b/tests/acceptance/features/apiSharingNg/sharedWithMe.feature index 82b8a2ee072..d5741e2e5ca 100644 --- a/tests/acceptance/features/apiSharingNg/sharedWithMe.feature +++ b/tests/acceptance/features/apiSharingNg/sharedWithMe.feature @@ -593,3 +593,271 @@ Feature: an user gets the resources shared to them } } """ + + + Scenario: user lists the file shared with them when sync is disabled + Given user "Alice" has uploaded file with content "to share" to "textfile.txt" + And user "Brian" has disabled sync + And user "Alice" has sent the following share invitation: + | resource | textfile.txt | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + When user "Brian" lists the shares shared with him using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "value" + ], + "properties": { + "value": { + "type": "array", + "items": { + "type": "object", + "required": [ + "@UI.Hidden", + "@client.synchronize", + "createdBy", + "eTag", + "file", + "id", + "lastModifiedDateTime", + "name", + "parentReference", + "remoteItem", + "size" + ], + "properties": { + "@UI.Hidden": { + "type": "boolean", + "enum": [false] + }, + "@client.synchronize": { + "type": "boolean", + "enum": [false] + }, + "createdBy": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "type": "string", + "enum": ["Alice Hansen"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + } + } + } + } + }, + "eTag": { + "type": "string", + "pattern": "%etag_pattern%" + }, + "file": { + "type": "object", + "required": ["mimeType"], + "properties": { + "mimeType": { + "type": "string", + "enum": ["text/plain"] + } + } + }, + "id": { + "type": "string", + "pattern": "^%share_id_pattern%$" + }, + "name": { + "type": "string", + "enum": ["textfile.txt"] + }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType", "id"], + "properties": { + "driveId": { + "type": "string", + "pattern": "^%space_id_pattern%$" + }, + "driveType": { + "type": "string", + "enum": ["virtual"] + }, + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + } + } + }, + "remoteItem": { + "type": "object", + "required": [ + "createdBy", + "eTag", + "file", + "id", + "lastModifiedDateTime", + "name", + "parentReference", + "permissions", + "size" + ], + "properties": { + "createdBy": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName","id"], + "properties": { + "displayName": { + "type": "string", + "enum": ["Alice Hansen"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + } + } + } + } + }, + "eTag": { + "type": "string", + "pattern": "%etag_pattern%" + }, + "file": { + "type": "object", + "required": ["mimeType"], + "properties": { + "mimeType": { + "type": "string", + "enum": ["text/plain"] + } + } + }, + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "name": { + "type": "string", + "enum": ["textfile.txt"] + }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType"], + "properties": { + "driveId": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "driveType": { + "type": "string", + "enum": ["personal"] + } + } + }, + "permissions": { + "type": "array", + "items": [ + { + "type": "object", + "required": [ + "grantedToV2", + "id", + "invitation", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "type": "string", + "enum": ["Brian Murphy"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + } + } + } + } + } + }, + "id": { + "type": "string", + "pattern": "^%permissions_id_pattern%$" + }, + "invitation": { + "type": "object", + "required": ["invitedBy"], + "properties": { + "invitedBy": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "type": "string", + "enum": ["Alice Hansen"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + } + } + } + } + } + } + }, + "roles": { + "type": "array", + "items": [ + { + "type": "string", + "pattern": "^%role_id_pattern%$" + } + ] + } + } + ] + }, + "size": { + "type": "number", + "enum": [8] + } + } + }, + "size": { + "type": "number", + "enum": [8] + } + } + } + } + } + } + """ diff --git a/tests/acceptance/features/bootstrap/SettingsContext.php b/tests/acceptance/features/bootstrap/SettingsContext.php index 90d31ef4fec..fefdf8f9276 100644 --- a/tests/acceptance/features/bootstrap/SettingsContext.php +++ b/tests/acceptance/features/bootstrap/SettingsContext.php @@ -523,6 +523,7 @@ public function sendRequestToDisableAutoAccepting(string $user): ResponseInterfa /** * @Given user :user has disabled auto-accepting + * @Given user :user has disabled sync * * @param string $user * From 9bb711acb9c7b7f3c0009e63fa884ec299a32aae Mon Sep 17 00:00:00 2001 From: Prarup Gurung Date: Tue, 6 Feb 2024 12:42:09 +0545 Subject: [PATCH 2/3] Added tests to lists folder shared with them when sync is disabled --- .../apiSharingNg/sharedWithMe.feature | 238 ++++++++++++++++++ 1 file changed, 238 insertions(+) diff --git a/tests/acceptance/features/apiSharingNg/sharedWithMe.feature b/tests/acceptance/features/apiSharingNg/sharedWithMe.feature index d5741e2e5ca..53c6b74a5d4 100644 --- a/tests/acceptance/features/apiSharingNg/sharedWithMe.feature +++ b/tests/acceptance/features/apiSharingNg/sharedWithMe.feature @@ -861,3 +861,241 @@ Feature: an user gets the resources shared to them } } """ + + + Scenario: user lists the folder shared with them when sync is disabled + Given user "Alice" has created folder "folderToShare" + And user "Brian" has disabled sync + And user "Alice" has sent the following share invitation: + | resource | folderToShare | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + When user "Brian" lists the shares shared with him using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "value" + ], + "properties": { + "value": { + "type": "array", + "items": { + "type": "object", + "required": [ + "@UI.Hidden", + "@client.synchronize", + "createdBy", + "eTag", + "folder", + "id", + "lastModifiedDateTime", + "name", + "parentReference", + "remoteItem" + ], + "properties": { + "@UI.Hidden": { + "type": "boolean", + "enum": [false] + }, + "@client.synchronize": { + "type": "boolean", + "enum": [false] + }, + "createdBy": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "type": "string", + "enum": ["Alice Hansen"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + } + } + } + } + }, + "eTag": { + "type": "string", + "pattern": "%etag_pattern%" + }, + "id": { + "type": "string", + "pattern": "^%share_id_pattern%$" + }, + "name": { + "type": "string", + "enum": ["folderToShare"] + }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType", "id"], + "properties": { + "driveId": { + "type": "string", + "pattern": "^%space_id_pattern%$" + }, + "driveType": { + "type": "string", + "enum": ["virtual"] + }, + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + } + } + }, + "remoteItem": { + "type": "object", + "required": [ + "createdBy", + "eTag", + "folder", + "id", + "lastModifiedDateTime", + "name", + "parentReference", + "permissions" + ], + "properties": { + "createdBy": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName","id"], + "properties": { + "displayName": { + "type": "string", + "enum": ["Alice Hansen"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + } + } + } + } + }, + "eTag": { + "type": "string", + "pattern": "%etag_pattern%" + }, + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "name": { + "type": "string", + "enum": ["folderToShare"] + }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType"], + "properties": { + "driveId": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "driveType": { + "type": "string", + "enum": ["personal"] + } + } + }, + "permissions": { + "type": "array", + "items": [ + { + "type": "object", + "required": [ + "grantedToV2", + "id", + "invitation", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "type": "string", + "enum": ["Brian Murphy"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + } + } + } + } + } + }, + "id": { + "type": "string", + "pattern": "^%permissions_id_pattern%$" + }, + "invitation": { + "type": "object", + "required": ["invitedBy"], + "properties": { + "invitedBy": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "type": "string", + "enum": ["Alice Hansen"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + } + } + } + } + } + } + }, + "roles": { + "type": "array", + "items": [ + { + "type": "string", + "pattern": "^%role_id_pattern%$" + } + ] + } + } + ] + } + } + } + } + } + } + } + } + """ From f7eb4db082e5ecb53cf87a7cbdd911efe37dad1f Mon Sep 17 00:00:00 2001 From: Prarup Gurung Date: Tue, 6 Feb 2024 14:36:45 +0545 Subject: [PATCH 3/3] Addressed reviews --- .../acceptance/features/apiSharingNg/sharedWithMe.feature | 8 ++++---- tests/acceptance/features/bootstrap/SettingsContext.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/acceptance/features/apiSharingNg/sharedWithMe.feature b/tests/acceptance/features/apiSharingNg/sharedWithMe.feature index 53c6b74a5d4..c4d24948791 100644 --- a/tests/acceptance/features/apiSharingNg/sharedWithMe.feature +++ b/tests/acceptance/features/apiSharingNg/sharedWithMe.feature @@ -595,9 +595,9 @@ Feature: an user gets the resources shared to them """ - Scenario: user lists the file shared with them when sync is disabled + Scenario: user lists the file shared with them when auto-sync is disabled Given user "Alice" has uploaded file with content "to share" to "textfile.txt" - And user "Brian" has disabled sync + And user "Brian" has disabled the auto-sync share And user "Alice" has sent the following share invitation: | resource | textfile.txt | | space | Personal | @@ -863,9 +863,9 @@ Feature: an user gets the resources shared to them """ - Scenario: user lists the folder shared with them when sync is disabled + Scenario: user lists the folder shared with them when auto-sync is disabled Given user "Alice" has created folder "folderToShare" - And user "Brian" has disabled sync + And user "Brian" has disabled the auto-sync share And user "Alice" has sent the following share invitation: | resource | folderToShare | | space | Personal | diff --git a/tests/acceptance/features/bootstrap/SettingsContext.php b/tests/acceptance/features/bootstrap/SettingsContext.php index fefdf8f9276..c099a131b2e 100644 --- a/tests/acceptance/features/bootstrap/SettingsContext.php +++ b/tests/acceptance/features/bootstrap/SettingsContext.php @@ -523,7 +523,7 @@ public function sendRequestToDisableAutoAccepting(string $user): ResponseInterfa /** * @Given user :user has disabled auto-accepting - * @Given user :user has disabled sync + * @Given user :user has disabled the auto-sync share * * @param string $user *