From 0f4316bebda1e8720a3db9903b3fd1aba38eda49 Mon Sep 17 00:00:00 2001 From: Salipa-Gurung Date: Fri, 9 Aug 2024 13:04:05 +0545 Subject: [PATCH] add test to check activities inside a folder --- .../features/apiGraph/activities.feature | 251 ++++++++++++++++++ .../features/bootstrap/SpacesContext.php | 2 +- 2 files changed, 252 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/features/apiGraph/activities.feature b/tests/acceptance/features/apiGraph/activities.feature index 9d299f8941c..60b3484cd40 100644 --- a/tests/acceptance/features/apiGraph/activities.feature +++ b/tests/acceptance/features/apiGraph/activities.feature @@ -445,3 +445,254 @@ Feature: check activities } } """ + + @issue-9712 + Scenario: check activities inside a folder + Given user "Alice" has created folder "/New Folder" + And user "Alice" has created folder "/New Folder/Sub Folder" + And user "Alice" has uploaded file with content "ownCloud test text file 0" to "/New Folder/textfile0.txt" + And user "Alice" has moved file "/New Folder/textfile0.txt" to "/New Folder/Sub Folder/textfile0.txt" + And user "Alice" has moved file "/New Folder/Sub Folder/textfile0.txt" to "/New Folder/Sub Folder/renamed.txt" + And user "Alice" has deleted file "/New Folder/Sub Folder/renamed.txt" + When user "Alice" lists the activities for folder "/New 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": 6, + "maxItems": 6, + "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": "New Folder" + } + } + } + } + }, + "times": { + "type": "object", + "required": ["recordedTime"] + } + } + } + } + }, + { + "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": "Sub Folder" + } + } + } + } + }, + "times": { + "type": "object", + "required": ["recordedTime"] + } + } + } + } + }, + { + "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} moved {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} renamed {oldResource} to {resource}" + }, + "variables": { + "type": "object", + "required": ["oldResource", "resource", "user"], + "properties": { + "oldResource": { + "type": "object", + "required": ["id", "name"], + "properties": { + "name": { + "const": "textfile0.txt" + } + } + }, + "resource": { + "type": "object", + "required": ["id", "name"], + "properties": { + "name": { + "const": "renamed.txt" + } + } + } + } + } + } + }, + "times": { + "type": "object", + "required": ["recordedTime"] + } + } + }, + { + "type": "object", + "required": ["id", "template", "times"], + "properties": { + "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": { + "name": { + "const": "renamed.txt" + } + } + } + } + } + } + }, + "times": { + "type": "object", + "required": ["recordedTime"] + } + } + } + ] + } + } + } + } + """ diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index 9cf94d8608c..cee98ac5857 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -1771,7 +1771,7 @@ public function moveFileWithinSpace( } /** - * @When /^user "([^"]*)" moves (?:file|folder) "([^"]*)" to "([^"]*)" in space "([^"]*)" using the WebDAV API$/ + * @When /^user "([^"]*)" (?:moves|renames) (?:file|folder) "([^"]*)" to "([^"]*)" in space "([^"]*)" using the WebDAV API$/ * * @param string $user * @param string $fileSource