From 571625cb17ada3d9d864c69b1765a035302424e6 Mon Sep 17 00:00:00 2001 From: Salipa-Gurung Date: Mon, 5 Aug 2024 17:12:01 +0545 Subject: [PATCH 1/4] add test to check rename activity of file and folder --- .../features/apiGraph/activities.feature | 225 ++++++++++++++++++ 1 file changed, 225 insertions(+) diff --git a/tests/acceptance/features/apiGraph/activities.feature b/tests/acceptance/features/apiGraph/activities.feature index 9d299f8941..b49d6c1c63 100644 --- a/tests/acceptance/features/apiGraph/activities.feature +++ b/tests/acceptance/features/apiGraph/activities.feature @@ -445,3 +445,228 @@ Feature: check activities } } """ + + @issue-9712 + Scenario: check rename activity for a file and a folder + Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt" + And user "Alice" has created folder "/FOLDER" + And user "Alice" has moved file "textfile0.txt" to "renamed.txt" + And user "Alice" has moved folder "/FOLDER" to "RENAMED FOLDER" + When user "Alice" lists the activities for file "renamed.txt" 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}" + } + } + } + } + }, + { + "type": "object", + "required": ["id", "template", "times"], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "template": { + "type": "object", + "required": ["message", "variables"], + "properties": { + "message": { + "const": "{user} renamed {oldResource} to {resource}" + }, + "variables": { + "type": "object", + "required": ["oldResource", "resource", "user"], + "properties": { + "oldResource": { + "type": "object", + "required": ["id", "name"], + "properties": { + "id": { + "const": "" + }, + "name": { + "const": "textfile0.txt" + } + } + }, + "resource": { + "type": "object", + "required": ["id", "name"], + "properties": { + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "name": { + "const": "renamed.txt" + } + } + }, + "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" + } + } + } + } + } + ] + } + } + } + } + """ + When user "Alice" lists the activities for folder "RENAMED FOLDER" 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}" + } + } + } + } + }, + { + "type": "object", + "required": ["id", "template", "times"], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "template": { + "type": "object", + "required": ["message", "variables"], + "properties": { + "message": { + "const": "{user} renamed {oldResource} to {resource}" + }, + "variables": { + "type": "object", + "required": ["oldResource", "resource", "user"], + "properties": { + "oldResource": { + "type": "object", + "required": ["id", "name"], + "properties": { + "id": { + "const": "" + }, + "name": { + "const": "FOLDER" + } + } + }, + "resource": { + "type": "object", + "required": ["id", "name"], + "properties": { + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "name": { + "const": "RENAMED FOLDER" + } + } + }, + "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 317bb6cc2ff8f0d8045e30897e4088b0a9904a15 Mon Sep 17 00:00:00 2001 From: Salipa-Gurung Date: Tue, 13 Aug 2024 17:02:16 +0545 Subject: [PATCH 2/4] refactor scenario for deletion activity --- .../features/apiGraph/activities.feature | 94 ++++++++++--------- 1 file changed, 50 insertions(+), 44 deletions(-) diff --git a/tests/acceptance/features/apiGraph/activities.feature b/tests/acceptance/features/apiGraph/activities.feature index b49d6c1c63..b90a831c57 100644 --- a/tests/acceptance/features/apiGraph/activities.feature +++ b/tests/acceptance/features/apiGraph/activities.feature @@ -101,9 +101,11 @@ Feature: check activities """ @issue-9712 - Scenario: check activities after deleting a file + Scenario: check activities after deleting a file and a folder Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt" + And user "Alice" has created folder "/FOLDER" And user "Alice" has deleted file "textfile0.txt" + And user "Alice" has deleted folder "FOLDER" When 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 @@ -114,8 +116,8 @@ Feature: check activities "properties": { "value": { "type": "array", - "minItems": 2, - "maxItems": 2, + "minItems": 4, + "maxItems": 4, "uniqueItems": true, "items": { "oneOf": [ @@ -129,6 +131,51 @@ Feature: check activities "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" + } + } + } + } + } + } + } + } + }, + { + "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" + } + } + } + } } } } @@ -207,47 +254,6 @@ Feature: check activities } } } - } - ] - } - } - } - } - """ - - @issue-9712 - Scenario: check activities after deleting a folder - Given user "Alice" has created folder "/FOLDER" - And user "Alice" has deleted folder "FOLDER" - When 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}" - } - } - } - } }, { "type": "object", From dbb358b7fbeb01b7563600af76ee9f81821a2301 Mon Sep 17 00:00:00 2001 From: Salipa-Gurung Date: Tue, 13 Aug 2024 17:06:52 +0545 Subject: [PATCH 3/4] added step for checking folder upload activity --- .../features/apiGraph/activities.feature | 93 ++++++++++++++++++- 1 file changed, 92 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/features/apiGraph/activities.feature b/tests/acceptance/features/apiGraph/activities.feature index b90a831c57..819ed7ed6a 100644 --- a/tests/acceptance/features/apiGraph/activities.feature +++ b/tests/acceptance/features/apiGraph/activities.feature @@ -7,8 +7,9 @@ Feature: check activities Given user "Alice" has been created with default attributes and without skeleton files @issue-9712 - Scenario: check activities after uploading a file + Scenario: check activities after uploading a file and a folder Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt" + And user "Alice" has created folder "/FOLDER" When user "Alice" lists the activities for file "textfile0.txt" of space "Personal" using the Graph API Then the HTTP status code should be "200" And the JSON data of the response should match @@ -99,6 +100,96 @@ Feature: check activities } } """ + When user "Alice" lists the activities for folder "FOLDER" 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": 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": "FOLDER" + } + } + }, + "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" + } + } + } + } + } + } + }, + "times": { + "type": "object", + "required": ["recordedTime"], + "properties": { + "recordedTime": { + "type": "string", + "format": "date-time" + } + } + } + } + } + } + } + } + """ @issue-9712 Scenario: check activities after deleting a file and a folder From 6fb5c228dbe12e8be16a10f4c3ec1c2902c4fecf Mon Sep 17 00:00:00 2001 From: Salipa-Gurung Date: Tue, 13 Aug 2024 17:15:05 +0545 Subject: [PATCH 4/4] added step for checking folder move activity --- .../features/apiGraph/activities.feature | 114 +++++++++++++++++- 1 file changed, 113 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/features/apiGraph/activities.feature b/tests/acceptance/features/apiGraph/activities.feature index 819ed7ed6a..4b33715120 100644 --- a/tests/acceptance/features/apiGraph/activities.feature +++ b/tests/acceptance/features/apiGraph/activities.feature @@ -428,10 +428,12 @@ Feature: check activities """ @issue-9712 - Scenario: check move activity for a file + Scenario: check move activity for a file and a folder Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt" + And user "Alice" has created folder "/FOLDER" And user "Alice" has created folder "/New Folder" And user "Alice" has moved file "textfile0.txt" to "New Folder/textfile0.txt" + And user "Alice" has moved folder "FOLDER" to "New Folder/FOLDER" When user "Alice" lists the activities for file "New Folder/textfile0.txt" of space "Personal" using the Graph API Then the HTTP status code should be "200" And the JSON data of the response should match @@ -542,6 +544,116 @@ Feature: check activities } } """ + When user "Alice" lists the activities for folder "New Folder/FOLDER" 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}" + } + } + } + } + }, + { + "type": "object", + "required": ["id","template","times"], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "template": { + "type": "object", + "required": ["message","variables"], + "properties": { + "message": { + "const": "{user} moved {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": "FOLDER" + } + } + }, + "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" + } + } + } + } + } + } + }, + "times": { + "type": "object", + "required": ["recordedTime"], + "properties": { + "recordedTime": { + "type": "string", + "format": "date-time" + } + } + } + } + } + ] + } + } + } + } + """ @issue-9712 Scenario: check rename activity for a file and a folder