From 51065ac85ac81c849790410abef3b7e43e73e4c5 Mon Sep 17 00:00:00 2001 From: Prarup Gurung Date: Wed, 14 Feb 2024 12:29:22 +0545 Subject: [PATCH 1/5] Added tests to lists file shared with group and user when sync is disabled --- .../sharedWithMeSyncDisabled.feature | 142 ++++++++++++++++++ 1 file changed, 142 insertions(+) diff --git a/tests/acceptance/features/apiSharingNg/sharedWithMeSyncDisabled.feature b/tests/acceptance/features/apiSharingNg/sharedWithMeSyncDisabled.feature index 5ffa99b394..b6510c1b1e 100644 --- a/tests/acceptance/features/apiSharingNg/sharedWithMeSyncDisabled.feature +++ b/tests/acceptance/features/apiSharingNg/sharedWithMeSyncDisabled.feature @@ -1922,3 +1922,145 @@ Feature: listing sharedWithMe when auto-sync is disabled } } """ + + + Scenario: user who is also a member of group lists the file shared with them when auto-sync is disabled + Given user "Carol" has been created with default attributes and without skeleton files + And group "grp1" has been created + And the following users have been added to the following groups + | username | groupname | + | Brian | grp1 | + | Carol | grp1 | + And user "Alice" has uploaded file with content "to share" to "textfile.txt" + And user "Brian" has disabled the auto-sync share + And user "Alice" has sent the following share invitation: + | resource | textfile.txt | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + And user "Alice" has sent the following share invitation: + | resource | textfile.txt | + | space | Personal | + | sharee | grp1 | + | shareType | group | + | 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] + }, + "remoteItem": { + "type": "object", + "required": [ + "createdBy", + "eTag", + "file", + "id", + "lastModifiedDateTime", + "name", + "parentReference", + "permissions", + "size" + ], + "properties": { + "permissions": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "required": [ + "grantedToV2", + "id", + "invitation", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "group": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "type": "string", + "enum": ["Brian Murphy"] + } + } + } + } + } + } + }, + { + "type": "object", + "required": [ + "grantedToV2", + "id", + "invitation", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["group"], + "properties": { + "group": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "type": "string", + "enum": ["grp1"] + } + } + } + } + } + } + } + ] + } + } + } + } + } + } + } + } + } + """ From bcb2b2731c22a5b35a1d5c7fd9574a3585569580 Mon Sep 17 00:00:00 2001 From: Prarup Gurung Date: Wed, 14 Feb 2024 12:29:41 +0545 Subject: [PATCH 2/5] Added tests to lists folder shared with group and user when sync is disabled --- .../sharedWithMeSyncDisabled.feature | 140 ++++++++++++++++++ 1 file changed, 140 insertions(+) diff --git a/tests/acceptance/features/apiSharingNg/sharedWithMeSyncDisabled.feature b/tests/acceptance/features/apiSharingNg/sharedWithMeSyncDisabled.feature index b6510c1b1e..63ee4204cd 100644 --- a/tests/acceptance/features/apiSharingNg/sharedWithMeSyncDisabled.feature +++ b/tests/acceptance/features/apiSharingNg/sharedWithMeSyncDisabled.feature @@ -2064,3 +2064,143 @@ Feature: listing sharedWithMe when auto-sync is disabled } } """ + + + Scenario: user who is also a member of group lists the folder shared with them when auto-sync is disabled + Given user "Carol" has been created with default attributes and without skeleton files + And group "grp1" has been created + And the following users have been added to the following groups + | username | groupname | + | Brian | grp1 | + | Carol | grp1 | + And user "Alice" has created folder "folderToShare" + And user "Brian" has disabled the auto-sync share + And user "Alice" has sent the following share invitation: + | resource | folderToShare | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + And user "Alice" has sent the following share invitation: + | resource | folderToShare | + | space | Personal | + | sharee | grp1 | + | shareType | group | + | 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] + }, + "remoteItem": { + "type": "object", + "required": [ + "createdBy", + "eTag", + "folder", + "id", + "lastModifiedDateTime", + "name", + "parentReference", + "permissions" + ], + "properties": { + "permissions": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "required": [ + "grantedToV2", + "id", + "invitation", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "group": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "type": "string", + "enum": ["Brian Murphy"] + } + } + } + } + } + } + }, + { + "type": "object", + "required": [ + "grantedToV2", + "id", + "invitation", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["group"], + "properties": { + "group": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "type": "string", + "enum": ["grp1"] + } + } + } + } + } + } + } + ] + } + } + } + } + } + } + } + } + } + """ From 890777151ccc820ff8bd7b8cea2c9a0e4aad92ce Mon Sep 17 00:00:00 2001 From: Prarup Gurung Date: Tue, 20 Feb 2024 13:06:39 +0545 Subject: [PATCH 3/5] Updated scenario description, removed user carol creation step --- .../sharedWithMeSyncDisabled.feature | 36 ++++++++----------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/tests/acceptance/features/apiSharingNg/sharedWithMeSyncDisabled.feature b/tests/acceptance/features/apiSharingNg/sharedWithMeSyncDisabled.feature index 63ee4204cd..cb90342681 100644 --- a/tests/acceptance/features/apiSharingNg/sharedWithMeSyncDisabled.feature +++ b/tests/acceptance/features/apiSharingNg/sharedWithMeSyncDisabled.feature @@ -13,7 +13,7 @@ Feature: listing sharedWithMe when auto-sync is disabled And user "Brian" has disabled the auto-sync share - Scenario: user lists the file shared with them when auto-sync is disabled + Scenario: user lists the file shared with them Given user "Alice" has uploaded file with content "to share" to "textfile.txt" And user "Alice" has sent the following share invitation: | resource | textfile.txt | @@ -280,7 +280,7 @@ Feature: listing sharedWithMe when auto-sync is disabled """ - Scenario: user lists the folder shared with them when auto-sync is disabled + Scenario: user lists the folder shared with them Given user "Alice" has created folder "folderToShare" And user "Alice" has sent the following share invitation: | resource | folderToShare | @@ -517,9 +517,8 @@ Feature: listing sharedWithMe when auto-sync is disabled """ - Scenario: group member lists the file shared with them when auto-sync is disabled - Given user "Carol" has been created with default attributes and without skeleton files - And group "grp1" has been created + Scenario: group member lists the file shared with them + Given group "grp1" has been created And the following users have been added to the following groups | username | groupname | | Brian | grp1 | @@ -789,9 +788,8 @@ Feature: listing sharedWithMe when auto-sync is disabled """ - Scenario: group member lists the folder shared with them when auto-sync is disabled - Given user "Carol" has been created with default attributes and without skeleton files - And group "grp1" has been created + Scenario: group member lists the folder shared with them + Given group "grp1" has been created And the following users have been added to the following groups | username | groupname | | Brian | grp1 | @@ -1031,7 +1029,7 @@ Feature: listing sharedWithMe when auto-sync is disabled """ - Scenario: user lists file shares shared with them from project-space when auto-sync is disabled + Scenario: user lists file shares shared with them from project-space 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 "projectSpace" with the default quota using the Graph API @@ -1272,7 +1270,7 @@ Feature: listing sharedWithMe when auto-sync is disabled """ - Scenario: user lists folder shares shared with them from project-space when auto-sync is disabled + Scenario: user lists folder shares shared with them from project-space 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 "projectSpace" with the default quota using the Graph API @@ -1488,9 +1486,8 @@ Feature: listing sharedWithMe when auto-sync is disabled """ - Scenario: group member lists the file shared with them from project-space when auto-sync is disabled + Scenario: group member lists the file shared with them from project-space Given using spaces DAV path - And user "Carol" has been created with default attributes and without skeleton files And group "grp1" has been created And the following users have been added to the following groups | username | groupname | @@ -1721,9 +1718,8 @@ Feature: listing sharedWithMe when auto-sync is disabled """ - Scenario: group member lists the space folder shared with them from project-space when auto-sync is disabled + Scenario: group member lists the space folder shared with them from project-space Given using spaces DAV path - And user "Carol" has been created with default attributes and without skeleton files And group "grp1" has been created And the following users have been added to the following groups | username | groupname | @@ -1924,13 +1920,11 @@ Feature: listing sharedWithMe when auto-sync is disabled """ - Scenario: user who is also a member of group lists the file shared with them when auto-sync is disabled - Given user "Carol" has been created with default attributes and without skeleton files - And group "grp1" has been created + Scenario: user who is also a member of group lists the file shared with them + Given group "grp1" has been created And the following users have been added to the following groups | username | groupname | | Brian | grp1 | - | Carol | grp1 | And user "Alice" has uploaded file with content "to share" to "textfile.txt" And user "Brian" has disabled the auto-sync share And user "Alice" has sent the following share invitation: @@ -2066,13 +2060,11 @@ Feature: listing sharedWithMe when auto-sync is disabled """ - Scenario: user who is also a member of group lists the folder shared with them when auto-sync is disabled - Given user "Carol" has been created with default attributes and without skeleton files - And group "grp1" has been created + Scenario: user who is also a member of group lists the folder shared with them + Given group "grp1" has been created And the following users have been added to the following groups | username | groupname | | Brian | grp1 | - | Carol | grp1 | And user "Alice" has created folder "folderToShare" And user "Brian" has disabled the auto-sync share And user "Alice" has sent the following share invitation: From 6c376722956734e8768436fcad2d4cf55597ce3a Mon Sep 17 00:00:00 2001 From: Prarup Gurung Date: Tue, 20 Feb 2024 13:08:50 +0545 Subject: [PATCH 4/5] Strict check for json schema --- .../features/apiSharingNg/sharedWithMeSyncDisabled.feature | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/acceptance/features/apiSharingNg/sharedWithMeSyncDisabled.feature b/tests/acceptance/features/apiSharingNg/sharedWithMeSyncDisabled.feature index cb90342681..c0a50b7144 100644 --- a/tests/acceptance/features/apiSharingNg/sharedWithMeSyncDisabled.feature +++ b/tests/acceptance/features/apiSharingNg/sharedWithMeSyncDisabled.feature @@ -1991,6 +1991,8 @@ Feature: listing sharedWithMe when auto-sync is disabled "properties": { "permissions": { "type": "array", + "minItems": 2, + "maxItems": 2, "items": { "oneOf": [ { @@ -2129,6 +2131,8 @@ Feature: listing sharedWithMe when auto-sync is disabled "properties": { "permissions": { "type": "array", + "minItems": 2, + "maxItems": 2, "items": { "oneOf": [ { From c7cfb371a74f3e2fcce66d19a1ecfcd271f6340b Mon Sep 17 00:00:00 2001 From: Prarup Gurung Date: Tue, 20 Feb 2024 13:11:34 +0545 Subject: [PATCH 5/5] Removed disabled step, it is in background --- .../features/apiSharingNg/sharedWithMeSyncDisabled.feature | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/acceptance/features/apiSharingNg/sharedWithMeSyncDisabled.feature b/tests/acceptance/features/apiSharingNg/sharedWithMeSyncDisabled.feature index c0a50b7144..619a77b600 100644 --- a/tests/acceptance/features/apiSharingNg/sharedWithMeSyncDisabled.feature +++ b/tests/acceptance/features/apiSharingNg/sharedWithMeSyncDisabled.feature @@ -1926,7 +1926,6 @@ Feature: listing sharedWithMe when auto-sync is disabled | username | groupname | | Brian | grp1 | And user "Alice" has uploaded file with content "to share" to "textfile.txt" - And user "Brian" has disabled the auto-sync share And user "Alice" has sent the following share invitation: | resource | textfile.txt | | space | Personal | @@ -2068,7 +2067,6 @@ Feature: listing sharedWithMe when auto-sync is disabled | username | groupname | | Brian | grp1 | And user "Alice" has created folder "folderToShare" - And user "Brian" has disabled the auto-sync share And user "Alice" has sent the following share invitation: | resource | folderToShare | | space | Personal |