From 2b5144a97dabdef8300cb77f1a91f8b55080cfdb Mon Sep 17 00:00:00 2001 From: Salipa-Gurung Date: Fri, 26 Jul 2024 15:07:33 +0545 Subject: [PATCH 1/4] fix indentation --- .../features/apiGraph/activities.feature | 142 +++++++++--------- .../features/bootstrap/GraphContext.php | 1 - 2 files changed, 71 insertions(+), 72 deletions(-) diff --git a/tests/acceptance/features/apiGraph/activities.feature b/tests/acceptance/features/apiGraph/activities.feature index e3b22857f1b..ce96c6ae2c3 100644 --- a/tests/acceptance/features/apiGraph/activities.feature +++ b/tests/acceptance/features/apiGraph/activities.feature @@ -12,82 +12,83 @@ Feature: check activities And the JSON data of the response should match """ { - "type": "object", - "required": ["value"], - "properties": { - "value": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": { - "type": "object", - "required": ["id","template","times"], - "properties": { - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "template": { - "type": "object", - "required": ["message","variables"], - "properties": { - "message": { - "const": "{user} added {resource} to {space}" - }, - "variables": { - "type": "object", - "required": ["resource","space","user"], - "properties": { - "resource": { - "type": "object", - "required": ["id","name"], - "properties": { - "id": { - "type": "string", - "pattern": "%file_id_pattern%" - }, - "name": { - "const": "textfile0.txt" + "type": "object", + "required": ["value"], + "properties": { + "value": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": ["id","template","times"], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "template": { + "type": "object", + "required": ["message","variables"], + "properties": { + "message": { + "const": "{user} added {resource} to {space}" + }, + "variables": { + "type": "object", + "required": ["resource","space","user"], + "properties": { + "resource": { + "type": "object", + "required": ["id","name"], + "properties": { + "id": { + "type": "string", + "pattern": "%file_id_pattern%" + }, + "name": { + "const": "textfile0.txt" + } } - } - }, - "space": { - "type": "object", - "required": ["id","name"], - "properties": { - "id": { - "type": "string", - "pattern": "^%user_id_pattern%!%user_id_pattern%$" - }, - "name": { - "const": "Alice Hansen" + }, + "space": { + "type": "object", + "required": ["id","name"], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%!%user_id_pattern%$" + }, + "name": { + "const": "Alice Hansen" + } } - } - }, - "user": { - "type": "object", - "required": ["id","displayName"], - "properties": { - "id": { - "type": "string", - "pattern": "%user_id_pattern%" - }, - "displayName": { - "const": "Alice" + }, + "user": { + "type": "object", + "required": ["id","displayName"], + "properties": { + "id": { + "type": "string", + "pattern": "%user_id_pattern%" + }, + "displayName": { + "const": "Alice" + } } } } } } - } - }, - "times": { - "type": "object", - "required": ["recordedTime"], - "properties": { - "recordedTime": { - "type": "string", - "format": "date-time" + }, + "times": { + "type": "object", + "required": ["recordedTime"], + "properties": { + "recordedTime": { + "type": "string", + "format": "date-time" + } } } } @@ -95,5 +96,4 @@ Feature: check activities } } } - } - """ + """ diff --git a/tests/acceptance/features/bootstrap/GraphContext.php b/tests/acceptance/features/bootstrap/GraphContext.php index 9f6e0074ca2..c5cc575d0fb 100644 --- a/tests/acceptance/features/bootstrap/GraphContext.php +++ b/tests/acceptance/features/bootstrap/GraphContext.php @@ -2785,7 +2785,6 @@ public function getPermissionRoleDefinitionUsingGraphAPI(string $user, string $p * * @return void * @throws Exception - * */ public function userChecksTheActivitiesForResourceInSpaceUsingTheGraphAPI(string $user, string $resource, string $spaceName): void { $resourceId = $this->featureContext->spacesContext->getResourceId($user, $spaceName, $resource); From e96bac1e251188187eba27d70a89c0f8d2030463 Mon Sep 17 00:00:00 2001 From: Salipa-Gurung Date: Mon, 29 Jul 2024 17:13:01 +0545 Subject: [PATCH 2/4] add test for file deletion activity --- .../features/apiGraph/activities.feature | 139 +++++++++++++++++- .../features/bootstrap/GraphContext.php | 20 +++ 2 files changed, 157 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/features/apiGraph/activities.feature b/tests/acceptance/features/apiGraph/activities.feature index ce96c6ae2c3..ad70fe1d411 100644 --- a/tests/acceptance/features/apiGraph/activities.feature +++ b/tests/acceptance/features/apiGraph/activities.feature @@ -3,10 +3,12 @@ Feature: check activities I want to check who made which changes to files So that I can track modifications - - Scenario: check activities after uploading a file + Background: Given user "Alice" has been created with default attributes and without skeleton files And user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt" + + + Scenario: check activities after uploading a file When user "Alice" checks the activities for file "textfile0.txt" in space "Personal" using the Graph API Then the HTTP status code should be "200" And the JSON data of the response should match @@ -97,3 +99,136 @@ Feature: check activities } } """ + + + Scenario: check activities after deleting a file + When user "Alice" deletes file "/textfile0.txt" using the WebDAV API + And user "Alice" lists the activities of space "Personal" 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", + "minItems": 2, + "maxItems": 2, + "uniqueItems": true, + "items": { + "oneOf": [ + { + "type": "object", + "required": ["id","template","times"], + "properties": { + "template": { + "type": "object", + "required": ["message","variables"], + "properties": { + "message": { + "const": "{user} added {resource} to {space}" + }, + "variables": { + "type": "object", + "required": ["resource","space","user"], + "properties": { + "resource": { + "type": "object", + "required": ["id", "name"], + "properties": { + "name": { + "const": "textfile0.txt" + } + } + } + } + } + } + }, + "times": { + "type": "object", + "required": ["recordedTime"] + } + } + }, + { + "type": "object", + "required": ["id","template","times"], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "template": { + "type": "object", + "required": ["message","variables"], + "properties": { + "message": { + "const": "{user} deleted {resource} from {space}" + }, + "variables": { + "type": "object", + "required": ["resource","space","user"], + "properties": { + "resource": { + "type": "object", + "required": ["id","name"], + "properties": { + "id": { + "type": "string", + "pattern": "%file_id_pattern%" + }, + "name": { + "const": "textfile0.txt" + } + } + }, + "space": { + "type": "object", + "required": ["id","name"], + "properties": { + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "name": { + "const": "Alice Hansen" + } + } + }, + "user": { + "type": "object", + "required": ["id","displayName"], + "properties": { + "id": { + "type": "string", + "pattern": "%user_id_pattern%" + }, + "displayName": { + "const": "Alice" + } + } + } + } + } + } + }, + "times": { + "type": "object", + "required": ["recordedTime"], + "properties": { + "recordedTime": { + "type": "string", + "format": "date-time" + } + } + } + } + } + ] + } + } + } + } + """ diff --git a/tests/acceptance/features/bootstrap/GraphContext.php b/tests/acceptance/features/bootstrap/GraphContext.php index c5cc575d0fb..d01ba2b4e3f 100644 --- a/tests/acceptance/features/bootstrap/GraphContext.php +++ b/tests/acceptance/features/bootstrap/GraphContext.php @@ -2797,4 +2797,24 @@ public function userChecksTheActivitiesForResourceInSpaceUsingTheGraphAPI(string ); $this->featureContext->setResponse($response); } + + /** + * @When user :user lists the activities of space :spaceName using the Graph API + * + * @param string $user + * @param string $spaceName + * + * @return void + */ + public function userListsTheActivitiesInSpaceUsingTheGraphApi(string $user, string $spaceName): void { + $spaceId = ($this->featureContext->spacesContext->getSpaceByName($user, $spaceName))["id"]; + $response = GraphHelper::getActivities( + $this->featureContext->getBaseUrl(), + $this->featureContext->getStepLineRef(), + $user, + $this->featureContext->getPasswordForUser($user), + $spaceId + ); + $this->featureContext->setResponse($response); + } } From b8665e257d2d4802877af773744f31cf854b3e87 Mon Sep 17 00:00:00 2001 From: Salipa-Gurung Date: Tue, 30 Jul 2024 14:53:09 +0545 Subject: [PATCH 3/4] add test for folder deletion activity --- .../features/apiGraph/activities.feature | 137 +++++++++++++++++- 1 file changed, 136 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/features/apiGraph/activities.feature b/tests/acceptance/features/apiGraph/activities.feature index ad70fe1d411..0a9057240af 100644 --- a/tests/acceptance/features/apiGraph/activities.feature +++ b/tests/acceptance/features/apiGraph/activities.feature @@ -5,10 +5,10 @@ Feature: check activities Background: Given user "Alice" has been created with default attributes and without skeleton files - And user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt" Scenario: check activities after uploading a file + Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt" When user "Alice" checks the activities for file "textfile0.txt" in space "Personal" using the Graph API Then the HTTP status code should be "200" And the JSON data of the response should match @@ -102,6 +102,7 @@ Feature: check activities Scenario: check activities after deleting a file + Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt" When user "Alice" deletes file "/textfile0.txt" using the WebDAV API And user "Alice" lists the activities of space "Personal" using the Graph API Then the HTTP status code should be "200" @@ -232,3 +233,137 @@ Feature: check activities } } """ + + + Scenario: check activities after deleting a folder + Given user "Alice" has created folder "/FOLDER" + When user "Alice" deletes folder "/FOLDER" using the WebDAV API + And user "Alice" lists the activities of space "Personal" 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", + "minItems": 2, + "maxItems": 2, + "uniqueItems": true, + "items": { + "oneOf": [ + { + "type": "object", + "required": ["id","template","times"], + "properties": { + "template": { + "type": "object", + "required": ["message","variables"], + "properties": { + "message": { + "const": "{user} added {resource} to {space}" + }, + "variables": { + "type": "object", + "required": ["resource","space","user"], + "properties": { + "resource": { + "type": "object", + "required": ["id", "name"], + "properties": { + "name": { + "const": "FOLDER" + } + } + } + } + } + } + }, + "times": { + "type": "object", + "required": ["recordedTime"] + } + } + }, + { + "type": "object", + "required": ["id","template","times"], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "template": { + "type": "object", + "required": ["message","variables"], + "properties": { + "message": { + "const": "{user} deleted {resource} from {space}" + }, + "variables": { + "type": "object", + "required": ["resource","space","user"], + "properties": { + "resource": { + "type": "object", + "required": ["id","name"], + "properties": { + "id": { + "type": "string", + "pattern": "%file_id_pattern%" + }, + "name": { + "const": "FOLDER" + } + } + }, + "space": { + "type": "object", + "required": ["id","name"], + "properties": { + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "name": { + "const": "Alice Hansen" + } + } + }, + "user": { + "type": "object", + "required": ["id","displayName"], + "properties": { + "id": { + "type": "string", + "pattern": "%user_id_pattern%" + }, + "displayName": { + "const": "Alice" + } + } + } + } + } + } + }, + "times": { + "type": "object", + "required": ["recordedTime"], + "properties": { + "recordedTime": { + "type": "string", + "format": "date-time" + } + } + } + } + } + ] + } + } + } + } + """ From a5f861f99e0245117a56f3121d8238bd498066b3 Mon Sep 17 00:00:00 2001 From: Salipa-Gurung Date: Fri, 9 Aug 2024 14:29:54 +0545 Subject: [PATCH 4/4] add issue tag --- tests/acceptance/features/apiGraph/activities.feature | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/acceptance/features/apiGraph/activities.feature b/tests/acceptance/features/apiGraph/activities.feature index 0a9057240af..7abf36c417c 100644 --- a/tests/acceptance/features/apiGraph/activities.feature +++ b/tests/acceptance/features/apiGraph/activities.feature @@ -6,7 +6,7 @@ Feature: check activities Background: Given user "Alice" has been created with default attributes and without skeleton files - + @issue-9712 Scenario: check activities after uploading a file Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt" When user "Alice" checks the activities for file "textfile0.txt" in space "Personal" using the Graph API @@ -100,7 +100,7 @@ Feature: check activities } """ - + @issue-9712 Scenario: check activities after deleting a file Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt" When user "Alice" deletes file "/textfile0.txt" using the WebDAV API @@ -234,7 +234,7 @@ Feature: check activities } """ - + @issue-9712 Scenario: check activities after deleting a folder Given user "Alice" has created folder "/FOLDER" When user "Alice" deletes folder "/FOLDER" using the WebDAV API