Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests-only] [full-ci] Test to check move activity of file #9731

Merged
merged 2 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 108 additions & 30 deletions tests/acceptance/features/apiGraph/activities.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Feature: check activities
@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
When user "Alice" lists the activities for file "textfile0.txt" of space "Personal" using the Graph API
Salipa-Gurung marked this conversation as resolved.
Show resolved Hide resolved
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
Expand Down Expand Up @@ -103,8 +103,8 @@ 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
And user "Alice" lists the activities of space "Personal" using the Graph API
And user "Alice" has deleted file "textfile0.txt"
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
"""
Expand All @@ -129,27 +129,8 @@ 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"
}
}
}
}
}
}
},
"times": {
"type": "object",
"required": ["recordedTime"]
}
}
},
Expand Down Expand Up @@ -237,8 +218,8 @@ 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
And user "Alice" lists the activities of space "Personal" using the Graph API
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
"""
Expand All @@ -263,27 +244,124 @@ Feature: check activities
"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} deleted {resource} from {space}"
},
"variables": {
"type": "object",
"required": ["resource","space","user"],
"properties": {
"resource": {
"type": "object",
"required": ["id", "name"],
"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"]
"required": ["recordedTime"],
"properties": {
"recordedTime": {
"type": "string",
"format": "date-time"
}
}
}
}
}
]
}
}
}
}
"""

@issue-9712
Scenario: check move activity for a file
Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt"
And user "Alice" has created folder "/New Folder"
And user "Alice" has moved file "textfile0.txt" to "New Folder/textfile0.txt"
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
"""
{
"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}"
}
}
}
}
},
Expand All @@ -300,7 +378,7 @@ Feature: check activities
"required": ["message","variables"],
"properties": {
"message": {
"const": "{user} deleted {resource} from {space}"
"const": "{user} moved {resource} to {space}"
},
"variables": {
"type": "object",
Expand All @@ -312,10 +390,10 @@ Feature: check activities
"properties": {
"id": {
"type": "string",
"pattern": "%file_id_pattern%"
"pattern": "^%file_id_pattern%$"
},
"name": {
"const": "FOLDER"
"const": "textfile0.txt"
}
}
},
Expand All @@ -325,7 +403,7 @@ Feature: check activities
"properties": {
"id": {
"type": "string",
"pattern": "^%file_id_pattern%$"
"pattern": "^%user_id_pattern%!%user_id_pattern%$"
},
"name": {
"const": "Alice Hansen"
Expand Down
6 changes: 3 additions & 3 deletions tests/acceptance/features/bootstrap/GraphContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2777,7 +2777,7 @@ public function getPermissionRoleDefinitionUsingGraphAPI(string $user, string $p
}

/**
* @When /^user "([^"]*)" checks the activities for (?:folder|file) "([^"]*)" in space "([^"]*)" using the Graph API/
* @When /^user "([^"]*)" lists the activities for (?:folder|file) "([^"]*)" of space "([^"]*)" using the Graph API/
*
* @param string $user
* @param string $resource
Expand All @@ -2786,7 +2786,7 @@ public function getPermissionRoleDefinitionUsingGraphAPI(string $user, string $p
* @return void
* @throws Exception
*/
public function userChecksTheActivitiesForResourceInSpaceUsingTheGraphAPI(string $user, string $resource, string $spaceName): void {
public function userListsTheActivitiesForResourceOfSpaceUsingTheGraphAPI(string $user, string $resource, string $spaceName): void {
$resourceId = $this->featureContext->spacesContext->getResourceId($user, $spaceName, $resource);
$response = GraphHelper::getActivities(
$this->featureContext->getBaseUrl(),
Expand All @@ -2806,7 +2806,7 @@ public function userChecksTheActivitiesForResourceInSpaceUsingTheGraphAPI(string
*
* @return void
*/
public function userListsTheActivitiesInSpaceUsingTheGraphApi(string $user, string $spaceName): void {
public function userListsTheActivitiesOfSpaceUsingTheGraphApi(string $user, string $spaceName): void {
$spaceId = ($this->featureContext->spacesContext->getSpaceByName($user, $spaceName))["id"];
$response = GraphHelper::getActivities(
$this->featureContext->getBaseUrl(),
Expand Down